{@inheritdoc}

@throws \InvalidArgumentException
@throws \marvin255\bxcodegen\Exception
359027
public function renderTemplate($pathToTemplateFile, array $options = [])
    {
        if (!file_exists($pathToTemplateFile)) {
            throw new InvalidArgumentException(
                "Can't find template file: {$pathToTemplateFile}"
            );
        }

        $renderName = 'from_file';
        $this->twigLoader->setTemplate($renderName, file_get_contents($pathToTemplateFile));

        try {
            $return = $this->twig->load($renderName)->render($options);
        } catch (\Exception $e) {
            throw new Exception($e->getMessage(), $e->getCode(), $e);
        }

        return $return;
    }
165636
public function actionGenerate()
    {
        $access = mb_strtolower(StringHelper::randomString(32));

        $this->line($access, Console::FG_GREEN);

        return ExitCode::OK;
    }
419011
private function execute()
    {
        $query = $this->qb->getQuery();

        if (true === $this->configs['translation_query_hints']) {
            if (true === $this->doctrineExtensions) {
                $query->setHint(
                    \Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER,
                    'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'
                );

                $query->setHint(
                    \Gedmo\Translatable\TranslatableListener::HINT_TRANSLATABLE_LOCALE,
                    $this->locale
                );

                $query->setHint(
                    \Gedmo\Translatable\TranslatableListener::HINT_FALLBACK,
                    1
                );
            } else {
                throw new \Exception('execute(): "DoctrineExtensions" does not exist.');
            }
        }

        $query->setHydrationMode(Query::HYDRATE_OBJECT);

        return $query;
    }
1105133
public function orx($value)
    {
        if(!is_array($value)) {
            // get arguments 
            $value = func_get_args();
        }
        // Convert all values to 
        $conds = array_map(function($v) {
                if(is_string($v) && $this->getQueryParser()) {
                    return $this->getQueryParser()->parseExpression($v);
                } else if(!$v instanceof Expr\ConditionalExpression) {
                    throw new \InvalidArgumentException('');
                } 
                return $v;
            }, $value);

        //return new Expr\OrX($conds);
        return new Expr\LogicalExpression($conds, Expr\LogicalExpression::TYPE_OR);
    }
1072984
public function getTransformations() {
        if ($this->transformations === null) {
            $this->transformations = [];

            $transformations = $this->query->get('t', []);

            if (!is_array($transformations)) {
                throw new InvalidArgumentException('Transformations must be specifed as an array', 400);
            }

            foreach ($transformations as $transformation) {
                if (!is_string($transformation)) {
                    throw new InvalidArgumentException('Invalid transformation', 400);
                }

                // See if the transformation has any parameters
                $pos = strpos($transformation, ':');
                $urlParams = '';

                if ($pos === false) {
                    // No params exist
                    $name = $transformation;
                } else {
                    list($name, $urlParams) = explode(':', $transformation, 2);
                }

                // Initialize params for the transformation
                $params = [];

                // Loop through the parameter string and assign params to an array
                $offset = 0;
                $pattern = '#(\w+)=(?:(.+?),\w+=|(.+?$))#';
                while (preg_match($pattern, $urlParams, $matches, PREG_OFFSET_CAPTURE, $offset)) {
                    $offset = $matches[2][1];
                    $paramName = $matches[1][0];
                    $paramValue = isset($matches[3]) ? $matches[3][0] : $matches[2][0];
                    $params[$paramName] = $paramValue;
                }

                $this->transformations[] = [
                    'name'   => $name,
                    'params' => $params,
                ];
            }
        }

        return $this->transformations;
    }
105447
protected function generateClass()
    {
        if ($this->class != null) {
            throw new Exception("The class has already been generated");
        }

        $classBaseType = $this->getBaseTypeClass();

        $this->class = new PhpClass(
            $this->phpIdentifier,
            false,
            $classBaseType,
            null,
            false,
            $this->abstract
        );

        $constructorComment = new PhpDocComment();
        $constructorSource = '';
        $constructorParameters = array();
        $accessors = array();

        // Add base type members to constructor parameter list first and call base class constructor
        $parentMembers = $this->getBaseTypeMembers($this);
        if (!empty($parentMembers)) {
            foreach ($parentMembers as $member) {
                $type = Validator::validateType($member->getType());
                $name = Validator::validateAttribute($member->getName());

                if (!$member->getNullable()) {
                    $constructorComment->addParam(PhpDocElementFactory::getParam($type, $name, ''));
                    $constructorParameters[$name] = Validator::validateTypeHint($type);
                }
            }
            $constructorSource .= '  parent::__construct(' . $this->buildParametersString($constructorParameters, false) . ');' . PHP_EOL;
        }

        // Add member variables
        foreach ($this->members as $member) {
            $type = Validator::validateType($member->getType());
            $name = Validator::validateAttribute($member->getName());
            $typeHint = Validator::validateTypeHint($type);

            $comment = new PhpDocComment();
            $comment->setVar(PhpDocElementFactory::getVar($type, $name, ''));
            $var = new PhpVariable('protected', $name, 'null', $comment);
            $this->class->addVariable($var);

            if (!$member->getNullable()) {
                if ($type == '\DateTime') {
                    if ($this->config->get('constructorParamsDefaultToNull')) {
                        $constructorSource .= '  $this->' . $name . ' = $' . $name . ' ? $' . $name . '->format(\DateTime::ATOM) : null;' . PHP_EOL;
                    } else {
                        $constructorSource .= '  $this->' . $name . ' = $' . $name . '->format(\DateTime::ATOM);' . PHP_EOL;
                    }
                } else {
                    $constructorSource .= '  $this->' . $name . ' = $' . $name . ';' . PHP_EOL;
                }
                $constructorComment->addParam(PhpDocElementFactory::getParam($type, $name, ''));
                $constructorParameters[$name] = $typeHint;
            }

            $getterComment = new PhpDocComment();
            $getterComment->setReturn(PhpDocElementFactory::getReturn($type, ''));
            if ($type == '\DateTime') {
                $getterCode = '  if ($this->' . $name . ' == null) {' . PHP_EOL
                    . '    return null;' . PHP_EOL
                    . '  } else {' . PHP_EOL
                    . '    try {' . PHP_EOL
                    . '      return new \DateTime($this->' . $name . ');' . PHP_EOL
                    . '    } catch (\Exception $e) {' . PHP_EOL
                    . '      return false;' . PHP_EOL
                    . '    }' . PHP_EOL
                    . '  }' . PHP_EOL;
            } else {
                $getterCode = '  return $this->' . $name . ';' . PHP_EOL;
            }
            $getter = new PhpFunction('public', 'get' . ucfirst($name), '', $getterCode, $getterComment);
            $accessors[] = $getter;

            $setterComment = new PhpDocComment();
            $setterComment->addParam(PhpDocElementFactory::getParam($type, $name, ''));
            $setterComment->setReturn(PhpDocElementFactory::getReturn($this->phpNamespacedIdentifier, ''));
            if ($type == '\DateTime') {
                if ($member->getNullable()) {
                    $setterCode = '  if ($' . $name . ' == null) {' . PHP_EOL
                        . '   $this->' . $name . ' = null;' . PHP_EOL
                        . '  } else {' . PHP_EOL
                        . '    $this->' . $name . ' = $' . $name . '->format(\DateTime::ATOM);' . PHP_EOL
                        . '  }' . PHP_EOL;
                } else {
                    $setterCode = '  $this->' . $name . ' = $' . $name . '->format(\DateTime::ATOM);' . PHP_EOL;
                }
            } else {
                $setterCode = '  $this->' . $name . ' = $' . $name . ';' . PHP_EOL;
            }
            $setterCode .= '  return $this;' . PHP_EOL;
            $setter = new PhpFunction(
                'public',
                'set' . ucfirst($name),
                $this->buildParametersString(
                    array($name => $typeHint),
                    true,
                    // If the type of a member is nullable we should allow passing null to the setter. If the type
                    // of the member is a class and not a primitive this is only possible if setter parameter has
                    // a default null value. We can detect whether the type is a class by checking the type hint.
                    $member->getNullable() && !empty($typeHint)
                ),
                $setterCode,
                $setterComment
            );
            $accessors[] = $setter;
        }

        $constructor = new PhpFunction(
            'public',
            '__construct',
            $this->buildParametersString(
                $constructorParameters,
                true,
                $this->config->get('constructorParamsDefaultToNull')
            ),
            $constructorSource,
            $constructorComment
        );
        $this->class->addFunction($constructor);

        foreach ($accessors as $accessor) {
            $this->class->addFunction($accessor);
        }
    }
567230
public function type(string $classType)
    {
        $baseType = $this->class ? $this->class->getClassName() : TypedObject::class;
        if (!is_a($classType, $baseType, true)) {
            throw InvalidArgumentException::format(
                'Invalid call to %s: class type must be an subclass of %s, %s given',
                __METHOD__, $baseType, $classType
            );
        }

        /** @var TypedObject $classType */
        $this->class = $classType::definition();
    }
558599
public function afterShortcodeDispatcher(MbRequest $mbRequest, MbResponse $mbResponse, MbShortCode $mbShortCode)
    {
        $className = static::class;
        $methodName = __METHOD__;
        throw new MbException("{$methodName} not allowed in! {$className}.");
    }
1042450
public final void mEXPONENT() throws RecognitionException {
		try {
			// hql.g:871:2: ( ( 'e' ) ( '+' | '-' )? ( '0' .. '9' )+ )
			// hql.g:871:4: ( 'e' ) ( '+' | '-' )? ( '0' .. '9' )+
			{
			// hql.g:871:4: ( 'e' )
			// hql.g:871:5: 'e'
			{
			match('e'); if (state.failed) return;
			}

			// hql.g:871:10: ( '+' | '-' )?
			int alt21=2;
			int LA21_0 = input.LA(1);
			if ( (LA21_0=='+'||LA21_0=='-') ) {
				alt21=1;
			}
			switch (alt21) {
				case 1 :
					// hql.g:
					{
					if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
						input.consume();
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

			}

			// hql.g:871:21: ( '0' .. '9' )+
			int cnt22=0;
			loop22:
			while (true) {
				int alt22=2;
				int LA22_0 = input.LA(1);
				if ( ((LA22_0 >= '0' && LA22_0 <= '9')) ) {
					alt22=1;
				}

				switch (alt22) {
				case 1 :
					// hql.g:
					{
					if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
						input.consume();
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

				default :
					if ( cnt22 >= 1 ) break loop22;
					if (state.backtracking>0) {state.failed=true; return;}
					EarlyExitException eee = new EarlyExitException(22, input);
					throw eee;
				}
				cnt22++;
			}

			}

		}
		finally {
			// do for sure before leaving
		}
	}
1109264
public function addMethod(MethodGenerator $method)
    {
        $name = $method->getName();
        if (isset($this->methods[$name]) === true) {
            throw new InvalidArgumentException('Method name "' . $name . '" already added.');
        }

        $this->methods[$name] = $method;
    }
349955
public final void mEXTEND() throws RecognitionException {
        try {
            int _type = EXTEND;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // com/dyuproject/protostuff/parser/ProtoLexer.g:139:5: ( 'extend' )
            // com/dyuproject/protostuff/parser/ProtoLexer.g:139:9: 'extend'
            {
            match("extend"); 


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
232834
protected function initializeClassBuilder()
    {
        // build the mock class
        $builder = new ClassBuilder();
        if (class_exists($this->className)) {
            $builder->setExtends($this->className);
        } elseif (interface_exists($this->className)) {
            $builder->addInterface($this->className);
        } else {
            throw new \InvalidArgumentException("Class or interface " . $this->className . " does not exist");
        }

        // every mocked method goes through this invocation, which delegates
        // the retrieval of the correct Spec to this Instance's Ordering constraint.
        $resolveCall = function (Invocation $inv) {
            $spec = $this->ordering->nextSpec($inv->getMethodName());
            return $spec->doInvocation($inv);
        };

        return $this->addMethodsToBuilder($builder, $resolveCall);
    }
896774
public function setDebugMode($value): self
    {
        if (is_string($value) || is_array($value)) {
            $value = static::detectDebugMode($value);
        } elseif (!is_bool($value)) {
            throw new InvalidArgumentException(sprintf('Value must be either a string, array, or boolean, %s given.', gettype($value)));
        }
        $this->parameters['debugMode'] = $value;
        return $this;
    }
1307693
public function code(): string
    {
        $version = config('doorman.uuid.version', 4);

        $method = 'createVersion' . $version . 'Uuid';

        if (method_exists($this, $method)) {
            return $this->$method();
        }

        throw new InvalidArgumentException("Version [$version] not supported.");
    }
306872
protected function execute(InputInterface $input, OutputInterface $output)
    {
        //  validate the content types unless validation is ignored

        if ($input->getArgument('id') && !$input->getOption('ignore')) {
            $code = $this->executeValidation($input, $output);

            if ($code) {
                return $code;
            }
        }

        if ($input->getOption('delete')) {
            return $this->executeDelete($input, $output);
        }

        if (!$input->getArgument('id') && !$input->getOption('full')) {
            throw new InvalidArgumentException(
                'You need to give one or more content types or choose the --full or --delete option'
            );
        }

        return $this->executeIndex($input, $output);
    }
183679
public function transform()
	{
		if( !( $this->xml && $this->xsl ) )
			throw new InvalidArgumentException( 'XML and XSL must be set.' );
		$xml	= DOMDocument::loadXML( $this->xml );
		$xsl	= DOMDocument::loadXML( $this->xsl );
		$proc	= new XSLTProcessor();
		$proc->importStyleSheet( $xsl );
		$result =  $proc->transformToXML( $xml );
		return $result;
	}
732471
public function main()
    {
        if ($this->codecoverage && !extension_loaded('xdebug')) {
            throw new Exception("PHPUnitTask depends on Xdebug being installed to gather code coverage information.");
        }

        $this->loadPHPUnit();

        if (class_exists('\PHPUnit_Framework_TestSuite')) {
            $suite = new PHPUnit_Framework_TestSuite('AllTests');
        } else {
            $suite = new \PHPUnit\Framework\TestSuite('AllTests');
        }

        $autoloadSave = spl_autoload_functions();

        if ($this->bootstrap) {
            include $this->bootstrap;
        }

        if ($this->configuration) {
            $arguments = $this->handlePHPUnitConfiguration($this->configuration);

            if ($arguments['backupGlobals'] === false) {
                $suite->setBackupGlobals(false);
            }

            if ($arguments['backupStaticAttributes'] === true) {
                $suite->setBackupStaticAttributes(true);
            }
        }

        if ($this->printsummary) {
            $fe = new FormatterElement();
            $fe->setParent($this);
            $fe->setType("summary");
            $fe->setUseFile(false);
            $this->formatters[] = $fe;
        }

        foreach ($this->batchtests as $batchTest) {
            $this->appendBatchTestToTestSuite($batchTest, $suite);
        }

        $this->execute($suite);

        if ($this->testfailed) {
            throw new BuildException($this->testfailuremessage);
        }

        $autoloadNew = spl_autoload_functions();
        if (is_array($autoloadNew)) {
            foreach ($autoloadNew as $autoload) {
                spl_autoload_unregister($autoload);
            }
        }

        if (is_array($autoloadSave)) {
            foreach ($autoloadSave as $autoload) {
                spl_autoload_register($autoload);
            }
        }
    }