Exemplo n.º 1
0
 /**
  * Adds a child to the class at the given index
  * 
  * @param AbstractPattern $child Child to add
  * 
  * @param int             $index Index
  * 
  * @return AlternationGroup
  * 
  * @throws \REBuilder\Exception\Generic
  */
 public function addChildAt(AbstractPattern $child, $index = null)
 {
     if (!$child instanceof Alternation) {
         throw new \REBuilder\Exception\Generic("Alternation groups can contain only alternations");
     }
     return parent::addChildAt($child, $index);
 }
Exemplo n.º 2
0
 public function add(AbstractComponent $component)
 {
     if ($component instanceof FieldSet && !$component->isNamespaced()) {
         $this->components = array_merge($this->components, $component->getComponents());
     }
     parent::add($component);
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Save me
  *
  * @return int Number of affected rows
  */
 public function save()
 {
     $rows = parent::save();
     if ($rows && null !== $this->initialWidth && ($id = $this->getId())) {
         $rule = $this->getServiceLocator()->get('Grid\\Customize\\Model\\Rule\\Model')->findBySelector(sprintf(static::WIDTH_SELECTOR, $id), '', $this->getRootId());
         $rule->setProperty('width', (int) $this->initialWidth . '%', $rule::PRIORITY_IMPORTANT);
         $rule->rootParagraphId = $this->getRootId() ?: $id;
         $rows += $rule->save();
     }
     return $rows;
 }
Exemplo n.º 4
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
 }
 /**
  * Destructor.
  */
 public function __destruct()
 {
     parent::__destruct();
 }
Exemplo n.º 6
0
 /**
  * @return \Paragraph\Model\Paragraph\Structure\Column
  */
 public function prepareCreate()
 {
     $mapper = $this->getMapper();
     $this->bindChild($mapper->create(array('type' => 'html')));
     return parent::prepareCreate();
 }
Exemplo n.º 7
0
 /**
  * Destructor.
  */
 public function __destruct()
 {
     $this->vertex = NULL;
     parent::__destruct();
 }
Exemplo n.º 8
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $this->parameters = array();
     parent::__construct(new ParameterBag($this->parameters));
 }
Exemplo n.º 9
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct(new ParameterBag($this->getDefaultParameters()));
 }
Exemplo n.º 10
0
 /**
  * This paragraph-type properties
  *
  * @return  array
  */
 public static function getAllowedFunctions()
 {
     return array_diff(parent::getAllowedFunctions(), array(static::PROPERTY_DRAG));
 }
Exemplo n.º 11
0
        return $this->getClass()->getName() . '{' . $s[0] . '}';
    }
    //}>b
    //{
    /**
     * Returns a hash code for this container.
     *
     * @return integer A hash code.
     */
    public function getHashCode()
    {
        $s = $this->reduce(create_function('$s, $obj', 'return $s + $obj->getHashCode();'), 0);
        return $s;
    }
    //}>c
    /**
     * Main program.
     *
     * @param array $args Command-line arguments.
     * @return integer Zero on success; non-zero on failure.
     */
    public static function main($args)
    {
        printf("AbstractContainer main program.\n");
        $status = 0;
        return $status;
    }
}
if (realpath($argv[0]) == realpath(__FILE__)) {
    exit(AbstractContainer::main(array_slice($argv, 1)));
}
Exemplo n.º 12
0
 /**
  * Allows to call setIf, getIf, setThen, getThen, setElse and getElse
  * functions
  * 
  * @param string $name      Method name
  * @param array  $arguments Method arguments
  * 
  * @return mixed
  * 
  * @throws \REBuilder\Exception\Generic
  */
 function __call($name, $arguments)
 {
     if (preg_match("/^(get|set)(If|Then|Else)\$/", $name, $match)) {
         $type = strtolower($match[2]);
         $currentChild = $this->_getConditionalChild($type);
         if ($match[1] === "get") {
             return $currentChild;
         } else {
             $testClass = $this->_childrenOrder[$type];
             if (!count($arguments) || !$arguments[0] instanceof $testClass) {
                 throw new \REBuilder\Exception\Generic("{$name} requires a " . $this->_getClassName($testClass));
             }
             if ($currentChild) {
                 $this->_safeAdd = true;
                 $this->removeChild($currentChild);
             }
             return $this->addChildAt($arguments[0]);
         }
     }
     return parent::__call($name, $arguments);
 }
Exemplo n.º 13
0
 /**
  * Adds a child to the class at the given index
  * 
  * @param AbstractPattern $child Child to add
  * @param int             $index Index
  * 
  * @return CharClass
  * 
  * @throws \REBuilder\Exception\Generic
  */
 public function addChildAt(AbstractPattern $child, $index = null)
 {
     if (!$child->canBeAddedToCharClass()) {
         throw new \REBuilder\Exception\Generic($this->_getClassName($child) . " cannot be added to character classes");
     }
     return parent::addChildAt($child, $index);
 }
Exemplo n.º 14
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct(new ParameterBag(self::$parameters));
 }
Exemplo n.º 15
0
 /**
  * Convert to array
  *
  * @return array
  */
 public function toArray()
 {
     $data = parent::toArray();
     $data['columnWidths'] = $this->getColumnWidths();
     return $data;
 }
Exemplo n.º 16
0
 /**
  * Allows to call setStart, getStart, setEnd and getEnd functions
  * 
  * @param string $name      Method name
  * @param array  $arguments Method arguments
  * 
  * @return mixed
  * 
  * @throws \REBuilder\Exception\Generic
  */
 function __call($name, $arguments)
 {
     if (preg_match("/^(get|set)(Start|End)\$/", $name, $match)) {
         $index = $match[2] === "Start" ? 0 : 1;
         if ($match[1] === "get") {
             return isset($this->_children[$index]) ? $this->_children[$index] : null;
         } else {
             if (!count($arguments) || !$arguments[0] instanceof AbstractPattern) {
                 throw new \REBuilder\Exception\Generic("{$name} requires a pattern");
             } elseif (!$arguments[0]->canBeAddedToCharClassRange()) {
                 throw new \REBuilder\Exception\Generic($this->_getClassName($arguments[0]) . " cannot be added to character class ranges");
             }
             return $this->removeChildAt($index)->addChildAt($arguments[0], $index);
         }
     }
     return parent::__call($name, $arguments);
 }