Esempio n. 1
0
 /**
  * Initialize Heading accessor.
  *
  * @param   integer     $level      heading level (1 for H1, 2 for H2 etc.)
  * @param   string      $id         element identifier (if null - "0" will be used)
  * @param   array       $relations  relations array array('near' => accessor, 'under' => accessor)
  * @param   Connection  $con        Sahi connection
  */
 public function __construct($level, $id, array $relations, Connection $con)
 {
     parent::__construct($id, $relations, $con);
     if (null !== $level) {
         $this->level = $level;
     }
 }
Esempio n. 2
0
 /**
  * Initialize Accessor.
  *
  * @param   string|array    $id         simple element identifier or array of (Table, rowText, colText)
  * @param   array           $relations  relations array array('near' => accessor, 'under' => accessor)
  * @param   Connection      $con        Sahi connection
  */
 public function __construct($id, array $relations, Connection $con)
 {
     if (is_array($id)) {
         if (!$id[0] instanceof TableAccessor || !isset($id[0]) || !isset($id[1])) {
             throw new \InvalidArgumentException('Cell table identificator must have type: array(TableAccessor, "rowText", "colText")');
         }
         if (count($relations)) {
             throw new \InvalidArgumentException('Can not use relations in cell accessor, that depends on table accessor');
         }
         $this->table = $id[0];
         $this->rowText = $id[1];
         $this->colText = $id[2];
         parent::__construct(null, $relations, $con);
     } else {
         parent::__construct($id, $relations, $con);
     }
 }