Beispiel #1
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Cocur\Ea\ClassFactory;
use Cocur\Ea\Ea;
use Cocur\Ea\PropertyFactory;
Ea::create()->addClass(ClassFactory::create('Foo', 'Foobar')->addProperty(PropertyFactory::create('foo')))->execute();
$foo = new Foobar\Foo();
$foo->foo = 'foo';
echo "foo? foo=" . $foo->foo . "\n";
Beispiel #2
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Cocur\Ea\ClassFactory;
use Cocur\Ea\Ea;
use Cocur\Ea\PropertyFactory;
$name = PropertyFactory::create('name', 'private');
Ea::create()->addClass(ClassFactory::create('Foo', 'Foobar')->addProperty($name)->addGetter($name)->addSetter($name))->execute();
$foo = new Foobar\Foo();
$foo->setName('Florian');
echo "name: " . $foo->getName() . "\n";
Beispiel #3
0
 /**
  * @test
  * @covers Cocur\Ea\Ea::execute()
  */
 public function executeExecutesCode()
 {
     $this->ea->addClass(new ClassFactory('Foo123'))->addClass(new ClassFactory('Bar123'))->execute();
     $this->assertTrue(class_exists('Foo123'));
     $this->assertTrue(class_exists('Bar123'));
 }