repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Null/BaseClass.php | tests/Unit/DataModel/Null/BaseClass.php | <?php
namespace Tests\Unit\DataModel\Null;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Null/NullTest.php | tests/Unit/DataModel/Null/NullTest.php | <?php
namespace Tests\Unit\DataModel\Null;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class NullTest extends TestCase
{
#[Test] public function bool(): void
{
$BaseClass = BaseClass::from(null);
$this->assertInstanceOf(BaseClass::class, $BaseClass);
}
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Enum/EnumTest.php | tests/Unit/DataModel/Enum/EnumTest.php | <?php
namespace Tests\Unit\DataModel\Enum;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class EnumTest extends TestCase
{
#[Test] public function string(): void
{
$BaseClass = BaseClass::from([
BaseClass::string => 1,
BaseClass::StringEnum => StringEnum::string,
... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Enum/StringEnum.php | tests/Unit/DataModel/Enum/StringEnum.php | <?php
namespace Tests\Unit\DataModel\Enum;
enum StringEnum: string
{
case string = 'string';
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Enum/BaseClass.php | tests/Unit/DataModel/Enum/BaseClass.php | <?php
namespace Tests\Unit\DataModel\Enum;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const string = 'string';
public const StringEnum = 'StringEnum';
public const enum_value = 'enum_value';
public const IntEnum = 'IntEnum';
public string $string;
public... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Enum/IntEnum.php | tests/Unit/DataModel/Enum/IntEnum.php | <?php
namespace Tests\Unit\DataModel\Enum;
use Zerotoprod\DataModel\DataModel;
enum IntEnum: int
{
use DataModel;
case id = 1;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Float/BaseClass.php | tests/Unit/DataModel/Float/BaseClass.php | <?php
namespace Tests\Unit\DataModel\Float;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const float = 'float';
public const Child = 'Child';
public float $float;
public Child $Child;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Float/Child.php | tests/Unit/DataModel/Float/Child.php | <?php
namespace Tests\Unit\DataModel\Float;
use Zerotoprod\DataModel\DataModel;
class Child
{
use DataModel;
public const float = 'float';
public float $float;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Float/FloatTest.php | tests/Unit/DataModel/Float/FloatTest.php | <?php
namespace Tests\Unit\DataModel\Float;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class FloatTest extends TestCase
{
#[Test] public function float(): void
{
$BaseClass = BaseClass::from([
BaseClass::float => '1.1',
BaseClass::Child => [
Chi... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromClass/BaseClass.php | tests/Unit/DataModel/FromClass/BaseClass.php | <?php
namespace Tests\Unit\DataModel\FromClass;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const Child = 'Child';
public const ChildWithoutFrom = 'ChildWithoutFrom';
public Child $Child;
public ChildWithoutFrom $ChildWithoutFrom;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromClass/Child.php | tests/Unit/DataModel/FromClass/Child.php | <?php
namespace Tests\Unit\DataModel\FromClass;
class Child
{
public const id = 'id';
public int $id;
public static function from(): self
{
$self = new self();
$self->id = 1;
return $self;
}
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromClass/FromClassTest.php | tests/Unit/DataModel/FromClass/FromClassTest.php | <?php
namespace Tests\Unit\DataModel\FromClass;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
use TypeError;
class FromClassTest extends TestCase
{
#[Test] public function calls_from_method(): void
{
$BaseClass = BaseClass::from([
BaseClass::Child => 1,
]);
$... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromClass/ChildWithoutFrom.php | tests/Unit/DataModel/FromClass/ChildWithoutFrom.php | <?php
namespace Tests\Unit\DataModel\FromClass;
class ChildWithoutFrom
{
public const id = 'id';
public int $id;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/IgnoresUnions/BaseClass.php | tests/Unit/DataModel/IgnoresUnions/BaseClass.php | <?php
namespace Tests\Unit\DataModel\IgnoresUnions;
use Zerotoprod\DataModel\DataModel;
use Zerotoprod\DataModel\Describe;
class BaseClass
{
use DataModel;
public const id = 'id';
public const required = 'required';
public const no_type = 'no_type';
public int|string $id;
#[Describe(['requir... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/IgnoresUnions/IgnoresUnionsTest.php | tests/Unit/DataModel/IgnoresUnions/IgnoresUnionsTest.php | <?php
namespace Tests\Unit\DataModel\IgnoresUnions;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
use Zerotoprod\DataModel\PropertyRequiredException;
class IgnoresUnionsTest extends TestCase
{
#[Test] public function ignores_unions(): void
{
$BaseClass = BaseClass::from([
Ba... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/MissingProperty/MissingPropertyTest.php | tests/Unit/DataModel/MissingProperty/MissingPropertyTest.php | <?php
namespace Tests\Unit\DataModel\MissingProperty;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class MissingPropertyTest extends TestCase
{
#[Test] public function handles_missing_property(): void
{
$BaseClass = BaseClass::from([
BaseClass::id => 1,
'name' =>... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/MissingProperty/BaseClass.php | tests/Unit/DataModel/MissingProperty/BaseClass.php | <?php
namespace Tests\Unit\DataModel\MissingProperty;
use Zerotoprod\DataModel\DataModel;
/**
* @property $name
*/
class BaseClass
{
use DataModel;
public const id = 'id';
public int $id;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/DynamicSet/BaseClass.php | tests/Unit/DataModel/DynamicSet/BaseClass.php | <?php
namespace Tests\Unit\DataModel\DynamicSet;
use Zerotoprod\DataModel\DataModel;
use Zerotoprod\DataModel\Describe;
class BaseClass
{
use DataModel;
public const foo = 'foo';
public const bar = 'bar';
public string $foo;
public string $bar;
#[Describe(self::foo)]
private function fo... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/DynamicSet/ClassDynamicTest.php | tests/Unit/DataModel/DynamicSet/ClassDynamicTest.php | <?php
namespace Tests\Unit\DataModel\DynamicSet;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class ClassDynamicTest extends TestCase
{
#[Test] public function fromDynamic(): void
{
$BaseClass = BaseClass::from([
BaseClass::foo => 'foo',
BaseClass::bar => 'bar',
... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Bool/BoolTest.php | tests/Unit/DataModel/Bool/BoolTest.php | <?php
namespace Tests\Unit\DataModel\Bool;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
use Zerotoprod\DataModel\PropertyRequiredException;
class BoolTest extends TestCase
{
#[Test] public function bool(): void
{
$BaseClass = BaseClass::from([
BaseClass::bool => 0,
... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Bool/BaseClass.php | tests/Unit/DataModel/Bool/BaseClass.php | <?php
namespace Tests\Unit\DataModel\Bool;
use Zerotoprod\DataModel\DataModel;
use Zerotoprod\DataModel\Describe;
class BaseClass
{
use DataModel;
public const bool = 'bool';
public const bool_describe = 'bool_describe';
public const bool_required = 'bool_required';
public const Child = 'Child';... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Bool/Child.php | tests/Unit/DataModel/Bool/Child.php | <?php
namespace Tests\Unit\DataModel\Bool;
use Zerotoprod\DataModel\DataModel;
class Child
{
use DataModel;
public const bool = 'bool';
public bool $bool;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Recursion/BaseClass.php | tests/Unit/DataModel/Recursion/BaseClass.php | <?php
namespace Tests\Unit\DataModel\Recursion;
use stdClass;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const id = 'id';
public const name = 'name';
public const price = 'price';
public const is_free = 'is_free';
public const list = 'list';
public const ... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Recursion/ShortNamespaceChild.php | tests/Unit/DataModel/Recursion/ShortNamespaceChild.php | <?php
namespace Tests\Unit\DataModel\Recursion;
use Zerotoprod\DataModel\DataModel;
class ShortNamespaceChild
{
use DataModel;
public const id = 'id';
public const name = 'name';
public int $id;
public string $name;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Recursion/InstanceRecursionTest.php | tests/Unit/DataModel/Recursion/InstanceRecursionTest.php | <?php
namespace Tests\Unit\DataModel\Recursion;
use PHPUnit\Framework\Attributes\Test;
use stdClass;
use Tests\TestCase;
class InstanceRecursionTest extends TestCase
{
#[Test] public function recursively_creates_instance_from_array(): void
{
$object = new stdClass;
$object->id = 1;
$B... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Recursion/Child.php | tests/Unit/DataModel/Recursion/Child.php | <?php
namespace Tests\Unit\DataModel\Recursion;
use Zerotoprod\DataModel\DataModel;
class Child
{
use DataModel;
public const id = 'id';
public const name = 'name';
public int $id;
public string $name;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromStdClass/BaseClass.php | tests/Unit/DataModel/FromStdClass/BaseClass.php | <?php
namespace Tests\Unit\DataModel\FromStdClass;
use stdClass;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const id = 'id';
public const Child = 'Child';
public const stdClass = 'stdClass';
public const stdClassWithoutBackslash = 'stdClassWithoutBackslash';
... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromStdClass/FromStdClassTest.php | tests/Unit/DataModel/FromStdClass/FromStdClassTest.php | <?php
namespace Tests\Unit\DataModel\FromStdClass;
use PHPUnit\Framework\Attributes\Test;
use stdClass;
use Tests\TestCase;
class FromStdClassTest extends TestCase
{
#[Test] public function passes_object(): void
{
$Base = new stdClass();
$Base->id = 1;
$BaseClass = BaseClass::from($Ba... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromStdClass/Child.php | tests/Unit/DataModel/FromStdClass/Child.php | <?php
namespace Tests\Unit\DataModel\FromStdClass;
class Child
{
public const id = 'id';
public int $id;
public static function from(): self
{
$self = new self();
$self->id = 1;
return $self;
}
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromStdClass/ChildWithoutFrom.php | tests/Unit/DataModel/FromStdClass/ChildWithoutFrom.php | <?php
namespace Tests\Unit\DataModel\FromStdClass;
class ChildWithoutFrom
{
public const id = 'id';
public int $id;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Instance/BaseClass.php | tests/Unit/DataModel/Instance/BaseClass.php | <?php
namespace Tests\Unit\DataModel\Instance;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const id = 'id';
public const name = 'name';
public int $id;
public string $name;
public function __construct(array $data = [])
{
self::from($data, $this);
... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Instance/InstanceTest.php | tests/Unit/DataModel/Instance/InstanceTest.php | <?php
namespace Tests\Unit\DataModel\Instance;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class InstanceTest extends TestCase
{
#[Test] public function creates_instance_from_array(): void
{
$BaseClass = BaseClass::from([
BaseClass::id => 1,
BaseClass::name => ... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/String/BaseClass.php | tests/Unit/DataModel/String/BaseClass.php | <?php
namespace Tests\Unit\DataModel\String;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const string = 'string';
public const Child = 'Child';
public string $string;
public Child $Child;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/String/Child.php | tests/Unit/DataModel/String/Child.php | <?php
namespace Tests\Unit\DataModel\String;
use Zerotoprod\DataModel\DataModel;
class Child
{
use DataModel;
public const string = 'string';
public string $string;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/String/StringTest.php | tests/Unit/DataModel/String/StringTest.php | <?php
namespace Tests\Unit\DataModel\String;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class StringTest extends TestCase
{
#[Test] public function string(): void
{
$BaseClass = BaseClass::from([
BaseClass::string => 1,
BaseClass::Child => [
Chi... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromDataModel/FromDataModelTest.php | tests/Unit/DataModel/FromDataModel/FromDataModelTest.php | <?php
namespace Tests\Unit\DataModel\FromDataModel;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class FromDataModelTest extends TestCase
{
#[Test] public function from_data_model(): void
{
$BaseClass = BaseClass::from([
BaseClass::id => 1,
BaseClass::Child => C... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromDataModel/BaseClass.php | tests/Unit/DataModel/FromDataModel/BaseClass.php | <?php
namespace Tests\Unit\DataModel\FromDataModel;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const id = 'id';
public const Child = 'Child';
public const NullChild = 'NullChild';
public int $id;
public Child $Child;
public Child $NullChild;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromDataModel/Child.php | tests/Unit/DataModel/FromDataModel/Child.php | <?php
namespace Tests\Unit\DataModel\FromDataModel;
use Zerotoprod\DataModel\DataModel;
class Child
{
use DataModel;
public const id = 'id';
public int $id;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Int/BaseClass.php | tests/Unit/DataModel/Int/BaseClass.php | <?php
namespace Tests\Unit\DataModel\Int;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const int = 'int';
public const Child = 'Child';
public int $int;
public Child $Child;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Int/IntTest.php | tests/Unit/DataModel/Int/IntTest.php | <?php
namespace Tests\Unit\DataModel\Int;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class IntTest extends TestCase
{
#[Test] public function int(): void
{
$BaseClass = BaseClass::from([
BaseClass::int => '1',
BaseClass::Child => [
Child::int =... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/Int/Child.php | tests/Unit/DataModel/Int/Child.php | <?php
namespace Tests\Unit\DataModel\Int;
use Zerotoprod\DataModel\DataModel;
class Child
{
use DataModel;
public const int = 'int';
public int $int;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromArray/ArrayTest.php | tests/Unit/DataModel/FromArray/ArrayTest.php | <?php
namespace Tests\Unit\DataModel\FromArray;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class ArrayTest extends TestCase
{
#[Test] public function array(): void
{
$BaseClass = BaseClass::from([
BaseClass::array => [1],
BaseClass::Child => [
C... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromArray/BaseClass.php | tests/Unit/DataModel/FromArray/BaseClass.php | <?php
namespace Tests\Unit\DataModel\FromArray;
use Zerotoprod\DataModel\DataModel;
class BaseClass
{
use DataModel;
public const array = 'array';
public const object = 'object';
public const Child = 'Child';
public array $array;
public Child $Child;
public array $object;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/DataModel/FromArray/Child.php | tests/Unit/DataModel/FromArray/Child.php | <?php
namespace Tests\Unit\DataModel\FromArray;
use Zerotoprod\DataModel\DataModel;
class Child
{
use DataModel;
public const array = 'array';
public array $array;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Post/BaseClass.php | tests/Unit/Examples/Post/BaseClass.php | <?php
namespace Tests\Unit\Examples\Post;
use Zerotoprod\DataModel\Describe;
class BaseClass
{
use \Zerotoprod\DataModel\DataModel;
public const int = 'int';
#[Describe([
'post' => [self::class, 'post'],
'message' => 'Value too large.',
])]
public int $int;
public static fu... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Post/PostTest.php | tests/Unit/Examples/Post/PostTest.php | <?php
namespace Tests\Unit\Examples\Post;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class
PostTest extends TestCase
{
#[Test] public function from(): void
{
$this->expectExceptionMessage('Value too large.');
BaseClass::from([
BaseClass::int => 100,
]);
... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/From/User.php | tests/Unit/Examples/From/User.php | <?php
namespace Tests\Unit\Examples\From;
use Zerotoprod\DataModel\Describe;
class User
{
use \Zerotoprod\DataModel\DataModel;
public const first_name = 'first_name';
#[Describe(['from' => 'firstName'])]
public string $first_name;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/From/ClassTest.php | tests/Unit/Examples/From/ClassTest.php | <?php
namespace Tests\Unit\Examples\From;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class ClassTest extends TestCase
{
#[Test] public function from(): void
{
$User = User::from([
'firstName' => '1',
]);
$this->assertEquals('1', $User->first_name);
}
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/ExtendsTrait/BaseClass.php | tests/Unit/Examples/ExtendsTrait/BaseClass.php | <?php
namespace Tests\Unit\Examples\ExtendsTrait;
class BaseClass
{
use DataModel;
public const string = 'string';
public string $string;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/ExtendsTrait/ClassTest.php | tests/Unit/Examples/ExtendsTrait/ClassTest.php | <?php
namespace Tests\Unit\Examples\ExtendsTrait;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class ClassTest extends TestCase
{
#[Test] public function from(): void
{
$BaseClass = BaseClass::from([
BaseClass::string => 'foo',
]);
$this->assertEquals('foo',... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/ExtendsTrait/DataModel.php | tests/Unit/Examples/ExtendsTrait/DataModel.php | <?php
namespace Tests\Unit\Examples\ExtendsTrait;
trait DataModel
{
use \Zerotoprod\DataModel\DataModel;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/ClassLevelCast/User.php | tests/Unit/Examples/ClassLevelCast/User.php | <?php
namespace Tests\Unit\Examples\ClassLevelCast;
use DateTimeImmutable;
use Zerotoprod\DataModel\DataModel;
use Zerotoprod\DataModel\Describe;
#[Describe([
'cast' => [
'string' => 'uppercase',
DateTimeImmutable::class => [__CLASS__, 'toDateTimeImmutable'],
]
])]
class User
{
use DataMo... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/ClassLevelCast/UserTest.php | tests/Unit/Examples/ClassLevelCast/UserTest.php | <?php
namespace Tests\Unit\Examples\ClassLevelCast;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class UserTest extends TestCase
{
#[Test] public function from(): void
{
$user = User::from([
'first_name' => 'Jane',
'registered' => '2015-10-04 17:24:43.000000',
... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/PropertyLevelCast/User.php | tests/Unit/Examples/PropertyLevelCast/User.php | <?php
namespace Tests\Unit\Examples\PropertyLevelCast;
use ReflectionAttribute;
use ReflectionProperty;
use Zerotoprod\DataModel\DataModel;
use Zerotoprod\DataModel\Describe;
class User
{
use DataModel;
#[Describe(['cast' => [__CLASS__, 'firstName'], 'function' => 'strtoupper'])]
public string $first_na... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/PropertyLevelCast/UserTest.php | tests/Unit/Examples/PropertyLevelCast/UserTest.php | <?php
namespace Tests\Unit\Examples\PropertyLevelCast;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class UserTest extends TestCase
{
#[Test] public function from(): void
{
$user = User::from([
'first_name' => 'Jane',
'last_name' => 'Doe',
]);
$t... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Ignore/User.php | tests/Unit/Examples/Ignore/User.php | <?php
namespace Tests\Unit\Examples\Ignore;
use Tests\Unit\Examples\ExtendsTrait\DataModel;
use Zerotoprod\DataModel\Describe;
class User
{
use DataModel;
public string $name;
#[Describe(['ignore' => true])]
public int $age;
#[Describe(['ignore'])]
public int $height;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Ignore/IgnoreTest.php | tests/Unit/Examples/Ignore/IgnoreTest.php | <?php
namespace Tests\Unit\Examples\Ignore;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class IgnoreTest extends TestCase
{
#[Test] public function from(): void
{
$user = User::from([
'name' => 'John Doe',
'age' => '30',
'height' => '30',
]);... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Instance/User.php | tests/Unit/Examples/Instance/User.php | <?php
namespace Tests\Unit\Examples\Instance;
use Zerotoprod\DataModel\DataModel;
class User
{
use DataModel;
public string $name;
public function __construct(array $data = [])
{
self::from($data, $this);
}
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Instance/InstanceTest.php | tests/Unit/Examples/Instance/InstanceTest.php | <?php
namespace Tests\Unit\Examples\Instance;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class InstanceTest extends TestCase
{
#[Test] public function creates_instance_from_array(): void
{
$BaseClass = new User([
'name' => 'name'
]);
$this->assertEquals('n... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/MissingAsNull/User.php | tests/Unit/Examples/MissingAsNull/User.php | <?php
namespace Tests\Unit\Examples\MissingAsNull;
use Zerotoprod\DataModel\Describe;
#[Describe(['nullable' => true])]
class User
{
use \Zerotoprod\DataModel\DataModel;
public string $name;
public ?int $age;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/MissingAsNull/MissingAsNullTest.php | tests/Unit/Examples/MissingAsNull/MissingAsNullTest.php | <?php
namespace Tests\Unit\Examples\MissingAsNull;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class MissingAsNullTest extends TestCase
{
#[Test] public function from(): void
{
$User = User::from([
'name' => 'John',
]);
$this->assertEquals('John', $User->na... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Usage/User.php | tests/Unit/Examples/Usage/User.php | <?php
namespace Tests\Unit\Examples\Usage;
use Tests\Unit\Examples\ExtendsTrait\DataModel;
class User
{
use DataModel;
public string $name;
public int $age;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Usage/UserTest.php | tests/Unit/Examples/Usage/UserTest.php | <?php
namespace Tests\Unit\Examples\Usage;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class UserTest extends TestCase
{
#[Test] public function from(): void
{
$user = User::from([
'name' => 'John Doe',
'age' => '30',
]);
$this->assertEquals('Jo... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Default/DefaultTest.php | tests/Unit/Examples/Default/DefaultTest.php | <?php
namespace Tests\Unit\Examples\Default;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class DefaultTest extends TestCase
{
#[Test] public function from(): void
{
$user = User::from();
$this->assertEquals('James', $user->name);
}
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Default/User.php | tests/Unit/Examples/Default/User.php | <?php
namespace Tests\Unit\Examples\Default;
use Tests\Unit\Examples\ExtendsTrait\DataModel;
use Zerotoprod\DataModel\Describe;
class User
{
use DataModel;
#[Describe(['default' => 'James'])]
public string $name;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Pre/BaseClass.php | tests/Unit/Examples/Pre/BaseClass.php | <?php
namespace Tests\Unit\Examples\Pre;
use Zerotoprod\DataModel\Describe;
class BaseClass
{
use \Zerotoprod\DataModel\DataModel;
public const int = 'int';
#[Describe(['pre' => [self::class, 'pre'], 'message' => 'Value too large.'])]
public int $int;
public static function pre($value, array $... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/Pre/PreTest.php | tests/Unit/Examples/Pre/PreTest.php | <?php
namespace Tests\Unit\Examples\Pre;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class
PreTest extends TestCase
{
#[Test] public function from(): void
{
$this->expectExceptionMessage('Value too large.');
BaseClass::from([
BaseClass::int => 100,
]);
... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/AutomaticInstantiation/Address.php | tests/Unit/Examples/AutomaticInstantiation/Address.php | <?php
namespace Tests\Unit\Examples\AutomaticInstantiation;
use Tests\Unit\Examples\ExtendsTrait\DataModel;
class Address
{
use DataModel;
public string $street;
public string $city;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/AutomaticInstantiation/AutomaticInstantiationTest.php | tests/Unit/Examples/AutomaticInstantiation/AutomaticInstantiationTest.php | <?php
namespace Tests\Unit\Examples\AutomaticInstantiation;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class AutomaticInstantiationTest extends TestCase
{
#[Test] public function from(): void
{
$user = User::from([
'name' => 'John Doe',
'address' => [
... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/AutomaticInstantiation/User.php | tests/Unit/Examples/AutomaticInstantiation/User.php | <?php
namespace Tests\Unit\Examples\AutomaticInstantiation;
use Tests\Unit\Examples\ExtendsTrait\DataModel;
class User
{
use DataModel;
public string $name;
public Address $address;
} | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/MethodLevelCast/User.php | tests/Unit/Examples/MethodLevelCast/User.php | <?php
namespace Tests\Unit\Examples\MethodLevelCast;
use Zerotoprod\DataModel\DataModel;
use Zerotoprod\DataModel\Describe;
class User
{
use DataModel;
public string $first_name;
public string $last_name;
public string $fullName;
#[Describe('last_name')]
public function lastName(?string $va... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
zero-to-prod/data-model | https://github.com/zero-to-prod/data-model/blob/af1a3958fdf2d4cccbab4b787d2c510d04cdd384/tests/Unit/Examples/MethodLevelCast/UserTest.php | tests/Unit/Examples/MethodLevelCast/UserTest.php | <?php
namespace Tests\Unit\Examples\MethodLevelCast;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class UserTest extends TestCase
{
#[Test] public function from(): void
{
$user = User::from([
'first_name' => 'Jane',
'last_name' => 'Doe',
]);
$th... | php | MIT | af1a3958fdf2d4cccbab4b787d2c510d04cdd384 | 2026-01-05T04:40:32.643481Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Directed.php | src/Directed.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\EdgeDirected;
use Graphp\Graph\EdgeUndirected;
/**
* Basic algorithms for working with the undirected or directed Graphs (digraphs) / Walks.
*
* @link http://en.wikipedia.org/wiki/Glossary_of_graph_theory#Direction
* @link http://en.wikipedia.org/wiki/Digraph_%... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/DetectNegativeCycle.php | src/DetectNegativeCycle.php | <?php
namespace Graphp\Algorithms;
use Graphp\Algorithms\ShortestPath\MooreBellmanFord as SpMooreBellmanFord;
use Graphp\Graph\Exception\NegativeCycleException;
use Graphp\Graph\Exception\UnderflowException;
use Graphp\Graph\Graph;
use Graphp\Graph\Walk;
class DetectNegativeCycle extends BaseGraph
{
/**
* c... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/ConnectedComponents.php | src/ConnectedComponents.php | <?php
namespace Graphp\Algorithms;
use Graphp\Algorithms\Search\BreadthFirst as SearchBreadthFirst;
use Graphp\Graph\Exception\InvalidArgumentException;
use Graphp\Graph\Exception\UnderflowException;
use Graphp\Graph\Graph;
use Graphp\Graph\Vertex;
/**
* Algorithm for working with connected components
*
* @link h... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/TransposeGraph.php | src/TransposeGraph.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\EdgeDirected;
use Graphp\Graph\Exception\UnexpectedValueException;
use Graphp\Graph\Graph;
class TransposeGraph extends BaseGraph
{
/**
* create transpose graph
*
* @throws UnexpectedValueException if input graph has undirected edges
* @retu... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Base.php | src/Base.php | <?php
namespace Graphp\Algorithms;
/**
* @deprecated
*/
abstract class Base{ }
| php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Eulerian.php | src/Eulerian.php | <?php
namespace Graphp\Algorithms;
class Eulerian extends BaseGraph
{
/**
* check whether this graph has an eulerian cycle
*
* @return bool
* @uses ConnectedComponents::isSingle()
* @uses Degree::getDegreeVertex()
* @todo isolated vertices should be ignored
* @todo definition is... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Weight.php | src/Weight.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Graph;
/**
* Basic algorithms for working with the (total) weight of a Graph/Walk
*
* A weighted graph associates a label (weight) with every edge in the graph.
* Sometimes the word cost is used instead of weight. The term network is a
* synonym for a weighted... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/BaseDual.php | src/BaseDual.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Graph;
use Graphp\Graph\Set\DualAggregate;
use Graphp\Graph\Walk;
/**
* Abstract base class for algorithms that operate on a given Set instance
*
* @see Set
* @deprecated
*/
abstract class BaseDual extends Base
{
/**
* Set to operate on
*
* ... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/ResidualGraph.php | src/ResidualGraph.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Edge;
use Graphp\Graph\EdgeDirected;
use Graphp\Graph\Exception\UnexpectedValueException;
use Graphp\Graph\Graph;
class ResidualGraph extends BaseGraph
{
private $keepNullCapacity = false;
private $mergeParallelEdges = false;
public function setKeepNul... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Symmetric.php | src/Symmetric.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\EdgeDirected;
/**
* Basic algorithms for working with symmetric digraphs
*
* A directed graph is called symmetric if, for every arc that belongs to it,
* the corresponding reversed arc (antiparallel directed edge) also belongs to it.
*
* @link http://en.wikip... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Bipartit.php | src/Bipartit.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Exception\UnexpectedValueException;
use Graphp\Graph\Graph;
class Bipartit extends BaseGraph
{
/**
* check whether this graph is bipartit
*
* @return bool
* @uses AlgorithmBipartit::getColors()
*/
public function isBipartit()
{
... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Loop.php | src/Loop.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Vertex;
/**
* Basic algorithms for working with loop edges
*
* A loop (also called a self-loop or a "buckle") is an edge that connects a
* Vertex to itself. A simple graph contains no loops.
*
* @link http://en.wikipedia.org/wiki/Loop_%28graph_theory%29
*/
c... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Flow.php | src/Flow.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\EdgeDirected;
use Graphp\Graph\Exception\UnexpectedValueException;
use Graphp\Graph\Vertex;
/**
* Basic algorithms for working with flow graphs
*
* A flow network (also known as a transportation network) is a directed graph
* where each edge has a capacity and ... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/TopologicalSort.php | src/TopologicalSort.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Exception\UnexpectedValueException;
use Graphp\Graph\Set\Vertices;
use Graphp\Graph\Vertex;
/**
* topological sorting / order, also known as toposort / topsort, commonly used in resolving dependencies
*
* @author clue
* @link http://en.wikipedia.org/wiki/Topolo... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Parallel.php | src/Parallel.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Edge;
use Graphp\Graph\EdgeDirected as EdgeDirected;
use Graphp\Graph\Set\Edges;
/**
* Basic algorithms for working with parallel edges
*
* Parallel edges (also called multiple edges or a multi-edge), are two or more
* edges that are incident to the same two ve... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Groups.php | src/Groups.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Set\Vertices;
use Graphp\Graph\Vertex;
class Groups extends BaseGraph
{
/**
* count total number of different groups assigned to vertices
*
* @return int
* @uses AlgorithmGroups::getGroups()
*/
public function getNumberOfGroups()
... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Complete.php | src/Complete.php | <?php
namespace Graphp\Algorithms;
/**
* Basic algorithms for working with complete graphs
*
* A complete graph is a graph in which every pair of vertices is connected
* by an edge.
*
* @link http://en.wikipedia.org/wiki/Complete_graph
* @link http://mathworld.wolfram.com/CompleteGraph.html
*/
class Complete ... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/Degree.php | src/Degree.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Exception\UnderflowException;
use Graphp\Graph\Exception\UnexpectedValueException;
use Graphp\Graph\Vertex;
/**
* Basic algorithms for working with the degrees of Graphs.
*
* The degree (or valency) of a Vertex of a Graph is the number of Edges
* incident to th... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/BaseVertex.php | src/BaseVertex.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Vertex;
/**
* Abstract base class for algorithms that operate on a given Vertex instance
*
* @deprecated
*/
abstract class BaseVertex extends Base
{
/**
* Vertex to operate on
*
* @var Vertex
*/
protected $vertex;
/**
* ins... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/BaseGraph.php | src/BaseGraph.php | <?php
namespace Graphp\Algorithms;
use Graphp\Graph\Graph;
/**
* Abstract base class for algorithms that operate on a given Graph instance
*
* @deprecated
*/
abstract class BaseGraph extends Base
{
/**
* Graph to operate on
*
* @var Graph
*/
protected $graph;
/**
* instantia... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/ShortestPath/BreadthFirst.php | src/ShortestPath/BreadthFirst.php | <?php
namespace Graphp\Algorithms\ShortestPath;
use Graphp\Graph\Vertex;
use Graphp\Graph\Exception\OutOfBoundsException;
use Graphp\Graph\Set\Edges;
use Graphp\Graph\Set\Vertices;
/**
* Simple breadth-first shortest path algorithm
*
* This algorithm ignores edge weights and operates as a level-order algorithm
*... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/ShortestPath/Base.php | src/ShortestPath/Base.php | <?php
namespace Graphp\Algorithms\ShortestPath;
use Graphp\Algorithms\BaseVertex;
use Graphp\Graph\Edge;
use Graphp\Graph\Exception\InvalidArgumentException;
use Graphp\Graph\Exception\OutOfBoundsException;
use Graphp\Graph\Graph;
use Graphp\Graph\Set\Edges;
use Graphp\Graph\Set\Vertices;
use Graphp\Graph\Vertex;
use... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/ShortestPath/Dijkstra.php | src/ShortestPath/Dijkstra.php | <?php
namespace Graphp\Algorithms\ShortestPath;
use Graphp\Graph\Exception\UnexpectedValueException;
use Graphp\Graph\Set\Edges;
use SplPriorityQueue;
/**
* Commonly used Dijkstra's shortest path algorithm
*
* This is asymptotically the fastest known single-source shortest-path
* algorithm for arbitrary graphs w... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/ShortestPath/MooreBellmanFord.php | src/ShortestPath/MooreBellmanFord.php | <?php
namespace Graphp\Algorithms\ShortestPath;
use Graphp\Graph\Exception\NegativeCycleException;
use Graphp\Graph\Exception\UnderflowException;
use Graphp\Graph\Set\Edges;
use Graphp\Graph\Vertex;
use Graphp\Graph\Walk;
/**
* Moore-Bellman-Ford's shortest path algorithm
*
* It is slower than Dijkstra's algorith... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/MinimumCostFlow/Base.php | src/MinimumCostFlow/Base.php | <?php
namespace Graphp\Algorithms\MinimumCostFlow;
use Graphp\Algorithms\BaseGraph;
use Graphp\Algorithms\Weight as AlgorithmWeight;
use Graphp\Algorithms\Flow as AlgorithmFlow;
use Graphp\Graph\Exception\UnderflowException;
use Graphp\Graph\Exception\UnexpectedValueException;
use Graphp\Graph\Graph;
use Graphp\Graph... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/MinimumCostFlow/CycleCanceling.php | src/MinimumCostFlow/CycleCanceling.php | <?php
namespace Graphp\Algorithms\MinimumCostFlow;
use Graphp\Algorithms\DetectNegativeCycle;
use Graphp\Algorithms\MaxFlow\EdmondsKarp as MaxFlowEdmondsKarp;
use Graphp\Algorithms\ResidualGraph;
use Graphp\Graph\Exception\UnderflowException;
use Graphp\Graph\Exception\UnexpectedValueException;
use Graphp\Graph\Set\E... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/MinimumCostFlow/SuccessiveShortestPath.php | src/MinimumCostFlow/SuccessiveShortestPath.php | <?php
namespace Graphp\Algorithms\MinimumCostFlow;
use Graphp\Algorithms\ResidualGraph;
use Graphp\Algorithms\ShortestPath\MooreBellmanFord as SpMooreBellmanFord;
use Graphp\Algorithms\Search\BreadthFirst as SearchBreadthFirst;
use Graphp\Graph\EdgeDirected;
use Graphp\Graph\Exception\UnderflowException;
use Graphp\G... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
graphp/algorithms | https://github.com/graphp/algorithms/blob/269389305c94ad9b72b35a9f798ed70c1f708fc2/src/TravelingSalesmanProblem/Base.php | src/TravelingSalesmanProblem/Base.php | <?php
namespace Graphp\Algorithms\TravelingSalesmanProblem;
use Graphp\Algorithms\Base as AlgorithmBase;
use Graphp\Graph\Graph;
use Graphp\Graph\Set\Edges;
use Graphp\Graph\Vertex;
use Graphp\Graph\Walk;
abstract class Base extends AlgorithmBase
{
/**
* get resulting graph with the (first) best circle of e... | php | MIT | 269389305c94ad9b72b35a9f798ed70c1f708fc2 | 2026-01-05T04:40:43.543752Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.