Skip to content

Instantly share code, notes, and snippets.

<?php
class MyObject
{
private string $value;
/**
* @return string
*/
public function getValue(): string
{
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
@BlackScorp
BlackScorp / clone.php
Created May 1, 2022 18:26
testing deep clones
<?php
class SubSubChild {
public function __construct(private string $value)
{
}
}
class OtherObject{
public function __construct(private SubSubChild $subSubChild)
{
}
<?php
error_reporting(E_ALL);
$context = stream_context_create([
'http' => [
'method' => 'GET',
'header' => "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36\r\n"
]
]);
<?php
error_reporting(E_ALL);
interface CartItemInterface
{
public function getPrice(float $from = 0.1, float $to = 100.0): float;
}
class CartItem implements CartItemInterface
<!DOCTYPE html>
<html lang="en">
<head>
<title>Startseite</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body{display:block;margin:0;padding:0;position:absolute;width:100%;height:100%;left:0;top:0}
nav{margin:1rem 0}
version: '3'
services:
master:
image: locustio/locust
ports:
- "8089:8089"
networks:
- ddev_default
volumes:
<?php
use PHPUnit\Framework\TestCase;
abstract class AbstractEntityGetterSetterTester extends TestCase
{
protected $entity;
/**
* @dataProvider getData
*/
@BlackScorp
BlackScorp / User.php
Created March 28, 2021 11:47
Doctrine ORM Example
<?php
namespace BlackScorp\ORM\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class User
* @package BlackScorp\ORM\Entity