Exemple #1
0
 /**
  * Summarizes a text
  *
  * @param int number of words
  * @return Eden\Type\Type\StringType
  */
 public function summarize($words)
 {
     //argument 1 must be an integer
     Argument::i()->test(1, 'int');
     $this->data = explode(' ', strip_tags($this->data), $words);
     array_pop($this->data);
     $this->data = implode(' ', $this->data);
     return $this;
 }
Exemple #2
0
 /**
  * sets data using the Serializable interface
  *
  * @param string
  * @return Eden\Type\Type\ArrayType
  */
 public function unserialize($data)
 {
     //argument 1 must be a string
     Argument::i()->test(1, 'string');
     $this->data = json_decode($data, true);
     return $this;
 }