Exemplo n.º 1
0
    /**
     * Allow setting of attributes and tasks directly
     *
     * @param string $var
     * @param string|object $value
     */
    function __set($var, $value)
    {
        if (strpos($var, $this->_packagefile->getTasksNs()) === 0) {
            // setting a file task
            if ($value instanceof \PEAR2\Pyrus\Task\Common) {
                $this->_packagefile->setFileAttribute($this->dir . $this['attribs']['name'], $var, $value);
                return;
            }

            throw new \PEAR2\Pyrus\PackageFile\Exception('Cannot set ' . $var . ' to non-' .
                '\PEAR2\Pyrus\Task\Common object in file ' . $this->dir .
                $this['attribs']['name']);
        }

        $this->_packagefile->setFileAttribute($this->dir . $this['attribs']['name'], $var, $value);
        parent::__construct($this->_packagefile->files[$this->dir . $this['attribs']['name']]);
    }