Esempio n. 1
0
<?php

echo BarClass::foo();
echo FooClass::foo();
Esempio n. 2
0
    /**
     * Gets the 'method_call1' service.
     *
     * This service is shared.
     * This method always returns the same instance of the service.
     *
     * @return FooClass A FooClass instance.
     */
    protected function getMethodCall1Service()
    {
        require_once '%path%foo.php';

        $this->services['method_call1'] = $instance = new \FooClass();

        $instance->setBar($this->get('foo'));
        $instance->setBar($this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE));
        if ($this->has('foo3')) {
            $instance->setBar($this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE));
        }
        if ($this->has('foobaz')) {
            $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
        }

        return $instance;
    }
 /**
  * Gets the 'method_call1' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \FooClass A FooClass instance.
  */
 protected function getMethodCall1Service()
 {
     require_once '%path%foo.php';
     $this->services['method_call1'] = $instance = new \FooClass();
     $instance->setBar($this->get('foo'));
     $instance->setBar(NULL);
     return $instance;
 }
Esempio n. 4
0
 /**
  * Gets the 'method_call1' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return FooClass A FooClass instance.
  */
 protected function getMethodCall1Service()
 {
     if (isset($this->shared['method_call1'])) {
         return $this->shared['method_call1'];
     }
     $instance = new FooClass();
     $this->shared['method_call1'] = $instance;
     $instance->setBar($this->getFooService());
     $instance->setBar($this->getService('foo', Container::NULL_ON_INVALID_REFERENCE));
     if ($this->hasService('foo')) {
         $instance->setBar($this->getService('foo', Container::NULL_ON_INVALID_REFERENCE));
     }
     if ($this->hasService('foobaz')) {
         $instance->setBar($this->getService('foobaz', Container::NULL_ON_INVALID_REFERENCE));
     }
     return $instance;
 }
Esempio n. 5
0
 /**
  * @covers FooClass::foo
  * @todo   Implement testFoo().
  */
 public function testFoo()
 {
     $this->assertEquals(100, $this->object->foo());
 }
 /**
  * Gets the 'foo' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return FooClass A FooClass instance.
  */
 protected function getFooService()
 {
     $this->services['foo'] = $instance = new \FooClass();
     $instance->setBar('someValue');
     return $instance;
 }
Esempio n. 7
0
<?php

class FooClass
{
    function divby($x)
    {
        echo 5 / $x;
    }
}
$x = new FooClass();
$x->divby(0);
 /**
  * Gets the 'method_call1' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \FooClass A FooClass instance.
  */
 protected function getMethodCall1Service()
 {
     require_once '%path%foo.php';
     $this->services['method_call1'] = $instance = new \FooClass();
     $instance->setBar($this->get('foo'));
     $instance->setBar(NULL);
     $instance->setBar($this->get("foo")->foo() . ($this->hasparameter("foo") ? $this->getParameter("foo") : "default"));
     return $instance;
 }
Esempio n. 9
0
<?php

function foo($longParameterName1, $longParameterName2, $longParameterName3, $longParameterName4 = '', $longParameterName1 = '')
{
}
$closure = function ($longParameterName1, $longParameterName2, $longParameterName3, $longParameterName4 = '', $longParameterName1 = '') {
    $innerClosure = function ($param) use($longUseVariable1, $longUseVariable2, $longUseVariable3, $longUseVariable4, $longUseVariable5) {
        foo('longParameterName1', 'longParameterName2', 'longParameterName3', 'longParameterName4', 'longParameterName1');
        $obj->foo('longParameterName1', 'longParameterName2', 'longParameterName3', 'longParameterName4', 'longParameterName1');
        FooClass::foo('longParameterName1', 'longParameterName2', 'longParameterName3', 'longParameterName4', 'longParameterName1');
    };
};
class X extends Y implements LongInterfaceName1, LongInterfaceName2, LongInterfaceName3, LongInterfaceName4, LongInterfaceName5, LongInterfaceName5
{
    use SomeLongTraitName1, SomeLongTraitName2, SomeLongTraitName3, SomeLongTraitName4, SomeLongTraitName5;
    public function foo($longParameterName1, $longParameterName2, $longParameterName3, $longParameterName4 = '', $longParameterName1 = '')
    {
    }
}
class Y
{
    use SomeLongTraitName1, SomeLongTraitName2, SomeLongTraitName3, SomeLongTraitName4, SomeLongTraitName5 {
        B::smallTalk insteadof SomeLongTraitName1;
        A::bigTalk insteadof SomeLongTraitName2;
        B::bigTalk as talk;
    }
    /**
     * @var int
     */
    private $somePrivatePropertiesOnTheSameLine1, $somePrivatePropertiesOnTheSameLine2, $somePrivatePropertiesOnTheSameLine3;
}