public function read($string)
	{
		if ( ! is_string($string)) {
			throw new \InvalidArgumentException(
				__METHOD__."() expects parameter one, string, to be a string"
			);	
		}
		
		// fake the snippet as a "root" group
		$string = '{'.$string.'}';
		
		// instantiate the string's chunker and stream
		$chunker = new \Jstewmc\Chunker\Text($string);
		$stream  = new \Jstewmc\Stream\Stream($chunker);	
		
		// lex the stream
		$tokens  = (new Lexer())->lex($stream);
		
		// parse and render the tokens
		$group = (new Renderer())->render((new Parser())->parse($tokens));
		
		// set the snippet's properties from the group
		$this->parent     = null;
		$this->children   = $group->getChildren();
		$this->style      = $group->getStyle();
		$this->isRendered = true;
		
		return (bool) $group;
	}
public function read($string)
	{
		if ( ! is_string($string)) {
			throw new \InvalidArgumentException(
				__METHOD__."() expects parameter one, string, to be a string"
			);	
		}
		
		// fake the snippet as a "root" group
		$string = '{'.$string.'}';
		
		// instantiate the string's chunker and stream
		$chunker = new \Jstewmc\Chunker\Text($string);
		$stream  = new \Jstewmc\Stream\Stream($chunker);	
		
		// lex the stream
		$tokens  = (new Lexer())->lex($stream);
		
		// parse and render the tokens
		$group = (new Renderer())->render((new Parser())->parse($tokens));
		
		// set the snippet's properties from the group
		$this->parent     = null;
		$this->children   = $group->getChildren();
		$this->style      = $group->getStyle();
		$this->isRendered = true;
		
		return (bool) $group;
	}
public function read ( $ string ) { if ( ! is_string ( $ string ) ) { throw new \ InvalidArgumentException ( __METHOD__ . "() expects parameter one, string, to be a string" ) ; } // fake the snippet as a "root" group $ string = '{' . $ string . '}' ; // instantiate the string's chunker and stream $ chunker = new \ Jstewmc \ Chunker \ Text ( $ string ) ; $ stream = new \ Jstewmc \ Stream \ Stream ( $ chunker ) ; // lex the stream $ tokens = ( new Lexer ( ) ) -> lex ( $ stream ) ; // parse and render the tokens $ group = ( new Renderer ( ) ) -> render ( ( new Parser ( ) ) -> parse ( $ tokens ) ) ; // set the snippet's properties from the group $ this -> parent = null ; $ this -> children = $ group -> getChildren ( ) ; $ this -> style = $ group -> getStyle ( ) ; $ this -> isRendered = true ; return ( bool ) $ group ; }
Reads the snippet

@param  string  $string  the snippet's source code
@return  bool
@throws  InvalidArgumentException  if $string is not a string
@since  0.4.0
Reads the snippet