idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
8,800 | public function addConstant ( ClassConstant $ constant ) { if ( isset ( $ this -> constants [ $ constant -> getName ( ) ] ) ) { throw new CompilerException ( "Constant '" . $ constant -> getName ( ) . "' was defined more than one time" ) ; } $ this -> constants [ $ constant -> getName ( ) ] = $ constant ; } | Adds a constant to the definition . |
8,801 | public function hasProperty ( $ name ) { if ( isset ( $ this -> properties [ $ name ] ) ) { return true ; } else { $ extendsClassDefinition = $ this -> getExtendsClassDefinition ( ) ; if ( $ extendsClassDefinition ) { if ( $ extendsClassDefinition -> hasProperty ( $ name ) ) { return true ; } } return false ; } } | Checks if a class definition has a property . |
8,802 | public function getProperty ( $ propertyName ) { if ( isset ( $ this -> properties [ $ propertyName ] ) ) { return $ this -> properties [ $ propertyName ] ; } $ extendsClassDefinition = $ this -> getExtendsClassDefinition ( ) ; if ( $ extendsClassDefinition ) { if ( $ extendsClassDefinition -> hasProperty ( $ propertyN... | Returns a method definition by its name . |
8,803 | public function hasConstant ( $ name ) { if ( isset ( $ this -> constants [ $ name ] ) ) { return true ; } $ extendsClassDefinition = $ this -> getExtendsClassDefinition ( ) ; if ( $ extendsClassDefinition ) { if ( $ extendsClassDefinition -> hasConstant ( $ name ) ) { return true ; } } return $ this -> hasConstantFrom... | Checks if class definition has a property . |
8,804 | public function getConstant ( $ constantName ) { if ( ! \ is_string ( $ constantName ) ) { throw new InvalidArgumentException ( '$constantName must be string type' ) ; } if ( empty ( $ constantName ) ) { throw new InvalidArgumentException ( '$constantName must not be empty: ' . $ constantName ) ; } if ( isset ( $ this ... | Returns a constant definition by its name . |
8,805 | public function addMethod ( ClassMethod $ method , $ statement = null ) { $ methodName = strtolower ( $ method -> getName ( ) ) ; if ( isset ( $ this -> methods [ $ methodName ] ) ) { throw new CompilerException ( "Method '" . $ method -> getName ( ) . "' was defined more than one time" , $ statement ) ; } $ this -> me... | Adds a method to the class definition . |
8,806 | public function hasMethod ( $ methodName ) { $ methodNameLower = strtolower ( $ methodName ) ; foreach ( $ this -> methods as $ name => $ method ) { if ( $ methodNameLower == $ name ) { return true ; } } $ extendsClassDefinition = $ this -> getExtendsClassDefinition ( ) ; if ( $ extendsClassDefinition instanceof ClassD... | Checks if the class implements an specific name . |
8,807 | public function getMethod ( $ methodName , $ checkExtends = true ) { $ methodNameLower = strtolower ( $ methodName ) ; foreach ( $ this -> methods as $ name => $ method ) { if ( $ methodNameLower == $ name ) { return $ method ; } } if ( ! $ checkExtends ) { return false ; } $ extendsClassDefinition = $ this -> getExten... | Returns a method by its name . |
8,808 | public function getPossibleMethodName ( $ methodName ) { $ methodNameLower = strtolower ( $ methodName ) ; foreach ( $ this -> methods as $ name => $ method ) { if ( metaphone ( $ methodNameLower ) == metaphone ( $ name ) ) { return $ method -> getName ( ) ; } } $ extendsClassDefinition = $ this -> extendsClassDefiniti... | Tries to find the most similar name . |
8,809 | public function getClassEntry ( CompilationContext $ compilationContext = null ) { if ( $ this -> external ) { if ( ! \ is_object ( $ compilationContext ) ) { throw new Exception ( 'A compilation context is required' ) ; } $ this -> compiler = $ compilationContext -> compiler ; $ compilationContext -> headersManager ->... | Returns the name of the zend_class_entry according to the class name . |
8,810 | public function getExternalHeader ( ) { $ parts = explode ( '\\' , $ this -> namespace ) ; return 'ext/' . strtolower ( $ parts [ 0 ] . \ DIRECTORY_SEPARATOR . str_replace ( '\\' , \ DIRECTORY_SEPARATOR , $ this -> namespace ) . \ DIRECTORY_SEPARATOR . $ this -> name ) . '.zep' ; } | Returns an absolute location to the class header . |
8,811 | public function checkInterfaceImplements ( self $ classDefinition , self $ interfaceDefinition ) { foreach ( $ interfaceDefinition -> getMethods ( ) as $ method ) { if ( ! $ classDefinition -> hasMethod ( $ method -> getName ( ) ) ) { throw new CompilerException ( sprintf ( 'Class %s must implement a method called: "%s... | Checks if a class implements an interface . |
8,812 | public function getLocalOrParentInitMethod ( ) { $ method = $ this -> getInitMethod ( ) ; if ( $ method ) { $ parentClassDefinition = $ this -> getExtendsClassDefinition ( ) ; if ( $ parentClassDefinition instanceof self ) { $ method = $ parentClassDefinition -> getInitMethod ( ) ; if ( $ method ) { $ this -> addInitMe... | Returns the initialization method if any does exist . |
8,813 | public function addInitMethod ( StatementsBlock $ statementsBlock ) { if ( ! $ statementsBlock -> isEmpty ( ) ) { $ initClassName = $ this -> getCNamespace ( ) . '_' . $ this -> getName ( ) ; $ classMethod = new ClassMethod ( $ this , [ 'internal' ] , 'zephir_init_properties_' . $ initClassName , null , $ statementsBlo... | Creates the initialization method . |
8,814 | public function addStaticInitMethod ( StatementsBlock $ statementsBlock ) { $ initClassName = $ this -> getCNamespace ( ) . '_' . $ this -> getName ( ) ; $ classMethod = new ClassMethod ( $ this , [ 'internal' ] , 'zephir_init_static_properties_' . $ initClassName , null , $ statementsBlock ) ; $ classMethod -> setIsIn... | Creates the static initialization method . |
8,815 | public static function buildFromReflection ( \ ReflectionClass $ class ) { $ classDefinition = new self ( $ class -> getNamespaceName ( ) , $ class -> getName ( ) , $ class -> getShortName ( ) ) ; $ methods = $ class -> getMethods ( ) ; if ( \ count ( $ methods ) > 0 ) { foreach ( $ methods as $ method ) { $ parameters... | Builds a class definition from reflection . |
8,816 | public function drawFile ( AbstractFile $ file ) { $ outputFile = ltrim ( $ file -> getOutputFile ( ) , '/' ) ; $ output = pathinfo ( $ this -> outputDir . '/' . $ outputFile ) ; $ outputDirname = $ output [ 'dirname' ] ; $ outputBasename = $ output [ 'basename' ] ; $ outputFilename = $ outputDirname . '/' . $ outputBa... | Parse and draw the specified file . |
8,817 | public function getThemeInfoExtendAware ( $ name ) { if ( $ this -> extendedTheme ) { $ data = $ this -> extendedTheme -> getThemeInfoExtendAware ( $ name ) ; } else { $ data = [ ] ; } $ info = $ this -> getThemeInfo ( $ name ) ; array_unshift ( $ data , $ info ) ; return $ data ; } | Similar with getThemeInfo but includes the value for all extended themes and returns the results as an array . |
8,818 | public function buildStaticDirectory ( ) { $ outputStt = $ this -> getOutputPath ( 'asset' ) ; if ( ! file_exists ( $ outputStt ) ) { mkdir ( $ outputStt , 0777 , true ) ; } if ( $ this -> extendedTheme ) { $ this -> extendedTheme -> buildStaticDirectory ( ) ; } $ themeStt = $ this -> getThemePath ( 'static' ) ; if ( $... | copy the static directory of the theme into the output directory . |
8,819 | public function getThemePathExtendsAware ( $ path ) { $ newPath = $ this -> getThemePath ( $ path ) ; if ( ! $ newPath ) { if ( $ this -> extendedTheme ) { return $ this -> extendedTheme -> getThemePathExtendsAware ( $ path ) ; } } return $ newPath ; } | find the path to a file in the theme or from the extended theme . |
8,820 | public function getThemePath ( $ path ) { $ path = pathinfo ( $ this -> themeDir . '/' . $ path ) ; $ pathDirname = $ path [ 'dirname' ] ; $ pathBasename = $ path [ 'basename' ] ; $ pathFilename = $ pathDirname . '/' . $ pathBasename ; if ( ! file_exists ( $ pathFilename ) ) { return null ; } return $ pathFilename ; } | find the path to a file in the theme . |
8,821 | private function throwStringException ( CodePrinter $ printer , $ class , $ message , $ expression ) { $ message = add_slashes ( $ message ) ; $ path = Compiler :: getShortUserPath ( $ expression [ 'file' ] ) ; $ printer -> output ( sprintf ( 'ZEPHIR_THROW_EXCEPTION_DEBUG_STR(%s, "%s", "%s", %s);' , $ class , $ message... | Throws an exception escaping the data . |
8,822 | public function join ( $ caller , CompilationContext $ compilationContext , Call $ call , array $ expression ) { $ functionCall = BuilderFactory :: getInstance ( ) -> statements ( ) -> functionCall ( 'join' , $ expression [ 'parameters' ] ) -> addArgument ( $ caller ) -> setFile ( $ expression [ 'file' ] ) -> setLine (... | Transforms calls to method join to function calls to join . |
8,823 | public function setupOptimized ( CompilationContext $ compilationContext ) { if ( ! $ compilationContext -> config -> get ( 'internal-call-transformation' , 'optimizations' ) ) { return $ this ; } $ classDefinition = $ this -> getClassDefinition ( ) ; if ( '__invoke' == $ this -> getName ( ) || $ classDefinition -> isI... | Generate internal method s based on the equivalent PHP methods allowing bypassing php userspace for internal method calls . |
8,824 | public function hasReturnTypes ( ) { if ( \ count ( $ this -> returnTypes ) ) { return true ; } if ( \ count ( $ this -> returnClassTypes ) ) { return true ; } return false ; } | Checks if the method has return - type or cast hints . |
8,825 | public function areReturnTypesNullCompatible ( $ type = null ) { if ( \ count ( $ this -> returnTypes ) ) { foreach ( $ this -> returnTypes as $ returnType => $ definition ) { switch ( $ returnType ) { case 'null' : return true ; } } } return false ; } | Checks whether at least one return type hint is null compatible . |
8,826 | public function hasModifier ( $ modifier ) { foreach ( $ this -> visibility as $ visibility ) { if ( $ visibility == $ modifier ) { return true ; } } return false ; } | Checks whether the method has a specific modifier . |
8,827 | public function getModifiers ( ) { $ modifiers = [ ] ; foreach ( $ this -> visibility as $ visibility ) { switch ( $ visibility ) { case 'public' : $ modifiers [ 'ZEND_ACC_PUBLIC' ] = $ visibility ; break ; case 'protected' : $ modifiers [ 'ZEND_ACC_PROTECTED' ] = $ visibility ; break ; case 'private' : $ modifiers [ '... | Returns the C - modifier flags . |
8,828 | public function removeMemoryStackReferences ( SymbolTable $ symbolTable , $ containerCode ) { if ( ! $ symbolTable -> getMustGrownStack ( ) ) { $ containerCode = str_replace ( 'ZEPHIR_THROW_EXCEPTION_STR' , 'ZEPHIR_THROW_EXCEPTION_STRW' , $ containerCode ) ; $ containerCode = str_replace ( 'ZEPHIR_THROW_EXCEPTION_DEBUG... | Replace macros . |
8,829 | public function hasChildReturnStatementType ( $ statement ) { if ( ! isset ( $ statement [ 'statements' ] ) || ! \ is_array ( $ statement [ 'statements' ] ) ) { return false ; } if ( 'if' == $ statement [ 'type' ] ) { $ ret = false ; $ statements = $ statement [ 'statements' ] ; foreach ( $ statements as $ item ) { $ t... | Simple method to check if one of the paths are returning the right expected type . |
8,830 | public function getArgInfoName ( ClassDefinition $ classDefinition = null ) { if ( null != $ classDefinition ) { return sprintf ( 'arginfo_%s_%s_%s' , strtolower ( $ classDefinition -> getCNamespace ( ) ) , strtolower ( $ classDefinition -> getName ( ) ) , strtolower ( $ this -> getName ( ) ) ) ; } return sprintf ( 'ar... | Returns arginfo name for current method . |
8,831 | public function isReturnTypesHintDetermined ( ) { if ( 0 == \ count ( $ this -> returnTypes ) || $ this -> isVoid ( ) ) { return false ; } foreach ( $ this -> returnTypes as $ returnType => $ definition ) { switch ( $ returnType ) { case 'variable' : case 'callable' : case 'resource' : return false ; } if ( isset ( $ d... | Is method have determined return type hint . |
8,832 | public function areReturnTypesCompatible ( ) { if ( \ count ( $ this -> returnTypes ) > 2 ) { return false ; } if ( 2 == \ count ( $ this -> returnTypes ) && ! isset ( $ this -> returnTypes [ 'null' ] ) ) { return false ; } return true ; } | Checks if the method have compatible return types . |
8,833 | public function isSatisfiedBy ( ReturnType \ TypeInterface $ type ) { return $ this -> left -> isSatisfiedBy ( $ type ) && $ this -> right -> isSatisfiedBy ( $ type ) ; } | Checks if the composite AND of specifications passes . |
8,834 | protected function callParent ( $ methodName , array $ expression , $ symbolVariable , $ mustInit , $ isExpecting , ClassDefinition $ classDefinition , CompilationContext $ compilationContext , ClassMethod $ method ) { $ codePrinter = $ compilationContext -> codePrinter ; $ classCe = $ classDefinition -> getClassEntry ... | Calls static methods on the parent context . |
8,835 | public function getBooleanCode ( ) { if ( $ this -> code && ( 'true' == $ this -> code || true === $ this -> code ) ) { return '1' ; } else { if ( 'false' == $ this -> code || false === $ this -> code ) { return '0' ; } } return $ this -> code ; } | Returns a C representation for a boolean constant . |
8,836 | public function resolve ( $ result , CompilationContext $ compilationContext ) { if ( $ this -> code instanceof \ Closure ) { $ code = $ this -> code ; if ( ! $ result ) { $ tempVariable = $ compilationContext -> symbolTable -> getTempVariableForWrite ( 'variable' , $ compilationContext ) ; $ compilationContext -> code... | Resolves an expression Some code cannot be directly pushed into the generated source because it s missing some bound parts this method resolves the missing parts returning the generated code . |
8,837 | private function recursiveProcess ( $ src , $ dst , $ pattern = null , $ callback = 'copy' ) { $ success = true ; $ iterator = new \ DirectoryIterator ( $ src ) ; foreach ( $ iterator as $ item ) { $ pathName = $ item -> getPathname ( ) ; if ( ! is_readable ( $ pathName ) ) { $ this -> logger -> error ( 'File is not re... | Copies the base kernel to the extension destination . |
8,838 | public function getNumberOfMethodCalls ( $ className , $ methodName ) { if ( isset ( $ this -> methodCalls [ $ className ] [ $ methodName ] ) ) { return $ this -> methodCalls [ $ className ] [ $ methodName ] ; } return 0 ; } | Returns the number of calls a function had . |
8,839 | public function getTemplateFileContents ( $ filename ) { $ templatePath = rtrim ( $ this -> config -> get ( 'templatepath' , 'backend' ) , '\\/' ) ; if ( empty ( $ templatepath ) ) { $ templatePath = $ this -> templatesPath ; } return file_get_contents ( "{$templatePath}/{$this->name}/{$filename}" ) ; } | Resolves the path to the source template file of the backend . |
8,840 | public function pass ( $ branchNumber , StatementsBlock $ block ) { $ this -> passStatementBlock ( $ branchNumber , $ block -> getStatements ( ) ) ; $ this -> branches [ $ branchNumber ] = 0 ; } | Do the compilation pass . |
8,841 | public function passLetStatement ( $ branchNumber , $ statement ) { foreach ( $ statement [ 'assignments' ] as $ assignment ) { if ( 'variable' == $ assignment [ 'assign-type' ] ) { if ( 'assign' == $ assignment [ 'operator' ] ) { switch ( $ assignment [ 'expr' ] [ 'type' ] ) { case 'variable' : case 'array-access' : c... | Check assignment types for possible skip . |
8,842 | public function getVariables ( ) { $ variableStats = [ ] ; foreach ( $ this -> variablesToSkip as $ branchNumber => $ variables ) { foreach ( $ variables as $ variable => $ one ) { if ( ! isset ( $ variableStats [ $ variable ] ) ) { $ variableStats [ $ variable ] = 1 ; } else { ++ $ variableStats [ $ variable ] ; } } }... | Returns a list of variables that are initialized in every analyzed branch . |
8,843 | public function setIdle ( $ idle ) { $ this -> idle = false ; if ( $ this -> reusable ) { $ this -> classTypes = [ ] ; $ this -> dynamicTypes = [ 'unknown' => true ] ; $ this -> idle = $ idle ; } } | Once a temporal variable is unused in a specific branch it is marked as idle . |
8,844 | public function setClassTypes ( $ classTypes ) { if ( $ classTypes ) { if ( \ is_string ( $ classTypes ) ) { if ( ! \ in_array ( $ classTypes , $ this -> classTypes ) ) { $ this -> classTypes [ ] = $ classTypes ; } } else { foreach ( $ classTypes as $ classType ) { if ( ! \ in_array ( $ classType , $ this -> classTypes... | Sets the PHP class related to variable . |
8,845 | public function setDynamicTypes ( $ types ) { if ( $ types ) { unset ( $ this -> dynamicTypes [ 'unknown' ] ) ; if ( \ is_string ( $ types ) ) { if ( ! isset ( $ this -> dynamicTypes [ $ types ] ) ) { $ this -> dynamicTypes [ $ types ] = true ; } } else { foreach ( $ types as $ type => $ one ) { if ( ! isset ( $ this -... | Sets the current dynamic type in a polymorphic variable . |
8,846 | public function hasAnyDynamicType ( $ types ) { if ( \ is_string ( $ types ) ) { return isset ( $ this -> dynamicTypes [ $ types ] ) ; } else { foreach ( $ types as $ type ) { if ( isset ( $ this -> dynamicTypes [ $ type ] ) ) { return true ; } } } return false ; } | Checks if the variable has any of the passed dynamic . |
8,847 | public function hasDifferentDynamicType ( $ types ) { $ number = 0 ; foreach ( $ types as $ type ) { if ( isset ( $ this -> dynamicTypes [ $ type ] ) ) { ++ $ number ; } } return 0 == $ number ; } | Check if the variable has at least one dynamic type to the ones passed in the list . |
8,848 | public function setIsInitialized ( $ initialized , CompilationContext $ compilationContext ) { $ this -> initialized = $ initialized ; if ( ! $ initialized || ! $ compilationContext -> branchManager instanceof BranchManager ) { return ; } $ currentBranch = $ compilationContext -> branchManager -> getCurrentBranch ( ) ;... | Sets if the variable is initialized This allow to throw an exception if the variable is being read without prior initialization . |
8,849 | public function enableDefaultAutoInitValue ( ) { switch ( $ this -> type ) { case 'char' : case 'boolean' : case 'bool' : case 'int' : case 'uint' : case 'long' : case 'ulong' : case 'double' : case 'zephir_ce_guard' : $ this -> defaultInitValue = 0 ; break ; case 'variable' : case 'string' : case 'array' : $ this -> d... | Sets an automatic safe default init value according to its type . |
8,850 | public function separate ( CompilationContext $ compilationContext ) { if ( 'this_ptr' != $ this -> getName ( ) && 'return_value' != $ this -> getName ( ) ) { $ compilationContext -> codePrinter -> output ( 'ZEPHIR_SEPARATE(' . $ compilationContext -> backend -> getVariableCode ( $ this ) . ');' ) ; } } | Separates variables before being updated . |
8,851 | public function initVariant ( CompilationContext $ compilationContext ) { if ( $ this -> numberSkips ) { -- $ this -> numberSkips ; return ; } if ( 'this_ptr' != $ this -> getName ( ) && 'return_value' != $ this -> getName ( ) ) { if ( false === $ this -> initBranch ) { $ this -> initBranch = $ compilationContext -> cu... | Initializes a variant variable . |
8,852 | public function trackVariant ( CompilationContext $ compilationContext ) { if ( $ this -> numberSkips ) { -- $ this -> numberSkips ; return ; } if ( 'this_ptr' != $ this -> getName ( ) && 'return_value' != $ this -> getName ( ) ) { if ( false === $ this -> initBranch ) { $ this -> initBranch = $ compilationContext -> c... | Tells the compiler a generated code will track the variable . |
8,853 | public function observeVariant ( CompilationContext $ compilationContext ) { if ( $ this -> numberSkips ) { -- $ this -> numberSkips ; return ; } $ name = $ this -> getName ( ) ; if ( 'this_ptr' != $ name && 'return_value' != $ name ) { if ( false === $ this -> initBranch ) { $ this -> initBranch = $ compilationContext... | Observes a variable in the memory frame without initialization . |
8,854 | public function observeOrNullifyVariant ( CompilationContext $ compilationContext ) { if ( $ this -> numberSkips ) { -- $ this -> numberSkips ; return ; } $ name = $ this -> getName ( ) ; if ( 'this_ptr' != $ name && 'return_value' != $ name ) { if ( false === $ this -> initBranch ) { $ this -> initBranch = $ compilati... | Observes a variable in the memory frame without initialization or nullify an existing allocated variable . |
8,855 | public function setPossibleValue ( CompiledExpression $ possibleValue , CompilationContext $ compilationContext ) { $ this -> possibleValue = $ possibleValue ; $ this -> possibleValueBranch = $ compilationContext -> branchManager -> getCurrentBranch ( ) ; } | Sets the latest CompiledExpression assigned to a variable . |
8,856 | public function addBranch ( Branch $ branch ) { if ( $ this -> currentBranch ) { $ branch -> setParentBranch ( $ this -> currentBranch ) ; $ this -> currentBranch = $ branch ; } else { $ this -> currentBranch = $ branch ; } $ branch -> setUniqueId ( $ this -> uniqueId ) ; $ branch -> setLevel ( $ this -> level ) ; ++ $... | Sets the current active branch in the manager . |
8,857 | public function removeBranch ( Branch $ branch ) { $ parentBranch = $ branch -> getParentBranch ( ) ; $ this -> currentBranch = $ parentBranch ; -- $ this -> level ; } | Removes a branch from the branch manager . |
8,858 | private function resolveBackendClass ( ) { $ parser = new ArgvInput ( ) ; $ backend = $ parser -> getParameterOption ( '--backend' , null ) ; if ( null === $ backend ) { if ( getenv ( 'ZEPHIR_BACKEND' ) ) { $ backend = $ backend = getenv ( 'ZEPHIR_BACKEND' ) ; } elseif ( $ this -> container -> has ( 'ZEPHIR_BACKEND' ) ... | Resolve backend class . |
8,859 | public function create ( $ className , $ filePath ) { $ compiler = new CompilerFile ( $ this -> config , new AliasManager ( ) , $ this -> filesystem ) ; $ compiler -> setClassName ( $ className ) ; $ compiler -> setFilePath ( $ filePath ) ; $ compiler -> setLogger ( $ this -> logger ) ; return $ compiler ; } | Creates CompilerFile instance . |
8,860 | public function findThemePathByName ( $ name ) { $ path = null ; foreach ( $ this -> themesDirectories as $ themeDir ) { $ path = rtrim ( $ themeDir , '\\/' ) . \ DIRECTORY_SEPARATOR . $ name ; if ( 0 !== strpos ( $ path , 'phar://' ) ) { $ path = realpath ( $ path ) ; } if ( is_dir ( $ path ) ) { break ; } } return $ ... | Search a theme by its name . |
8,861 | private function prepareThemeOptions ( $ themeConfig , $ options = null ) { $ parsedOptions = null ; if ( ! empty ( $ options ) ) { if ( '{' == $ options [ 0 ] ) { $ parsedOptions = json_decode ( trim ( $ options ) , true ) ; if ( ! $ parsedOptions || ! \ is_array ( $ parsedOptions ) ) { throw new Exception ( "Unable t... | Prepare the options by merging the one in the project config with the one in the command line arg theme - options . |
8,862 | private function findOutputDirectory ( $ outputDir ) { $ outputDir = str_replace ( '%version%' , $ this -> config -> get ( 'version' ) , $ outputDir ) ; if ( '/' !== $ outputDir [ 0 ] ) { $ outputDir = getcwd ( ) . '/' . $ outputDir ; } return $ outputDir ; } | Find the directory where the doc is going to be generated depending on the command line options and the config . |
8,863 | private function findThemeDirectory ( $ themeConfig , $ path = null ) { $ themeDirectoriesConfig = $ this -> config -> get ( 'theme-directories' , 'api' ) ; if ( $ themeDirectoriesConfig ) { if ( \ is_array ( $ themeDirectoriesConfig ) ) { $ themesDirectories = $ themeDirectoriesConfig ; } else { throw new InvalidArgum... | Find the theme directory depending on the command line options and the config . |
8,864 | public function optimizeNot ( $ expr , CompilationContext $ compilationContext ) { if ( 'not' == $ expr [ 'type' ] ) { $ conditions = $ this -> optimize ( $ expr [ 'left' ] , $ compilationContext ) ; if ( false !== $ conditions ) { if ( null !== $ this -> unreachable ) { $ this -> unreachable = ! $ this -> unreachable ... | Skips the not operator by recursively optimizing the expression at its right . |
8,865 | public function genIR ( Compiler $ compiler ) { $ normalizedPath = $ this -> filesystem -> normalizePath ( $ this -> filePath ) ; $ compilePath = "{$normalizedPath}.js" ; $ zepRealPath = realpath ( $ this -> filePath ) ; if ( $ this -> filesystem -> exists ( $ compilePath ) ) { $ modificationTime = $ this -> filesystem... | Compiles the file generating a JSON intermediate representation . |
8,866 | public function preCompileInterface ( $ namespace , $ topStatement , $ docblock ) { $ classDefinition = new ClassDefinition ( $ namespace , $ topStatement [ 'name' ] ) ; $ classDefinition -> setIsExternal ( $ this -> external ) ; if ( isset ( $ topStatement [ 'extends' ] ) ) { foreach ( $ topStatement [ 'extends' ] as ... | Creates a definition for an interface . |
8,867 | public function checkDependencies ( Compiler $ compiler ) { $ classDefinition = $ this -> classDefinition ; $ extendedClass = $ classDefinition -> getExtendsClass ( ) ; if ( $ extendedClass ) { if ( 'class' == $ classDefinition -> getType ( ) ) { if ( $ compiler -> isClass ( $ extendedClass ) ) { $ extendedDefinition =... | Check dependencies . |
8,868 | protected function createReturnsType ( array $ types , $ annotated = false ) { if ( ! $ types ) { return null ; } $ list = [ ] ; foreach ( $ types as $ type ) { $ list [ ] = [ 'type' => $ annotated ? 'return-type-annotation' : 'return-type-paramater' , 'data-type' => 'mixed' == $ type ? 'variable' : $ type , 'mandatory... | Create returns type list . |
8,869 | public function processExpectedReturn ( CompilationContext $ compilationContext ) { $ expr = $ this -> expression ; $ expression = $ expr -> getExpression ( ) ; $ mustInit = false ; $ symbolVariable = null ; $ isExpecting = $ expr -> isExpectingReturn ( ) ; if ( $ isExpecting ) { $ symbolVariable = $ expr -> getExpecti... | Processes the symbol variable that will be used to return the result of the symbol call . |
8,870 | public function processExpectedComplexLiteralReturn ( CompilationContext $ compilationContext ) { $ expr = $ this -> expression ; $ expression = $ expr -> getExpression ( ) ; $ mustInit = false ; $ isExpecting = $ expr -> isExpectingReturn ( ) ; if ( $ isExpecting ) { $ symbolVariable = $ expr -> getExpectingVariable (... | Processes the symbol variable that will be used to return the result of the symbol call . If a temporal variable is used as returned value only the body is freed between calls . |
8,871 | public function getSymbolVariable ( $ useTemp = false , CompilationContext $ compilationContext = null ) { $ symbolVariable = $ this -> symbolVariable ; if ( $ useTemp && ! \ is_object ( $ symbolVariable ) ) { return $ compilationContext -> symbolTable -> getTempVariableForWrite ( 'variable' , $ compilationContext ) ; ... | Returns the symbol variable that must be returned by the call . |
8,872 | public function getResolvedParamsAsExpr ( $ parameters , CompilationContext $ compilationContext , $ expression , $ readOnly = false ) { if ( ! $ this -> resolvedParams ) { $ hasParametersByName = false ; foreach ( $ parameters as $ parameter ) { if ( isset ( $ parameter [ 'name' ] ) ) { $ hasParametersByName = true ; ... | Resolves parameters . |
8,873 | public function addCallStatusFlag ( CompilationContext $ compilationContext ) { if ( ! $ compilationContext -> symbolTable -> hasVariable ( 'ZEPHIR_LAST_CALL_STATUS' ) ) { $ callStatus = new Variable ( 'int' , 'ZEPHIR_LAST_CALL_STATUS' , $ compilationContext -> branchManager -> getCurrentBranch ( ) ) ; $ callStatus -> ... | Add the last - call - status flag to the current symbol table . |
8,874 | public function addCallStatusOrJump ( CompilationContext $ compilationContext ) { $ compilationContext -> headersManager -> add ( 'kernel/fcall' ) ; if ( $ compilationContext -> insideTryCatch ) { $ compilationContext -> codePrinter -> output ( 'zephir_check_call_status_or_jump(try_end_' . $ compilationContext -> curre... | Checks the last call status or make a label jump to the next catch block . |
8,875 | public function checkTempParameters ( CompilationContext $ compilationContext ) { $ compilationContext -> headersManager -> add ( 'kernel/fcall' ) ; foreach ( $ this -> getMustCheckForCopyVariables ( ) as $ checkVariable ) { $ compilationContext -> codePrinter -> output ( 'zephir_check_temp_parameter(' . $ checkVariabl... | Checks if temporary parameters must be copied or not . |
8,876 | private function __tryRegisterAnnotation ( ) { if ( ( $ this -> annotationNameOpen || $ this -> annotationOpen ) && \ strlen ( $ this -> currentAnnotationStr ) > 0 ) { $ annotation = $ this -> __createAnnotation ( $ this -> currentAnnotationStr , $ this -> currentAnnotationContentStr ) ; $ this -> docblockObj -> addAnn... | check if there is a currently parsed annotation registers it and stops the current annotation parsing . |
8,877 | private function nextCharacter ( ) { ++ $ this -> currentCharIndex ; if ( $ this -> annotationLen <= $ this -> currentCharIndex ) { $ this -> currentChar = null ; } else { $ this -> currentChar = $ this -> annotation [ $ this -> currentCharIndex ] ; } return $ this -> currentChar ; } | moves the current cursor to the next character . |
8,878 | private function processOptionals ( array & $ expression , Call $ call , CompilationContext $ context ) { $ flags = null ; $ offset = null ; $ offsetParamOffset = 4 ; if ( isset ( $ expression [ 'parameters' ] [ 4 ] ) && 'int' === $ expression [ 'parameters' ] [ 4 ] [ 'parameter' ] [ 'type' ] ) { $ offset = $ expressio... | Process optional parameters . |
8,879 | private function createMatches ( array $ expression , CompilationContext $ context ) { if ( isset ( $ expression [ 'parameters' ] [ 2 ] ) ) { $ type = $ expression [ 'parameters' ] [ 2 ] [ 'parameter' ] [ 'type' ] ; if ( 'variable' !== $ type ) { throw new CompilerException ( 'Only variables can be passed by reference'... | Process the matches result . |
8,880 | private function getFileContents ( $ file ) { if ( ! isset ( $ this -> filesContent [ $ file ] ) ) { $ this -> filesContent [ $ file ] = file_exists ( $ file ) ? file ( $ file ) : [ ] ; } return $ this -> filesContent [ $ file ] ; } | Gets the contents of the files that are involved in the log message . |
8,881 | private function getRealCalledMethod ( CompilationContext $ compilationContext , Variable $ caller , $ methodName ) { $ compiler = $ compilationContext -> compiler ; $ numberPoly = 0 ; $ method = null ; if ( 'this' == $ caller -> getRealName ( ) ) { $ classDefinition = $ compilationContext -> classDefinition ; if ( $ c... | Examine internal class information and returns the method called . |
8,882 | public function getNomeDocumento ( ) { if ( ! $ this -> getDocumento ( ) ) { return $ this -> getNome ( ) ; } else { return $ this -> getNome ( ) . ' / ' . $ this -> getTipoDocumento ( ) . ': ' . $ this -> getDocumento ( ) ; } } | Retorna o nome e o documento formatados |
8,883 | public static function nFloat ( $ number , $ decimals = 2 , $ showThousands = false ) { if ( is_null ( $ number ) || empty ( self :: onlyNumbers ( $ number ) ) || floatval ( $ number ) == 0 ) { return 0 ; } $ pontuacao = preg_replace ( '/[0-9]/' , '' , $ number ) ; $ locale = ( mb_substr ( $ pontuacao , - 1 , 1 ) == ',... | Mostra o Valor no float Formatado |
8,884 | public static function percentOf ( $ big , $ small , $ defaultOnZero = 0 ) { $ result = $ big > 0.01 ? ( ( $ small * 100 ) / $ big ) : $ defaultOnZero ; return self :: nFloat ( $ result ) ; } | Return percent x of y ; |
8,885 | protected function incrementDetalhe ( ) { $ this -> increment ++ ; $ detalhe = new Detalhe ( ) ; $ this -> detalhe [ $ this -> increment ] = $ detalhe ; } | Incrementa o detalhe . |
8,886 | public function addBoleto ( BoletoContract $ boleto ) { $ dados = $ boleto -> toArray ( ) ; $ dados [ 'codigo_barras' ] = $ this -> getImagemCodigoDeBarras ( $ dados [ 'codigo_barras' ] ) ; $ this -> boleto [ ] = $ dados ; return $ this ; } | Addiciona o boleto |
8,887 | public function toArray ( ) { $ array = [ 'header' => $ this -> header -> toArray ( ) , 'trailer' => $ this -> trailer -> toArray ( ) , 'detalhes' => new Collection ( ) ] ; foreach ( $ this -> detalhe as $ detalhe ) { $ array [ 'detalhes' ] -> push ( $ detalhe -> toArray ( ) ) ; } return $ array ; } | Retorna o array . |
8,888 | public function getCodigoCliente ( ) { if ( empty ( $ this -> codigoCliente ) ) { $ this -> codigoCliente = Util :: formatCnab ( '9' , $ this -> getCarteiraNumero ( ) , 4 ) . Util :: formatCnab ( '9' , $ this -> getAgencia ( ) , 5 ) . Util :: formatCnab ( '9' , $ this -> getConta ( ) , 7 ) . Util :: formatCnab ( '9' , ... | Retorna o codigo do cliente . |
8,889 | public function addBoletos ( array $ boletos , $ withGroup = true ) { if ( $ withGroup ) { $ this -> StartPageGroup ( ) ; } foreach ( $ boletos as $ boleto ) { $ this -> addBoleto ( $ boleto ) ; } return $ this ; } | Addiciona o boletos |
8,890 | public function setJurosApos ( $ jurosApos ) { $ jurosApos = ( int ) $ jurosApos ; $ this -> jurosApos = $ jurosApos > 0 ? $ jurosApos : 0 ; return $ this ; } | Seta a quantidade de dias apos o vencimento que cobra o juros |
8,891 | public function getCodigoBarras ( ) { if ( ! empty ( $ this -> campoCodigoBarras ) ) { return $ this -> campoCodigoBarras ; } if ( ! $ this -> isValid ( $ messages ) ) { throw new \ Exception ( 'Campos requeridos pelo banco, aparentam estar ausentes ' . $ messages ) ; } $ codigo = Util :: numberFormatGeral ( $ this -> ... | Retorna o codigo de barras |
8,892 | public function getDataRemessa ( $ format ) { if ( is_null ( $ this -> dataRemessa ) ) { return Carbon :: now ( ) -> format ( $ format ) ; } return $ this -> dataRemessa -> format ( $ format ) ; } | Retorna a data da remessa a ser gerada |
8,893 | public function download ( $ filename = null ) { if ( $ filename === null ) { $ filename = 'remessa.txt' ; } header ( 'Content-type: text/plain' ) ; header ( 'Content-Disposition: attachment; filename="' . $ filename . '"' ) ; echo $ this -> gerar ( ) ; } | Realiza o download da string retornada do metodo gerar |
8,894 | public function gerar ( ) { if ( ! $ this -> isValid ( $ messages ) ) { throw new \ Exception ( 'Campos requeridos pelo banco, aparentam estar ausentes ' . $ messages ) ; } $ stringRemessa = '' ; if ( $ this -> iRegistros < 1 ) { throw new \ Exception ( 'Nenhuma linha detalhe foi adicionada' ) ; } $ this -> header ( ) ... | Gera o arquivo retorna a string . |
8,895 | public function setCip ( $ cip ) { $ this -> cip = $ cip ; $ this -> variaveis_adicionais [ 'cip' ] = $ this -> getCip ( ) ; return $ this ; } | Define o campo CIP do boleto |
8,896 | public static function fromParser ( MangaReviewParser $ parser ) : MangaReview { $ instance = new self ( ) ; $ instance -> malId = $ parser -> getId ( ) ; $ instance -> url = $ parser -> getUrl ( ) ; $ instance -> helpfulCount = $ parser -> getHelpfulCount ( ) ; $ instance -> date = $ parser -> getDate ( ) ; $ instance... | Create an instance from an MangaReviewParser parser |
8,897 | public static function removeChildNodes ( Crawler $ crawler ) : Crawler { if ( ! $ crawler -> count ( ) ) { return $ crawler ; } $ crawler -> children ( ) -> each ( function ( Crawler $ crawler ) { $ node = $ crawler -> getNode ( 0 ) ; if ( $ node === null || $ node -> nodeType === 3 || \ in_array ( $ node -> nodeName ... | Removes all html elements so the text is left over |
8,898 | public static function fromParser ( MangaParser $ parser ) : Manga { $ instance = new self ( ) ; $ instance -> title = $ parser -> getMangaTitle ( ) ; $ instance -> url = $ parser -> getMangaURL ( ) ; $ instance -> malId = $ parser -> getMangaId ( ) ; $ instance -> imageUrl = $ parser -> getMangaImageURL ( ) ; $ instan... | Create an instance from an MangaParser parser |
8,899 | private function generateRegex ( $ stepText ) { return preg_replace ( array_keys ( self :: $ replacePatterns ) , array_values ( self :: $ replacePatterns ) , $ this -> escapeStepText ( $ stepText ) ) ; } | Generates regex from step text . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.