idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
8,700 | public function getVariableForWrite ( $ name , CompilationContext $ compilationContext , array $ statement = null ) { if ( $ this -> globalsManager -> isSuperGlobal ( $ name ) ) { if ( ! $ this -> hasVariable ( $ name ) ) { $ superVar = new Variable ( 'variable' , $ name , $ compilationContext -> branchManager -> getCu... | Return a variable in the symbol table it will be used for a write operation Some variables aren t writable themselves but their members do . |
8,701 | public function getTempVariable ( $ type , CompilationContext $ compilationContext ) { $ compilationContext = $ compilationContext ? : $ this -> compilationContext ; $ tempVar = $ this -> getNextTempVar ( ) ; $ variable = $ this -> addVariable ( $ type , '_' . $ tempVar , $ compilationContext ) ; $ variable -> setTempo... | Returns a temporal variable . |
8,702 | public function getTempVariableForWrite ( $ type , CompilationContext $ context , $ init = true ) { $ variable = $ this -> reuseTempVariable ( $ type , 'heap' ) ; if ( \ is_object ( $ variable ) ) { $ variable -> increaseUses ( ) ; $ variable -> increaseMutates ( ) ; if ( $ init && ( 'variable' == $ type || 'string' ==... | Creates a temporary variable to be used in a write operation . |
8,703 | public function getTempNonTrackedVariable ( $ type , CompilationContext $ context , $ initNonReferenced = false ) { $ variable = $ this -> reuseTempVariable ( $ type , 'non-tracked' ) ; if ( \ is_object ( $ variable ) ) { $ variable -> increaseUses ( ) ; $ variable -> increaseMutates ( ) ; if ( $ initNonReferenced ) { ... | Creates a temporary variable to be used to point to a heap variable These kind of variables MUST not be tracked by the Zephir memory manager . |
8,704 | public function addTemp ( $ type , CompilationContext $ context ) { $ tempVar = $ this -> getNextTempVar ( ) ; $ variable = $ this -> addVariable ( $ type , '_' . $ tempVar , $ context ) ; $ variable -> setIsInitialized ( true , $ context ) ; $ variable -> setTemporal ( true ) ; $ variable -> increaseUses ( ) ; $ varia... | Creates a temporary variable . |
8,705 | public function getTempVariableForObserve ( $ type , CompilationContext $ context ) { $ variable = $ this -> reuseTempVariable ( $ type , 'observe' ) ; if ( \ is_object ( $ variable ) ) { $ variable -> increaseUses ( ) ; $ variable -> increaseMutates ( ) ; $ variable -> observeVariant ( $ context ) ; return $ variable ... | Creates a temporary variable to be used as intermediate variable of a read operation Variables are automatically tracked by the memory manager . |
8,706 | public function markTemporalVariablesIdle ( CompilationContext $ compilationContext ) { $ compilationContext = $ compilationContext ? : $ this -> compilationContext ; $ branchId = $ compilationContext -> branchManager -> getCurrentBranchId ( ) ; if ( ! isset ( $ this -> branchTempVariables [ $ branchId ] ) ) { return ;... | Traverses temporal variables created in a specific branch marking them as idle . |
8,707 | protected function registerTempVariable ( $ type , $ location , Variable $ variable , CompilationContext $ compilationContext = null ) { $ compilationContext = $ compilationContext ? : $ this -> compilationContext ; $ branchId = $ compilationContext -> branchManager -> getCurrentBranchId ( ) ; if ( ! isset ( $ this -> ... | Register a variable as temporal . |
8,708 | protected function reuseTempVariable ( $ type , $ location , CompilationContext $ compilationContext = null ) { $ compilationContext = $ compilationContext ? : $ this -> compilationContext ; $ branchId = $ compilationContext -> branchManager -> getCurrentBranchId ( ) ; if ( isset ( $ this -> branchTempVariables [ $ bra... | Reuse variables marked as idle after leave a branch . |
8,709 | public function increaseMutations ( $ variable ) { if ( isset ( $ this -> mutations [ $ variable ] ) ) { ++ $ this -> mutations [ $ variable ] ; } else { $ this -> mutations [ $ variable ] = 1 ; } return $ this ; } | Increase the number of mutations a variable has inside a statement block . |
8,710 | public function passExpression ( array $ expression ) { switch ( $ expression [ 'type' ] ) { case 'bool' : case 'double' : case 'int' : case 'uint' : case 'long' : case 'ulong' : case 'string' : case 'istring' : case 'null' : case 'char' : case 'uchar' : case 'empty-array' : case 'variable' : case 'constant' : case 'st... | Pass expressions . |
8,711 | private function reslovePrototypesPath ( ) { $ prototypesPath = $ this -> prototypesPath ; if ( empty ( $ prototypesPath ) ) { $ prototypesPath = \ dirname ( __DIR__ ) . '/prototypes' ; } if ( ! is_dir ( $ prototypesPath ) || ! is_readable ( $ prototypesPath ) ) { throw new IllegalStateException ( 'Unable to resolve in... | Resolves path to the internal prototypes . |
8,712 | private function resolveOptimizersPath ( ) { $ optimizersPath = $ this -> optimizersPath ; if ( empty ( $ optimizersPath ) ) { $ optimizersPath = __DIR__ . '/Optimizers' ; } if ( ! is_dir ( $ optimizersPath ) || ! is_readable ( $ optimizersPath ) ) { throw new IllegalStateException ( 'Unable to resolve internal optimiz... | Resolves path to the internal optimizers . |
8,713 | public function loadExternalClass ( $ className , $ location ) { $ filePath = $ location . \ DIRECTORY_SEPARATOR . strtolower ( str_replace ( '\\' , \ DIRECTORY_SEPARATOR , $ className ) ) . '.zep' ; $ className = implode ( '\\' , array_map ( 'ucfirst' , explode ( '\\' , $ className ) ) ) ; if ( isset ( $ this -> files... | Loads a class definition in an external dependency . |
8,714 | public function isClass ( $ className ) { foreach ( $ this -> definitions as $ key => $ value ) { if ( ! strcasecmp ( $ key , $ className ) && 'class' === $ value -> getType ( ) ) { return true ; } } if ( \ count ( $ this -> externalDependencies ) ) { foreach ( $ this -> externalDependencies as $ namespace => $ locatio... | Allows to check if a class is part of the compiled extension . |
8,715 | public function addClassDefinition ( CompilerFileAnonymous $ file , ClassDefinition $ classDefinition ) { $ this -> definitions [ $ classDefinition -> getCompleteName ( ) ] = $ classDefinition ; $ this -> anonymousFiles [ $ classDefinition -> getCompleteName ( ) ] = $ file ; } | Inserts an anonymous class definition in the compiler . |
8,716 | public function setExtensionGlobals ( array $ globals ) { foreach ( $ globals as $ key => $ value ) { $ this -> globals [ $ key ] = $ value ; } } | Sets extensions globals . |
8,717 | public function getGccFlags ( $ development = false ) { if ( is_windows ( ) ) { return '' ; } $ gccFlags = getenv ( 'CFLAGS' ) ; if ( ! \ is_string ( $ gccFlags ) ) { if ( false === $ development ) { $ gccVersion = $ this -> getGccVersion ( ) ; if ( version_compare ( $ gccVersion , '4.6.0' , '>=' ) ) { $ gccFlags = '-O... | Returns GCC flags for current compilation . |
8,718 | public function preCompileHeaders ( ) { if ( is_windows ( ) ) { return ; } $ phpIncludes = $ this -> getPhpIncludeDirs ( ) ; foreach ( new \ DirectoryIterator ( 'ext/kernel' ) as $ file ) { if ( $ file -> isDir ( ) ) { continue ; } if ( preg_match ( '/\.h$/' , $ file ) ) { $ path = $ file -> getRealPath ( ) ; $ command... | Pre - compile headers to speed up compilation . |
8,719 | public function api ( array $ options = [ ] , $ fromGenerate = false ) { if ( ! $ fromGenerate ) { $ this -> generate ( ) ; } $ templatesPath = $ this -> templatesPath ; if ( null === $ templatesPath ) { $ templatesPath = \ dirname ( __DIR__ ) . '/templates' ; } $ documentator = new Documentation ( $ this -> files , $ ... | Generate a HTML API . |
8,720 | public function stubs ( $ fromGenerate = false ) { if ( ! $ fromGenerate ) { $ this -> generate ( ) ; } $ this -> logger -> info ( 'Generating stubs...' ) ; $ stubsGenerator = new Stubs \ Generator ( $ this -> files , $ this -> config ) ; $ path = $ this -> config -> get ( 'path' , 'stubs' ) ; $ path = str_replace ( '%... | Generate IDE stubs . |
8,721 | public function processCodeInjection ( array $ entries , $ section = 'request' ) { $ codes = [ ] ; $ includes = [ ] ; if ( isset ( $ entries [ $ section ] ) ) { foreach ( $ entries [ $ section ] as $ entry ) { if ( isset ( $ entry [ 'code' ] ) && ! empty ( $ entry [ 'code' ] ) ) { $ codes [ ] = $ entry [ 'code' ] . ';'... | Process extension code injection . |
8,722 | public function generatePackageDependenciesM4 ( $ contentM4 ) { $ packageDependencies = $ this -> config -> get ( 'package-dependencies' ) ; if ( \ is_array ( $ packageDependencies ) ) { $ pkgconfigM4 = $ this -> backend -> getTemplateFileContents ( 'pkg-config.m4' ) ; $ pkgconfigCheckM4 = $ this -> backend -> getTempl... | Generate package - dependencies config for m4 . |
8,723 | private function preCompile ( $ filePath ) { if ( ! $ this -> parserManager -> isAvailable ( ) ) { throw new IllegalStateException ( $ this -> parserManager -> requirements ( ) ) ; } if ( preg_match ( '#\.zep$#' , $ filePath ) ) { $ className = str_replace ( \ DIRECTORY_SEPARATOR , '\\' , $ filePath ) ; $ className = p... | Pre - compiles classes creating a CompilerFile definition . |
8,724 | private function recursivePreCompile ( $ path ) { if ( ! is_dir ( $ path ) ) { throw new InvalidArgumentException ( sprintf ( "An invalid path was passed to the compiler. Unable to obtain the '%s%s%s' directory." , getcwd ( ) , \ DIRECTORY_SEPARATOR , $ path ) ) ; } $ iterator = new \ RecursiveIteratorIterator ( new \ ... | Recursively pre - compiles all sources found in the given path . |
8,725 | private function recursiveDeletePath ( $ path , $ mask ) { if ( ! file_exists ( $ path ) || ! is_dir ( $ path ) || ! is_readable ( $ path ) ) { $ this -> logger -> warning ( "Directory '{$path}' is not readable. Skip..." ) ; return ; } $ objects = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ p... | Recursively deletes files in a specified location . |
8,726 | private function loadConstantsSources ( $ constantsSources ) { foreach ( $ constantsSources as $ constantsSource ) { if ( ! file_exists ( $ constantsSource ) ) { throw new Exception ( "File '" . $ constantsSource . "' with constants definitions" ) ; } foreach ( file ( $ constantsSource ) as $ line ) { if ( preg_match (... | Registers C - constants as PHP constants from a C - file . |
8,727 | private function processAddSources ( $ sources , $ project ) { $ groupSources = [ ] ; foreach ( $ sources as $ source ) { $ dirName = str_replace ( \ DIRECTORY_SEPARATOR , '/' , \ dirname ( $ source ) ) ; if ( ! isset ( $ groupSources [ $ dirName ] ) ) { $ groupSources [ $ dirName ] = [ ] ; } $ groupSources [ $ dirName... | Process config . w32 sections . |
8,728 | private function assertRequiredExtensionsIsPresent ( ) { $ extensionRequires = $ this -> config -> get ( 'extensions' , 'requires' ) ; if ( true === empty ( $ extensionRequires ) ) { return ; } $ extensions = [ ] ; foreach ( $ extensionRequires as $ key => $ value ) { if ( false === \ extension_loaded ( $ value ) ) { $... | Ensure that required extensions is present . |
8,729 | private function checkKernelFile ( $ src , $ dst ) { if ( preg_match ( '#kernels/ZendEngine[2-9]/concat\.#' , $ src ) ) { return true ; } if ( ! file_exists ( $ dst ) ) { return false ; } return md5_file ( $ src ) == md5_file ( $ dst ) ; } | Checks if a file must be copied . |
8,730 | private function checkKernelFiles ( ) { $ kernelPath = 'ext' . \ DIRECTORY_SEPARATOR . 'kernel' ; if ( ! file_exists ( $ kernelPath ) ) { if ( ! mkdir ( $ kernelPath , 0775 , true ) ) { throw new Exception ( "Cannot create kernel directory: {$kernelPath}" ) ; } } $ kernelPath = realpath ( $ kernelPath ) ; $ sourceKerne... | Checks which files in the base kernel must be copied . |
8,731 | private function checkDirectory ( ) { $ namespace = $ this -> config -> get ( 'namespace' ) ; if ( ! $ namespace ) { throw new Exception ( 'Extension namespace cannot be loaded' ) ; } if ( ! \ is_string ( $ namespace ) ) { throw new Exception ( 'Extension namespace is invalid' ) ; } if ( ! $ this -> filesystem -> isIni... | Checks if the current directory is a valid Zephir project . |
8,732 | private function getGccVersion ( ) { if ( is_windows ( ) ) { return '0.0.0' ; } if ( $ this -> filesystem -> exists ( 'gcc-version' ) ) { return $ this -> filesystem -> read ( 'gcc-version' ) ; } $ this -> filesystem -> system ( 'gcc -dumpversion' , 'stdout' , 'gcc-version' ) ; $ lines = $ this -> filesystem -> file ( ... | Returns current GCC version . |
8,733 | public function getFunctionCache ( ) { if ( ! $ this -> functionCache ) { $ this -> functionCache = new FunctionCache ( $ this -> gatherer ) ; } return $ this -> functionCache ; } | Creates or returns an existing function cache . |
8,734 | public function isAvailable ( ) { return $ this -> parser -> isAvailable ( ) && version_compare ( self :: MINIMUM_PARSER_VERSION , $ this -> parser -> getVersion ( ) , '<=' ) ; } | Check if Zephir Parser available . |
8,735 | public function render ( ) { if ( $ this -> richFormat && $ this -> functionLike -> isReturnTypesHintDetermined ( ) && $ this -> functionLike -> areReturnTypesCompatible ( ) ) { $ this -> richRenderStart ( ) ; if ( false == $ this -> hasParameters ( ) ) { $ this -> codePrinter -> output ( 'ZEND_END_ARG_INFO()' ) ; $ th... | Render argument information . |
8,736 | public function getReflector ( $ funcName ) { if ( ! isset ( self :: $ functionReflection [ $ funcName ] ) ) { try { $ reflectionFunction = new \ ReflectionFunction ( $ funcName ) ; } catch ( \ ReflectionException $ e ) { $ reflectionFunction = null ; } self :: $ functionReflection [ $ funcName ] = $ reflectionFunction... | Process the ReflectionFunction for the specified function name . |
8,737 | public function functionExists ( $ functionName , CompilationContext $ context ) { if ( \ function_exists ( $ functionName ) ) { return true ; } if ( $ this -> isBuiltInFunction ( $ functionName ) ) { return true ; } $ internalName = [ 'f__' . $ functionName ] ; if ( isset ( $ context -> classDefinition ) ) { $ lowerNa... | Checks if a function exists or is a built - in Zephir function . |
8,738 | protected function isReadOnly ( $ funcName , array $ expression ) { if ( $ this -> isBuiltInFunction ( $ funcName ) ) { return false ; } switch ( $ funcName ) { case 'min' : case 'max' : case 'array_fill' : case 'array_pad' : case 'call_user_func' : case 'call_user_func_array' : return false ; } $ reflector = $ this ->... | This method gets the reflection of a function to check if any of their parameters are passed by reference Built - in functions rarely change the parameters if they aren t passed by reference . |
8,739 | protected function markReferences ( $ funcName , $ parameters , CompilationContext $ compilationContext , & $ references , $ expression ) { if ( $ this -> isBuiltInFunction ( $ funcName ) ) { return ; } $ reflector = $ this -> getReflector ( $ funcName ) ; if ( $ reflector ) { $ numberParameters = \ count ( $ parameter... | Once the function processes the parameters we should mark specific parameters to be passed by reference . |
8,740 | protected function optimize ( $ funcName , array $ expression , Call $ call , CompilationContext $ compilationContext ) { $ optimizer = false ; if ( ! isset ( self :: $ optimizers [ $ funcName ] ) ) { $ camelizeFunctionName = camelize ( $ funcName ) ; foreach ( self :: $ optimizerDirectories as $ directory ) { $ path =... | Tries to find specific an specialized optimizer for function calls . |
8,741 | public function preOutput ( $ code ) { $ this -> lastLine = $ code ; $ this -> code = str_repeat ( "\t" , $ this -> level ) . $ code . PHP_EOL . $ this -> code ; ++ $ this -> currentPrints ; } | Add code to the output at the beginning . |
8,742 | public function outputNoIndent ( $ code ) { $ this -> lastLine = $ code ; $ this -> code .= $ code . PHP_EOL ; ++ $ this -> currentPrints ; } | Add code to the output without indentation . |
8,743 | public function output ( $ code ) { $ this -> lastLine = $ code ; $ this -> code .= str_repeat ( "\t" , $ this -> level ) . $ code . PHP_EOL ; ++ $ this -> currentPrints ; } | Add code to the output . |
8,744 | public function outputDocBlock ( $ docblock , $ replaceTab = true ) { $ code = '' ; $ docblock = '/' . $ docblock . '/' ; foreach ( explode ( "\n" , $ docblock ) as $ line ) { if ( $ replaceTab ) { $ code .= str_repeat ( "\t" , $ this -> level ) . preg_replace ( '/^[ \t]+/' , ' ' , $ line ) . PHP_EOL ; } else { $ code ... | Adds a comment to the output with indentation level . |
8,745 | public function preOutputBlankLine ( $ ifPrevNotBlank = false ) { if ( ! $ ifPrevNotBlank ) { $ this -> code = PHP_EOL . $ this -> code ; $ this -> lastLine = PHP_EOL ; ++ $ this -> currentPrints ; } else { if ( trim ( $ this -> lastLine ) ) { $ this -> code = PHP_EOL . $ this -> code ; $ this -> lastLine = PHP_EOL ; +... | Adds a blank line to the output Optionally controlling if the blank link must be added if the previous line added isn t one blank line too . |
8,746 | public function get ( $ key , $ namespace = null ) { return null !== $ namespace ? $ this -> offsetGet ( [ $ namespace => $ key ] ) : $ this -> offsetGet ( $ key ) ; } | Retrieves a configuration setting . |
8,747 | protected function populate ( ) { if ( ! file_exists ( 'config.json' ) ) { return ; } $ config = json_decode ( file_get_contents ( 'config.json' ) , true ) ; if ( ! \ is_array ( $ config ) ) { throw new Exception ( 'The config.json file is not valid or there is no Zephir extension initialized in this directory.' ) ; } ... | Populate project configuration . |
8,748 | public function generate ( $ path ) { if ( 'tabs' === $ this -> config -> get ( 'indent' , 'extra' ) ) { $ indent = "\t" ; } else { $ indent = ' ' ; } $ namespace = $ this -> config -> get ( 'namespace' ) ; foreach ( $ this -> files as $ file ) { $ class = $ file -> getClassDefinition ( ) ; $ source = $ this -> buil... | Generates stubs . |
8,749 | protected function buildClass ( ClassDefinition $ class , $ indent ) { $ source = <<<EOF<?phpnamespace {$class->getNamespace()};EOF ; $ source .= ( new DocBlock ( $ class -> getDocBlock ( ) , '' ) ) . "\n" ; if ( $ class -> isFinal ( ) ) { $ source .= 'final ' ; } elseif ( $ class -> isAbstract ( ) ) { $ source .= 'ab... | Build class . |
8,750 | protected function buildProperty ( ClassProperty $ property , $ indent ) { $ visibility = 'public' ; if ( false === $ property -> isPublic ( ) ) { $ visibility = $ property -> isProtected ( ) ? 'protected' : 'private' ; } if ( $ property -> isStatic ( ) ) { $ visibility = 'static ' . $ visibility ; } $ source = $ visib... | Build property . |
8,751 | protected function wrapPHPValue ( $ parameter ) { switch ( $ parameter [ 'default' ] [ 'type' ] ) { case 'null' : return 'null' ; break ; case 'string' : case 'char' : return '\'' . addslashes ( $ parameter [ 'default' ] [ 'value' ] ) . '\'' ; break ; case 'empty-array' : return 'array()' ; break ; case 'array' : $ par... | Prepare AST default value to PHP code print . |
8,752 | public function markVariableIfUnknown ( $ variable , $ type ) { $ this -> variables [ $ variable ] = $ type ; $ this -> infered [ $ variable ] = $ type ; } | Marks a variable to mandatory be stored in the heap if a type has not been defined for it . |
8,753 | public function reduce ( ) { $ pass = false ; foreach ( $ this -> variables as $ variable => $ type ) { if ( 'variable' == $ type || 'string' == $ type || 'istring' == $ type || 'array' == $ type || 'null' == $ type || 'numeric' == $ type ) { unset ( $ this -> variables [ $ variable ] ) ; } else { $ pass = true ; $ thi... | Process the found infered types and schedule a new pass . |
8,754 | public function optimizeConstantFolding ( array $ expression , CompilationContext $ compilationContext ) { if ( 'int' != $ expression [ 'left' ] [ 'type' ] && 'double' != $ expression [ 'left' ] [ 'type' ] ) { return false ; } if ( $ compilationContext -> config -> get ( 'constant-folding' , 'optimizations' ) ) { if ( ... | This tries to perform arithmetical operations . |
8,755 | private function getDynamicTypes ( Variable $ left , Variable $ right ) { if ( '/' == $ this -> operator ) { return 'double' ; } switch ( $ left -> getType ( ) ) { case 'int' : case 'uint' : case 'long' : case 'ulong' : switch ( $ right -> getType ( ) ) { case 'int' : case 'uint' : case 'long' : case 'ulong' : return '... | Returns proper dynamic types . |
8,756 | public function listen ( $ event , $ callback ) { if ( ! isset ( $ this -> listeners [ $ event ] ) ) { $ this -> listeners [ $ event ] = [ ] ; } $ this -> listeners [ $ event ] [ ] = $ callback ; } | Attaches a listener to a specific event type . |
8,757 | public function dispatch ( $ event , array $ param = [ ] ) { foreach ( $ this -> listeners [ $ event ] as $ listener ) { \ call_user_func_array ( $ listener , $ param ) ; } } | Triggers an event for the specified event type . |
8,758 | public function assign ( $ variable , $ property , ZephirVariable $ symbolVariable , CompilationContext $ compilationContext , $ statement ) { if ( ! $ symbolVariable -> isInitialized ( ) ) { throw new CompilerException ( "Cannot mutate variable '" . $ variable . "' because it is not initialized" , $ statement ) ; } if... | Compiles obj - > x ++ . |
8,759 | public function passLetStatement ( array $ statement ) { foreach ( $ statement [ 'assignments' ] as $ assignment ) { if ( isset ( $ assignment [ 'expr' ] ) ) { $ this -> passExpression ( $ assignment [ 'expr' ] ) ; } $ this -> increaseMutations ( $ assignment [ 'variable' ] ) ; if ( self :: DETECT_VALUE_IN_ASSIGNMENT =... | Pass let statements . |
8,760 | public function passArray ( array $ expression ) { foreach ( $ expression [ 'left' ] as $ item ) { $ usePass = self :: DETECT_ARRAY_USE == ( $ this -> detectionFlags & self :: DETECT_ARRAY_USE ) ; if ( $ usePass && 'variable' == $ item [ 'value' ] [ 'type' ] ) { $ this -> increaseMutations ( $ item [ 'value' ] [ 'value... | Pass array expressions . |
8,761 | public function passNew ( array $ expression ) { if ( isset ( $ expression [ 'parameters' ] ) ) { foreach ( $ expression [ 'parameters' ] as $ parameter ) { $ usePass = self :: DETECT_PARAM_PASS == ( $ this -> detectionFlags & self :: DETECT_PARAM_PASS ) ; if ( $ usePass && 'variable' == $ parameter [ 'parameter' ] [ '... | Pass new expressions . |
8,762 | public function declareVariables ( array $ statement ) { if ( isset ( $ statement [ 'data-type' ] ) ) { if ( 'variable' != $ statement [ 'data-type' ] ) { return ; } } foreach ( $ statement [ 'variables' ] as $ variable ) { if ( isset ( $ variable [ 'expr' ] ) ) { if ( 'string' == $ variable [ 'expr' ] [ 'type' ] || 'e... | Pass declare statement . |
8,763 | public function getExpectedNonLiteral ( CompilationContext $ compilationContext , $ expression , $ init = true ) { $ isExpecting = $ this -> expecting ; $ symbolVariable = $ this -> expectingVariable ; if ( $ isExpecting ) { if ( \ is_object ( $ symbolVariable ) ) { if ( 'variable' == $ symbolVariable -> getType ( ) &&... | Returns the expected variable for assignment or creates a temporary variable to store the result . This method returns a variable that is always stored in the heap . |
8,764 | public function getExpected ( CompilationContext $ compilationContext , $ expression , $ init = true ) { $ isExpecting = $ this -> expecting ; $ symbolVariable = $ this -> expectingVariable ; if ( $ isExpecting ) { if ( \ is_object ( $ symbolVariable ) ) { if ( 'variable' == $ symbolVariable -> getType ( ) ) { if ( ! $... | Returns the expected variable for assignment or creates a temporary variable to store the result . |
8,765 | public function getExpectedComplexLiteral ( CompilationContext $ compilationContext , $ expression , $ type = 'variable' ) { $ isExpecting = $ this -> expecting ; $ symbolVariable = $ this -> expectingVariable ; if ( $ isExpecting ) { if ( \ is_object ( $ symbolVariable ) ) { if ( $ symbolVariable -> getType ( ) == $ t... | Returns the expected variable for assignment or creates a temporary variable to store the result if a temporary variable is created it use whose body is only freed on every iteration . |
8,766 | public function compile ( array $ expression , CompilationContext $ compilationContext ) { if ( ! isset ( $ expression [ 'parameters' ] ) ) { throw new CompilerException ( "Invalid 'parameters' for new-type" , $ expression ) ; } switch ( $ expression [ 'internal-type' ] ) { case 'array' : $ compilationContext -> header... | Executes the operator . |
8,767 | public function compile ( array $ expression , CompilationContext $ compilationContext ) { $ expr = new Expression ( $ expression [ 'right' ] ) ; $ expr -> setReadOnly ( true ) ; $ resolved = $ expr -> compile ( $ compilationContext ) ; if ( 'variable' != $ resolved -> getType ( ) ) { throw new CompilerException ( 'Typ... | Performs type - hint compilation . |
8,768 | public function themeOption ( $ name ) { return isset ( $ this -> themeOptions [ $ name ] ) ? $ this -> themeOptions [ $ name ] : null ; } | find the value of an option of the theme . |
8,769 | public function url ( $ url ) { if ( \ is_string ( $ url ) ) { if ( '/' == $ url [ 0 ] ) { return $ this -> getPathToRoot ( ) . ltrim ( $ url , '/' ) ; } elseif ( \ is_string ( $ url ) ) { return $ url ; } } elseif ( $ url instanceof ClassDefinition ) { return $ this -> url ( Documentation :: classUrl ( $ url ) ) ; } e... | Generate an url relative to the current directory . |
8,770 | private function isClassCacheable ( $ classDefinition ) { if ( $ classDefinition instanceof ClassDefinition ) { return true ; } if ( $ classDefinition instanceof \ ReflectionClass ) { if ( $ classDefinition -> isInternal ( ) && $ classDefinition -> isInstantiable ( ) ) { $ extension = $ classDefinition -> getExtension ... | Checks if the class is suitable for caching . |
8,771 | public static function getFunctionSlot ( $ functionName ) { if ( isset ( self :: $ cacheFunctionSlots [ $ functionName ] ) ) { return self :: $ cacheFunctionSlots [ $ functionName ] ; } $ slot = self :: $ slot ++ ; if ( $ slot >= self :: MAX_SLOTS_NUMBER ) { return 0 ; } self :: $ cacheFunctionSlots [ $ functionName ] ... | Returns or creates a cache slot for a function . |
8,772 | public static function getMethodSlot ( ClassMethod $ method ) { $ className = $ method -> getClassDefinition ( ) -> getCompleteName ( ) ; $ methodName = $ method -> getName ( ) ; if ( isset ( self :: $ cacheMethodSlots [ $ className ] [ $ methodName ] ) ) { return self :: $ cacheMethodSlots [ $ className ] [ $ methodNa... | Returns or creates a cache slot for a method . |
8,773 | public static function getExistingMethodSlot ( ClassMethod $ method ) { $ className = $ method -> getClassDefinition ( ) -> getCompleteName ( ) ; $ methodName = $ method -> getName ( ) ; if ( isset ( self :: $ cacheMethodSlots [ $ className ] [ $ methodName ] ) ) { return self :: $ cacheMethodSlots [ $ className ] [ $ ... | Returns a cache slot for a method . |
8,774 | public function invokeMethod ( $ methodName , $ caller , CompilationContext $ compilationContext , Call $ call , array $ expression ) { if ( method_exists ( $ this , $ methodName ) ) { return $ this -> { $ methodName } ( $ caller , $ compilationContext , $ call , $ expression ) ; } if ( isset ( $ this -> methodMap [ $ ... | Intercepts calls to built - in methods . |
8,775 | public function compile ( $ expression , CompilationContext $ compilationContext ) { if ( ! isset ( $ expression [ 'left' ] ) ) { throw new CompilerException ( 'Missing left part of the expression' ) ; } $ leftExpr = new Expression ( $ expression [ 'left' ] ) ; $ leftExpr -> setReadOnly ( $ this -> readOnly ) ; $ left ... | Compile expression . |
8,776 | public function add ( $ path , $ position = 0 ) { if ( ! \ is_string ( $ path ) ) { throw new \ InvalidArgumentException ( '$path must be only string type' ) ; } if ( ! $ position ) { $ this -> headers [ $ path ] = $ path ; } else { switch ( $ position ) { case self :: POSITION_FIRST : $ this -> headersFirst [ $ path ]... | Adds a header path to the manager . |
8,777 | public function processValue ( CompilationContext $ compilationContext ) { if ( 'constant' == $ this -> value [ 'type' ] ) { $ constant = new Constants ( ) ; $ compiledExpression = $ constant -> compile ( $ this -> value , $ compilationContext ) ; $ this -> value = [ 'type' => $ compiledExpression -> getType ( ) , 'val... | Process the value of the class constant if needed . |
8,778 | public function compile ( CompilationContext $ compilationContext ) { $ this -> processValue ( $ compilationContext ) ; $ constanValue = isset ( $ this -> value [ 'value' ] ) ? $ this -> value [ 'value' ] : null ; $ compilationContext -> backend -> declareConstant ( $ this -> value [ 'type' ] , $ this -> getName ( ) , ... | Produce the code to register a class constant . |
8,779 | protected function isDevelopmentModeEnabled ( InputInterface $ input ) { if ( false == $ input -> getOption ( 'no-dev' ) ) { return $ input -> getOption ( 'dev' ) || PHP_DEBUG ; } return false ; } | Checks if the development mode is enabled . |
8,780 | public function add ( array $ useStatement ) { foreach ( $ useStatement [ 'aliases' ] as $ alias ) { if ( isset ( $ alias [ 'alias' ] ) ) { $ this -> aliases [ $ alias [ 'alias' ] ] = $ alias [ 'name' ] ; } else { $ parts = explode ( '\\' , $ alias [ 'name' ] ) ; $ implicitAlias = $ parts [ \ count ( $ parts ) - 1 ] ; ... | Adds a renaming in a use to the alias manager . |
8,781 | public function getVisibilityAccessor ( ) { $ modifiers = [ ] ; foreach ( $ this -> visibility as $ visibility ) { switch ( $ visibility ) { case 'protected' : $ modifiers [ 'ZEND_ACC_PROTECTED' ] = true ; break ; case 'private' : $ modifiers [ 'ZEND_ACC_PRIVATE' ] = true ; break ; case 'public' : $ modifiers [ 'ZEND_A... | Returns the C - visibility accessors for the model . |
8,782 | public function compile ( CompilationContext $ compilationContext ) { switch ( $ this -> defaultValue [ 'type' ] ) { case 'long' : case 'int' : case 'string' : case 'double' : case 'bool' : $ this -> declareProperty ( $ compilationContext , $ this -> defaultValue [ 'type' ] , $ this -> defaultValue [ 'value' ] ) ; brea... | Produce the code to register a property . |
8,783 | protected function removeInitializationStatements ( & $ statements ) { foreach ( $ statements as $ index => $ statement ) { if ( ! $ this -> isStatic ( ) ) { if ( $ statement [ 'expr' ] [ 'left' ] [ 'right' ] [ 'value' ] == $ this -> name ) { unset ( $ statements [ $ index ] ) ; } } else { if ( $ statement [ 'assignmen... | Removes all initialization statements related to this property . |
8,784 | protected function declareProperty ( CompilationContext $ compilationContext , $ type , $ value ) { $ codePrinter = $ compilationContext -> codePrinter ; if ( \ is_object ( $ value ) ) { return ; } $ classEntry = $ compilationContext -> classDefinition -> getClassEntry ( ) ; switch ( $ type ) { case 'long' : case 'int'... | Declare class property with default value . |
8,785 | public function assignZval ( Variable $ variable , $ code , CompilationContext $ context ) { $ code = $ this -> resolveValue ( $ code , $ context ) ; if ( ! $ variable -> isDoublePointer ( ) ) { $ context -> symbolTable -> mustGrownStack ( true ) ; $ symbolVariable = $ this -> getVariableCode ( $ variable ) ; $ context... | Assigns a zval to another . |
8,786 | public function getTypesBySpecification ( SpecificationInterface $ spec ) { $ types = [ ] ; foreach ( $ this as $ type ) { if ( $ spec -> isSatisfiedBy ( $ type ) ) { $ types [ ] = $ type ; } } return $ types ; } | Gets all return types satisfied by specification . |
8,787 | public function onlySpecial ( ) { if ( 0 == $ this -> count ( ) ) { return false ; } $ found = $ this -> getTypesBySpecification ( new Specification \ IsSpecial ( ) ) ; return \ count ( $ found ) == $ this -> count ( ) ; } | Checks if the collection has only special types . |
8,788 | public function areReturnTypesWellKnown ( ) { if ( 0 == $ this -> count ( ) || $ this -> isSatisfiedByTypeSpec ( new Specification \ IsSpecial ( ) ) ) { return false ; } $ spec = ( new Specification \ ObjectLike ( ) ) -> either ( new Specification \ ArrayCompatible ( ) ) -> either ( new Specification \ IntCompatible ( ... | Checks whether all return types hint are well known . |
8,789 | public function areReturnTypesCompatible ( ) { $ numberOfReturnTypes = $ this -> count ( ) ; if ( 0 == $ numberOfReturnTypes || 1 == $ numberOfReturnTypes ) { return true ; } $ classes = $ this -> getObjectLikeReturnTypes ( ) ; $ collections = $ this -> getTypesBySpecification ( new Specification \ IsCollection ( ) ) ;... | Checks if the collection have compatible return types . |
8,790 | private function doArrayAssignment ( CodePrinter $ codePrinter , CompiledExpression $ resolvedExpr , ZephirVariable $ symbolVariable , $ variable , array $ statement , CompilationContext $ compilationContext ) { switch ( $ resolvedExpr -> getType ( ) ) { case 'variable' : case 'array' : switch ( $ statement [ 'operator... | Performs array assignment . |
8,791 | public function getTypeofCondition ( Variable $ variableVariable , $ operator , $ value , CompilationContext $ context ) { $ variableName = $ this -> getVariableCode ( $ variableVariable ) ; switch ( $ value ) { case 'array' : $ condition = 'Z_TYPE_P(' . $ variableName . ') ' . $ operator . ' IS_ARRAY' ; break ; case '... | Checks the type of a variable using the ZendEngine constants . |
8,792 | public function getInternalSignature ( ClassMethod $ method , CompilationContext $ context ) { if ( $ method -> isInitializer ( ) && ! $ method -> isStatic ( ) ) { return 'zend_object_value ' . $ method -> getName ( ) . '(zend_class_entry *class_type TSRMLS_DC)' ; } if ( $ method -> isInitializer ( ) && $ method -> isS... | Returns the signature of an internal method . |
8,793 | private function resolveOffsetExprs ( $ offsetExprs , CompilationContext $ compilationContext ) { $ keys = '' ; $ offsetItems = [ ] ; $ numberParams = 0 ; foreach ( $ offsetExprs as $ offsetExpr ) { if ( 'a' == $ offsetExpr ) { $ keys .= 'a' ; ++ $ numberParams ; continue ; } switch ( $ offsetExpr -> getType ( ) ) { ca... | Resolve expressions . |
8,794 | public function getLastLine ( ) { if ( ! $ this -> lastStatement ) { $ this -> lastStatement = $ this -> statements [ \ count ( $ this -> statements ) - 1 ] ; } } | Returns the last line in the last statement . |
8,795 | public function setImplementsInterfaces ( array $ implementedInterfaces ) { $ interfaces = [ ] ; foreach ( $ implementedInterfaces as $ implementedInterface ) { $ interfaces [ ] = $ implementedInterface [ 'value' ] ; } $ this -> interfaces = $ interfaces ; } | Sets the implemented interfaces . |
8,796 | public function getExtendsClassDefinition ( ) { if ( ! $ this -> extendsClassDefinition && $ this -> extendsClass ) { if ( $ this -> compiler ) { $ this -> setExtendsClassDefinition ( $ this -> compiler -> getClassDefinition ( $ this -> extendsClass ) ) ; } } return $ this -> extendsClassDefinition ; } | Returns the class definition related to the extended class . |
8,797 | public function getDependencies ( ) { $ dependencies = [ ] ; if ( $ this -> extendsClassDefinition && $ this -> extendsClassDefinition instanceof self ) { $ dependencies [ ] = $ this -> extendsClassDefinition ; } foreach ( $ this -> implementedInterfaceDefinitions as $ interfaceDefinition ) { if ( $ interfaceDefinition... | Calculate the dependency rank of the class based on its dependencies . |
8,798 | public function getParsedDocBlock ( ) { if ( ! $ this -> parsedDocblock ) { if ( \ strlen ( $ this -> docBlock ) > 0 ) { $ parser = new DocblockParser ( '/' . $ this -> docBlock . '/' ) ; $ this -> parsedDocblock = $ parser -> parse ( ) ; } else { return null ; } } return $ this -> parsedDocblock ; } | Returns the parsed docBlock . |
8,799 | public function addProperty ( ClassProperty $ property ) { if ( isset ( $ this -> properties [ $ property -> getName ( ) ] ) ) { throw new CompilerException ( "Property '" . $ property -> getName ( ) . "' was defined more than one time" , $ property -> getOriginal ( ) ) ; } $ this -> properties [ $ property -> getName ... | Adds a property to the definition . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.