Demo\Example\HumanDemo::eat PHP Method

eat() public method

Eat something
public eat ( )
    public function eat()
    {
        echo "Eating...", PHP_EOL;
    }

Usage Example

Beispiel #1
0
 case 'fluent-interface':
     $aspectName = 'Demo\\Aspect\\FluentInterfaceAspect';
     $example = new UserFluentDemo();
     // Original class doesn't provide fluent interface for us
     if ($example instanceof \Go\Aop\Proxy) {
         // This check is to prevent fatal errors when AOP is disabled
         $example->setName('John')->setSurname('Doe')->setPassword('root');
     } else {
         echo "Fluent interface is not available without AOP", PHP_EOL;
     }
     break;
 case 'human-advices':
     $aspectName = 'Demo\\Aspect\\HealthyLiveAspect';
     $example = new HumanDemo();
     echo "Want to eat something, let's have a breakfast!", PHP_EOL;
     $example->eat();
     echo "I should work to earn some money", PHP_EOL;
     $example->work();
     echo "It was a nice day, go to bed", PHP_EOL;
     $example->sleep();
     break;
 case 'dynamic-traits':
     $aspectName = 'Demo\\Aspect\\IntroductionAspect';
     $example = new IntroductionDemo();
     // Original class doesn't implement Serializable
     $example->testSerializable();
     break;
 case 'declare-errors':
     $aspectName = 'Demo\\Aspect\\DeclareErrorAspect';
     $example = new ErrorDemo();
     $example->oldMethod();