kelemen/observer

Observer/observable classes and traits

1.0.0 2015-07-08 19:43 UTC

This package is auto-updated.

Last update: 2024-10-18 00:38:24 UTC


README

Observer

Usage

class Foo extends Kelemen\Observer
{
    use Kelemen\ObserverBehavior;

    public function __construct($bar)
    {
        $bar->attach($this);
    }

    public function someFunction()
    {
        // process
    }
}

class Bar extends Kelemen\Observable
{
    use Kelemen\ObservableBehavior;

    public function __construct()
    {
        $this->setState('someFunction')
    }
}