kahlan\Scope::_parents PHP Method

_parents() protected method

Gets all parent instances.
protected _parents ( boolean $current = false ) : array.
$current boolean If `true` include `$this` to the list.
return array.
    protected function _parents($current = false)
    {
        $instances = [];
        $instance = $current ? $this : $this->_parent;
        while ($instance !== null) {
            $instances[] = $instance;
            $instance = $instance->_parent;
        }
        return array_reverse($instances);
    }