Kahlan\Plugin\Call\Message::__construct PHP Method

__construct() public method

The Constructor.
public __construct ( array $config = [] )
$config array Possible options are: - `'reference'` _mixed_ : The message reference. - `'name'` _string_ : The message name. - `'args'` _array_ : The message arguments. - `'static'` _boolean_: `true` if the method is static, `false` otherwise.
    public function __construct($config = [])
    {
        $defaults = ['parent' => null, 'reference' => null, 'name' => null, 'args' => null, 'static' => false];
        $config += $defaults;
        $static = $config['static'];
        $name = $config['name'];
        if (preg_match('/^::.*/', $name)) {
            $static = true;
            $name = substr($name, 2);
        }
        $this->_parent = $config['parent'];
        $this->_reference = $config['reference'];
        $this->_name = $name;
        $this->_args = $config['args'];
        $this->_static = $static;
    }

Usage Example

Beispiel #1
0
 /**
  * The Constructor.
  *
  * @param array $config The options array, possible options are:
  *                      - `'closure'`: the closure to execute for this stub.
  *                      - `'params'`: the params required for exectuting this stub.
  *                      - `'static'`: the type of call required for exectuting this stub.
  *                      - `'returns'`: the returns values for this stub (used only if
  *                        the `'closure'` option is missing).
  */
 public function __construct($config = [])
 {
     $defaults = ['closure' => null, 'params' => [], 'returns' => [], 'static' => false];
     $config += $defaults;
     parent::__construct($config);
     $this->_closure = $config['closure'];
     $this->_returns = $config['returns'];
 }
All Usage Examples Of Kahlan\Plugin\Call\Message::__construct