Example #1
0
 /**
  * @param string $cmd
  * @param bool   $exception
  * @return MonoShell
  */
 public static function run($cmd, $exception = true)
 {
     $shell = new self();
     $shell->perform($cmd, $exception);
     return $shell;
 }
 /**
 Static validation method of an HTML fragment. Returns an array with the
 following parameters:
 
 - valid (boolean)
 _ errors (string)
 
 @param	fragment	<b>string</b>		HTML content
 @param	charset	<b>string</b>			Document charset
 @return	<b>array</b>
 */
 public static function validate($fragment, $charset = 'UTF-8')
 {
     $o = new self();
     $fragment = $o->getDocument($fragment, $charset);
     if ($o->perform($fragment, $charset)) {
         return array('valid' => true, 'errors' => null);
     } else {
         return array('valid' => false, 'errors' => $o->getErrors());
     }
 }