Example #1
0
 /**
  * Called to construct the object
  *
  * @param  string  $text  the text to chunk (optional; if omitted, defaults to 
  *     null)
  * @param  string  $encoding  the text's character encoding (optional; if
  *      omitted, defaults to mb_internal_encoding())
  * @return  self
  * @throws  InvalidArgumentException  if $text is neither null nor a string
  * @throws  InvalidArgumentException  if $encoding is neither null nor a valid
  *     character encoding
  * @since   0.1.0
  */
 public function __construct($text = null, $encoding = null)
 {
     if ($text !== null) {
         $this->setText($text);
     }
     parent::__construct($encoding);
     return;
 }
Example #2
0
 /**
  * Called when the chunker is constructed
  *
  * @param  string  $name  the file's name (optional; if omitted, defaults to 
  *     null)
  * @param  string  $encoding  the text's character encoding (optional; if 
  *     omitted, defaults to mb_internal_encoding())
  * @return  self
  * @throws  InvalidArgumentException  if $name is neither null nor a readable 
  *     file name
  * @throws  InvalidArgumentException  if $encoding is neither null nor a valid
  *     character encoding
  * @since  0.1.0
  */
 public function __construct($name = null, $encoding = null)
 {
     if ($name !== null) {
         $this->setName($name);
     }
     parent::__construct($encoding);
     return;
 }