예제 #1
0
파일: context.php 프로젝트: poef/ariadne
    /**
     * Adds/overrides a set of properties/methods in a new 'stack frame'
     * @param $params
     */
    public static function push($params)
    {
        self::$context = self::$context->extend($params);
    }
    /**
     * Removes last addition/overrides from the container.
     */
    public static function pop()
    {
        self::$context = self::$context->prototype;
    }
    /**
     * Take a peek at earlier entries of the container.
     * @param int $level
     * @return null
     */
    public static function peek($level = 0)
    {
        $context = self::$context;
        for ($i = $level; $i >= 0; $i--) {
            $context = $context->prototype;
        }
        return $context;
    }
}
context::$context = new lambda\Prototype(['arcPath' => '/']);