コード例 #1
0
ファイル: Cut.php プロジェクト: appcia/webwork
 /**
  * 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;
 }
コード例 #2
0
ファイル: StripTags.php プロジェクト: appcia/webwork
 /**
  * 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);
 }