Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param Context $context Use context
  * @param int     $start   Characters to be cut from the start (could be negative - numbered from end)
  * @param int     $length  String piece length
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(Context $context, $start, $length)
 {
     parent::__construct($context);
     if ($length < 0) {
         throw new \InvalidArgumentException('Cut length cannot be a negative number');
     }
     $this->start = (int) $start;
     $this->length = (int) $length;
 }
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @param Context $context Use context
  * @param array   $allowed Allowed tag names
  */
 public function __construct(Context $context, array $allowed = array())
 {
     parent::__construct($context);
     $this->allowedTags = $this->mergeTags($allowed);
 }