/**
* Callback for random string validation.
*
* @see \Drupal\Component\Utility\Random::string()
*
* @param string $string
* The random string to validate.
*
* @return bool
* TRUE if the random string is valid, FALSE if not.
*/
->raw(".'\" cannot be used as a trait.', ") ->repr($node->getTemplateLine()) ->raw(", \$this->source);\n") ->outdent() ->write("}\n") ->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i)) ;
foreach($trait->getNode('targets')as$key => $value){ $compiler ->write(sprintf('if (!isset($_trait_%s_blocks[', $i)) ->string($key) ->raw("])) {\n") ->indent() ->write("throw new RuntimeError('Block ") ->string($key) ->raw(' is not defined in trait ') ->subcompile($trait->getNode('template')) ->raw(".', ") ->repr($node->getTemplateLine()) ->raw(", \$this->source);\n") ->outdent() ->write("}\n\n")