idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
2,000 | public function rootEntry ( ) { $ this -> defaultData ( ) ; if ( \ common_session_SessionManager :: isAnonymous ( ) ) { $ urlRouteService = $ this -> getServiceLocator ( ) -> get ( DefaultUrlService :: SERVICE_ID ) ; $ this -> redirect ( $ urlRouteService -> getLoginUrl ( ) ) ; } else { $ this -> redirect ( _url ( 'ent... | Action used to redirect request made to root of tao . |
2,001 | public function splash ( ) { $ defaultExtIds = array ( 'items' , 'tests' , 'TestTaker' , 'groups' , 'delivery' , 'results' ) ; $ this -> setData ( 'firstTime' , TaoCe :: isFirstTimeInTao ( ) ) ; $ defaultExtensions = array ( ) ; $ additionalExtensions = array ( ) ; foreach ( MenuService :: getPerspectivesByGroup ( Pers... | This action renders the template used by the splash screen popup |
2,002 | public function generateReplacement ( $ replacementId ) { $ replacementMethodName = str_replace ( self :: PREFIX , '' , $ replacementId ) ; if ( strpos ( $ replacementMethodName , '->' ) !== false ) { $ modifierAndMethod = explode ( '->' , $ replacementMethodName ) ; $ modifierName = $ modifierAndMethod [ 0 ] ; $ repla... | wrapper method which removes the prefix calls the defined faker method |
2,003 | private function validateReplacementConfigured ( $ replacementName ) { try { $ this -> faker -> __get ( $ replacementName ) ; } catch ( \ InvalidArgumentException $ exception ) { throw new InvalidReplacementOptionException ( $ replacementName . ' is no valid faker replacement' ) ; } } | validates if this type of replacement was configured |
2,004 | public function merge ( Config $ other ) { $ this -> tables = array_merge ( $ this -> tables , $ other -> getTables ( ) ) ; } | Merge two configurations together . If two configurations specify the same table the last one wins . |
2,005 | public function makeAgent ( $ id , array $ query = null ) { $ end = $ id . '/make_agent' ; return $ this -> api ( ) -> request ( 'GET' , $ this -> endpoint ( $ end ) , null , $ query ) ; } | Convert a contact into an agent |
2,006 | public function view ( $ id , array $ query = null ) { return $ this -> api ( ) -> request ( 'GET' , $ this -> endpoint ( $ id ) , null , $ query ) ; } | View a resource |
2,007 | public function all ( array $ query = null ) { return $ this -> api ( ) -> request ( 'GET' , $ this -> endpoint ( ) , null , $ query ) ; } | Get a list of all agents . |
2,008 | public function restore ( $ id ) { $ end = $ id . '/restore' ; return $ this -> api ( ) -> request ( 'PUT' , $ this -> endpoint ( $ end ) ) ; } | Restore a ticket |
2,009 | public function search ( string $ filtersQuery ) { $ end = '/search' . $ this -> endpoint ( ) ; $ query = [ 'query' => '"' . $ filtersQuery . '"' , ] ; return $ this -> api ( ) -> request ( 'GET' , $ end , null , $ query ) ; } | Filters by ticket fields |
2,010 | public function monitor ( $ id , $ userId ) { $ data = [ 'user_id' => $ userId ] ; return $ this -> api ( ) -> request ( 'POST' , $ this -> endpoint ( $ id . '/follow' ) , $ data ) ; } | Monitor a resource |
2,011 | public static function findDataClass ( $ formType ) { if ( $ dataClass = $ formType -> getConfig ( ) -> getDataClass ( ) ) { return $ dataClass ; } else { if ( $ parent = $ formType -> getParent ( ) ) { return self :: findDataClass ( $ parent ) ; } else { return null ; } } } | Returns the dataClass of the form or its parents if any |
2,012 | private function convertFormToArray ( FormInterface $ data ) { $ form = $ errors = [ ] ; foreach ( $ data -> getErrors ( ) as $ error ) { $ errors [ ] = $ this -> getErrorMessage ( $ error ) ; } if ( $ errors ) { $ form [ 'errors' ] = $ errors ; } $ children = [ ] ; foreach ( $ data -> all ( ) as $ child ) { if ( $ chi... | This code has been taken from JMSSerializer . |
2,013 | public function guessMinLengthForConstraint ( Constraint $ constraint ) { switch ( get_class ( $ constraint ) ) { case 'Symfony\Component\Validator\Constraints\Length' : if ( is_numeric ( $ constraint -> min ) ) { return new ValueGuess ( $ constraint -> min , Guess :: HIGH_CONFIDENCE ) ; } break ; case 'Symfony\Compone... | Guesses a field s minimum length based on the given constraint . |
2,014 | public function withProductRequest ( $ sku , $ qty = 1 , $ request = [ ] ) : CartBuilder { $ result = clone $ this ; $ requestInfo = array_merge ( [ 'qty' => $ qty ] , $ request ) ; $ result -> addToCartRequests [ $ sku ] [ ] = new DataObject ( $ requestInfo ) ; return $ result ; } | Lower - level API to support arbitary products |
2,015 | private function createDateTimeFromStr ( $ dateString , $ ignoreErrors = false ) { if ( ( ! isset ( $ dateString ) || trim ( $ dateString ) === '' ) ) return null ; $ regex = '/' . "(\d{4})(\d{2})(\d{2})?" . "(?:(\d{2})(\d{2})(\d{2}))?" . "(?:\.(\d{3}))?" . "(?:\[(-?\d+)\:(\w{3}\]))?" . '/' ; if ( preg_match ( $ regex ... | Create a DateTime object from a valid OFX date format |
2,016 | private function createAmountFromStr ( $ amountString ) { if ( preg_match ( '/^(-|\+)?([\d,]+)(\.?)([\d]{2})$/' , $ amountString ) === 1 ) { return ( float ) preg_replace ( [ '/([,]+)/' , '/\.?([\d]{2})$/' ] , [ '' , '.$1' ] , $ amountString ) ; } if ( preg_match ( '/^(-|\+)?([\d\.]+,?[\d]{2})$/' , $ amountString ) ===... | Create a formatted number in Float according to different locale options |
2,017 | public function typeDesc ( ) { $ type = ( string ) $ this -> type ; return array_key_exists ( $ type , self :: $ types ) ? self :: $ types [ $ type ] : '' ; } | Get the associated type description |
2,018 | public function codeDesc ( ) { $ code = ( string ) $ this -> code ; return array_key_exists ( $ code , self :: $ codes ) ? self :: $ codes [ $ code ] : '' ; } | Get the associated code description |
2,019 | public function loadFromString ( $ ofxContent ) { $ ofxContent = str_replace ( [ "\r\n" , "\r" ] , "\n" , $ ofxContent ) ; $ ofxContent = utf8_encode ( $ ofxContent ) ; $ ofxContent = $ this -> conditionallyAddNewlines ( $ ofxContent ) ; $ sgmlStart = stripos ( $ ofxContent , '<OFX>' ) ; $ ofxHeader = trim ( substr ( $... | Load an OFX by directly using the text content |
2,020 | private function xmlLoadString ( $ xmlString ) { libxml_clear_errors ( ) ; libxml_use_internal_errors ( true ) ; $ xml = simplexml_load_string ( $ xmlString ) ; if ( $ errors = libxml_get_errors ( ) ) { throw new \ RuntimeException ( 'Failed to parse OFX: ' . var_export ( $ errors , true ) ) ; } return $ xml ; } | Load an XML string without PHP errors - throws exception instead |
2,021 | private function parseHeader ( $ ofxHeader ) { $ header = [ ] ; $ ofxHeader = trim ( $ ofxHeader ) ; $ ofxHeader = preg_replace ( '/^\n+/m' , '' , $ ofxHeader ) ; $ ofxHeaderLines = explode ( "\n" , $ ofxHeader ) ; if ( preg_match ( '/^<\?xml/' , $ ofxHeader ) === 1 ) { $ ofxHeaderLines = preg_replace ( [ '/"/' , '/\?>... | Parse the SGML Header to an Array |
2,022 | private function convertSgmlToXml ( $ sgml ) { $ sgml = preg_replace ( '/&(?!#?[a-z0-9]+;)/' , '&' , $ sgml ) ; $ lines = explode ( "\n" , $ sgml ) ; $ xml = '' ; foreach ( $ lines as $ line ) { $ xml .= trim ( $ this -> closeUnclosedXmlTags ( $ line ) ) . "\n" ; } return trim ( $ xml ) ; } | Convert an SGML to an XML string |
2,023 | protected function checkResponse ( ResponseInterface $ response ) { if ( $ response -> getStatusCode ( ) >= 400 ) { $ message = sprintf ( "Something went wrong when calling Vault (%s - %s)\n%s." , $ response -> getStatusCode ( ) , $ response -> getReasonPhrase ( ) , $ response -> getBody ( ) -> getContents ( ) ) ; if (... | Returns true whenever request should be retried . |
2,024 | public function toBinaryOperationEquivalent ( ) { $ binaryOperator = Assignment :: toBinaryOperator ( $ this -> operator ) ; if ( $ binaryOperator === null ) { return $ this ; } return $ this -> update ( $ this -> assignTo , Assignment :: EQUAL , Expression :: binaryOperation ( $ this -> assignTo , $ binaryOperator , $... | Converts the assignment expression with compound assignment operators to the equivalent assignment and binary operator combination |
2,025 | public static function allowExcessiveArguments ( callable $ function ) { $ reflection = Reflection :: fromCallable ( $ function ) ; if ( $ reflection -> isUserDefined ( ) ) { return $ function ; } if ( Reflection :: isVariadic ( $ reflection ) ) { return $ function ; } $ numberOfArguments = $ reflection -> getNumberOfP... | Returns a wrapper function that will allow the function to be called with excessive number of arguments this is useful for internal function support . Note that references will not be maintained . |
2,026 | public static function hash ( $ value ) { $ typeIdentifier = gettype ( $ value ) [ 0 ] ; switch ( $ typeIdentifier ) { case 's' : return 's' . ( strlen ( $ value ) > 32 ? md5 ( $ value ) : $ value ) ; case 'i' : case 'b' : case 'd' : case 'r' : case 'u' : return $ typeIdentifier . $ value ; case 'N' : return 'N' ; case... | Returns a string representing the supplied value s identity . |
2,027 | public static function toBinaryOperator ( $ assignment ) { return isset ( self :: $ toBinaryOperatorMap [ $ assignment ] ) ? self :: $ toBinaryOperatorMap [ $ assignment ] : null ; } | Returns the equivalent binary operator of the supplied assignment operator or null if there is no equivalent . |
2,028 | public static function doAssignment ( & $ left , $ operator , $ right ) { if ( self :: $ assignments === null ) { self :: $ assignments = [ self :: EQUAL => function ( & $ l , $ r ) { return $ l = $ r ; } , self :: CONCATENATE => function ( & $ l , $ r ) { return $ l .= $ r ; } , self :: BITWISE_AND => function ( & $ l... | Performs the assignment operation on the supplied values . |
2,029 | public static function fromReflection ( \ ReflectionFunctionAbstract $ reflection ) { $ returnsReference = $ reflection -> returnsReference ( ) ; $ name = $ reflection -> getShortName ( ) ; $ parameterExpressions = self :: getParameterExpressionsFromReflection ( $ reflection ) ; if ( $ reflection -> isClosure ( ) ) { r... | Creates a function signature instance from the supplied reflection . |
2,030 | public static function func ( $ returnsReference , $ name , array $ parameterExpressions ) { return new self ( self :: TYPE_FUNCTION , $ returnsReference , null , null , null , $ name , $ parameterExpressions , null ) ; } | Creates a function signature with the supplied parameters . |
2,031 | public static function closure ( $ returnsReference , array $ parameterExpressions , array $ scopedVariableNames ) { return new self ( self :: TYPE_CLOSURE , $ returnsReference , null , null , null , null , $ parameterExpressions , $ scopedVariableNames ) ; } | Creates a closure signature with the supplied parameters . |
2,032 | public static function method ( $ returnsReference , $ accessModifier , $ polymorphModifier , $ isStatic , $ name , array $ parameterExpressions ) { return new self ( self :: TYPE_METHOD , $ returnsReference , $ accessModifier , $ polymorphModifier , $ isStatic , $ name , $ parameterExpressions , null ) ; } | Creates a method signature with the supplied parameters . |
2,033 | final protected static function verifyAll ( array $ expressions , $ type = __CLASS__ ) { foreach ( $ expressions as $ key => $ expression ) { if ( ! ( $ expression instanceof $ type ) ) { throw new PinqException ( 'Invalid array of expressions: invalid expression of type %s at index %s, expecting %s' , Utilities :: get... | Verifies the supplied array only contains expressions of the supplied type . |
2,034 | public function asEvaluator ( IEvaluationContext $ context = null ) { return CompiledEvaluator :: fromExpressions ( [ Expression :: returnExpression ( $ this ) ] , $ context ) ; } | Creates an expression evaluator for the expression with the supplied context . |
2,035 | final public function compileDebug ( ) { return ( new DynamicExpressionWalker ( [ ValueExpression :: getType ( ) => function ( ValueExpression $ expression ) { $ value = $ expression -> getValue ( ) ; return ! is_scalar ( $ value ) && $ value !== null ? Expression :: constant ( '{' . Utilities :: getTypeOrClass ( $ exp... | Compiles the expression tree into debug code . |
2,036 | final public static function allOfType ( array $ expressions , $ type , $ allowNull = false ) { foreach ( $ expressions as $ expression ) { if ( $ expression instanceof $ type || $ expression === null && $ allowNull ) { continue ; } return false ; } return true ; } | Returns whether the expressions are all of the supplied type . |
2,037 | public static function setDirectoryCache ( $ directory , $ fileExtension = DirectoryCache :: DEFAULT_EXTENSION ) { self :: $ cacheImplementation = new DirectoryCache ( $ directory , $ fileExtension ) ; self :: $ hasBeenCleared = false ; } | Uses the supplied directory to store the parsed queries . |
2,038 | public static function setDoctrineCache ( DoctrineCacheProvider $ cache ) { self :: $ cacheImplementation = new DoctrineCache ( $ cache ) ; self :: $ hasBeenCleared = false ; } | Uses the supplied doctrine cache to store the parsed queries . |
2,039 | public static function setArrayAccessCache ( \ ArrayAccess $ cache ) { self :: $ cacheImplementation = new ArrayAccessCacheAdapter ( $ cache ) ; self :: $ hasBeenCleared = false ; } | Uses the supplied array access cache to store the parsed queries . |
2,040 | public function getEvaluationContext ( IResolvedParameterRegistry $ parameters = null ) { $ thisObject = null ; $ variableTable = array_fill_keys ( $ this -> parameterScopedVariableMap , null ) ; unset ( $ variableTable [ 'this' ] ) ; if ( $ parameters !== null ) { foreach ( $ this -> parameterScopedVariableMap as $ pa... | Gets an evaluation context for function with the resolved parameters . |
2,041 | public static function evaluateJoinOptions ( ITraversable $ traversable , Common \ Join \ Options $ join , Queries \ IResolvedParameterRegistry $ resolvedParameters ) { $ values = self :: evaluateSource ( $ join -> getSource ( ) , $ resolvedParameters ) ; $ joiningTraversable = $ join -> isGroupJoin ( ) ? $ traversable... | Evaluates the join segment values and filter upon the supplied traversable . |
2,042 | public static function from ( Queries \ IQuery $ query , IExpressionProcessor $ expressionProcessor ) { if ( $ query instanceof Queries \ IRequestQuery ) { return new RequestQueryProcessor ( $ expressionProcessor , $ query ) ; } elseif ( $ query instanceof Queries \ IOperationQuery ) { return new OperationQueryProcesso... | Builds a query processor from the supplied query . |
2,043 | public static function doCast ( $ castTypeOperator , $ value ) { if ( ! isset ( self :: $ castTypeMap [ $ castTypeOperator ] ) ) { throw new PinqException ( 'Cast operator \'%s\' is not supported' , $ castTypeOperator ) ; } settype ( $ value , self :: $ castTypeMap [ $ castTypeOperator ] ) ; return $ value ; } | Performs the cast operation on the supplied value . |
2,044 | public static function fromReflection ( \ ReflectionFunctionAbstract $ reflection ) { if ( $ reflection instanceof \ ReflectionFunction ) { $ namespace = $ reflection -> getNamespaceName ( ) ; } elseif ( $ reflection instanceof \ ReflectionMethod ) { $ namespace = $ reflection -> getDeclaringClass ( ) -> getNamespaceNa... | Creates a function location instance from the supplied reflection . |
2,045 | protected function flattenComposedTypes ( array $ types ) { $ composedTypes = [ ] ; foreach ( $ types as $ type ) { if ( $ type instanceof ICompositeType ) { $ composedTypes += $ this -> flattenComposedTypes ( $ type -> getComposedTypes ( ) ) ; } else { $ composedTypes [ $ type -> getIdentifier ( ) ] = $ type ; } } ret... | Flattens all the composed types . |
2,046 | public function addExpression ( O \ Expression $ expression , IParameterHasher $ hasher , IFunction $ context = null , $ data = null ) { $ this -> parameters [ ] = new ExpressionParameter ( $ expression , $ hasher , $ context , $ data ) ; } | Adds an expression parameter to the collection . |
2,047 | public function addId ( $ parameterId , IParameterHasher $ hasher , $ data = null ) { $ this -> parameters [ ] = new StandardParameter ( $ parameterId , $ hasher , $ data ) ; } | Adds a standard parameter id to the collection . |
2,048 | public function remove ( IQueryParameter $ parameter ) { foreach ( $ this -> parameters as $ key => $ someParameter ) { if ( $ someParameter === $ parameter ) { unset ( $ this -> parameters [ $ key ] ) ; } } } | Removes a query parameter from the collection . |
2,049 | public static function factory ( ) { $ static = get_called_class ( ) ; return function ( $ callableParameter , $ scopeType , $ namespace , array $ parameterScopedVariableMap , array $ parameterExpressions , array $ bodyExpressions = null ) use ( $ static ) { return new $ static ( $ callableParameter , $ scopeType , $ n... | Gets a callable factory for the function structure . |
2,050 | public static function fromExpressions ( array $ expressions , IEvaluationContext $ context = null ) { $ evaluator = new self ( $ context ) ; $ namespace = $ evaluator -> context -> getNamespace ( ) ; $ contextParameterName = self :: CONTEXT_PARAMETER_NAME ; $ variableTable = $ evaluator -> context -> getVariableTable ... | Creates a new compiled evaluator from the supplied expressions . |
2,051 | final public function walk ( Expression $ expression = null ) { if ( $ expression === null ) { return null ; } return $ this -> doWalk ( $ expression ) ; } | Walks the expression tree and returns the updated expression tree . |
2,052 | public static function from ( $ elements , IIteratorScheme $ scheme = null , Traversable $ source = null ) { return new static ( $ elements , $ scheme , $ source ) ; } | Constructs a new traversable object from the supplied elements . |
2,053 | public static function factory ( IIteratorScheme $ scheme = null , Traversable $ source = null ) { $ static = get_called_class ( ) ; return function ( $ elements ) use ( $ static , $ scheme , $ source ) { return $ static :: from ( $ elements , $ scheme , $ source ) ; } ; } | Returns a callable for the traversable constructor . |
2,054 | private function validateIsOrdered ( $ method ) { $ innerIterator = $ this -> elements ; if ( ! ( $ innerIterator instanceof Iterators \ IOrderedIterator ) ) { throw new PinqException ( 'Invalid call to %s: %s::%s must be called first.' , $ method , __CLASS__ , 'orderBy' ) ; } return $ innerIterator ; } | Verifies that the traversable is ordered . |
2,055 | protected function buildGeneratorWrapper ( ) { foreach ( $ this -> generator as $ key => & $ value ) { yield null ; $ this -> currentKey = $ key ; $ this -> currentValue = & $ value ; } } | hence we should be able to utilise generator in this iterator |
2,056 | public static function fromReflection ( \ ReflectionFunctionAbstract $ reflection , callable $ callable ) { if ( is_array ( $ callable ) ) { $ thisObject = is_object ( $ callable [ 0 ] ) ? $ callable [ 0 ] : null ; $ scopeType = $ reflection -> getDeclaringClass ( ) -> getName ( ) ; } elseif ( is_object ( $ callable ) ... | Creates a function scope instance from the supplied reflection and callable . |
2,057 | public static function doUnaryOperation ( $ operator , & $ value ) { if ( self :: $ unaryOperations === null ) { self :: $ unaryOperations = [ self :: BITWISE_NOT => function ( & $ i ) { return ~ $ i ; } , self :: NOT => function ( & $ i ) { return ! $ i ; } , self :: INCREMENT => function ( & $ i ) { return $ i ++ ; }... | Performs the unary operation on the supplied value . |
2,058 | public function registerTypeDataModule ( ITypeDataModule $ module ) { $ this -> typeDataModules [ ] = $ module ; foreach ( $ module -> functions ( ) as $ name => $ returnType ) { $ normalizedFunctionName = $ this -> normalizeFunctionName ( $ name ) ; $ this -> functionTypeMap [ $ normalizedFunctionName ] = $ returnType... | Adds the type data module to the type system . |
2,059 | protected function newMethodSegment ( $ name , array $ arguments = [ ] ) { return $ this -> provider -> createQueryable ( $ this -> newMethod ( $ name , $ arguments ) ) ; } | Returns a new queryable instance with the supplied query segment appended to the current scope |
2,060 | public static function isValueType ( $ value ) { if ( is_scalar ( $ value ) || $ value === null ) { return true ; } elseif ( is_array ( $ value ) ) { $ isScalar = true ; array_walk_recursive ( $ value , function ( $ value ) use ( & $ isScalar ) { if ( $ isScalar && ! ( is_scalar ( $ value ) || $ value === null ) ) { $ ... | Returns whether the supplied value is a value type . |
2,061 | public static function fromCallable ( callable $ callable ) { $ reflection = Reflection :: fromCallable ( $ callable ) ; return new self ( $ callable , $ reflection , FunctionSignature :: fromReflection ( $ reflection ) , FunctionLocation :: fromReflection ( $ reflection ) , FunctionScope :: fromReflection ( $ reflecti... | Creates a new function reflection instance from the supplied callable . |
2,062 | public function first ( array $ elements , $ amount = 1 ) { $ elements = array_slice ( $ elements , 0 , $ amount ) ; return count ( $ elements ) == 1 ? reset ( $ elements ) : $ elements ; } | Get the first n elements . |
2,063 | public function last ( array $ elements , $ amount = 1 ) { $ elements = array_slice ( $ elements , count ( $ elements ) - $ amount ) ; return count ( $ elements ) == 1 ? reset ( $ elements ) : $ elements ; } | Get the last n elements . |
2,064 | public function unique ( array $ elements , Closure $ iterator = null ) { if ( ! is_null ( $ iterator ) ) { $ elements = array_filter ( $ elements , $ iterator ) ; } else { $ elements = array_unique ( $ elements ) ; } return array_values ( $ elements ) ; } | Remove duplicated values . |
2,065 | public function load ( $ module , $ instance = null ) { if ( ! is_null ( $ instance ) ) { if ( ! $ this -> hasModule ( $ module ) ) { $ this -> addModule ( $ module ) ; } return ( $ this -> instances [ $ module ] = $ instance ) ; } if ( $ this -> hasModule ( $ module ) ) { return ( $ this -> instances [ $ module ] = ne... | Load a module . |
2,066 | public function run ( $ name , array $ arguments = [ ] ) { foreach ( $ this -> getModules ( ) as $ module ) { $ instance = $ this -> getInstance ( $ module ) ; if ( $ this -> hasMethod ( $ instance , $ name ) ) { return call_user_func_array ( [ $ instance , $ name ] , $ arguments ) ; } } throw new BadMethodCallExceptio... | Run a method and return its output . |
2,067 | public function methods ( $ object ) { $ methods = ( new ReflectionClass ( $ object ) ) -> getMethods ( ReflectionMethod :: IS_PUBLIC ) ; $ iterator = function ( ReflectionMethod $ method ) { return $ method -> getName ( ) ; } ; return array_map ( $ iterator , $ methods ) ; } | Get the names of all public methods . |
2,068 | public function get_output ( ) : string { $ output = ( false !== $ this -> args [ 'cache' ] ) ? $ this -> get_cache ( ) : '' ; if ( $ output ) { return $ output ; } ob_start ( ) ; if ( $ this -> has_template ( ) ) { $ this -> load_template ( $ this -> locate_template ( ) ) ; } $ output = ob_get_clean ( ) ; if ( false !... | Gets the output of the template part . |
2,069 | protected function locate_template ( ) : string { if ( isset ( $ this -> template ) ) { return $ this -> template ; } $ templates = [ ] ; if ( ! empty ( $ this -> name ) ) { $ templates [ ] = "{$this->args['dir']}/{$this->slug}-{$this->name}.php" ; } $ templates [ ] = "{$this->args['dir']}/{$this->slug}.php" ; $ this -... | Locate the template part file according to the slug and name . |
2,070 | protected function load_template ( string $ template_file ) { global $ posts , $ post , $ wp_did_header , $ wp_query , $ wp_rewrite , $ wpdb , $ wp_version , $ wp , $ id , $ comment , $ user_ID ; if ( 0 !== validate_file ( $ template_file ) ) { return ; } require $ template_file ; } | Load the template part . |
2,071 | protected function set_cache ( string $ output ) : bool { return set_transient ( $ this -> cache_key ( ) , $ output , $ this -> args [ 'cache' ] ) ; } | Cache the template part output . |
2,072 | public function bindPriorityInterceptor ( AbstractMatcher $ classMatcher , AbstractMatcher $ methodMatcher , array $ interceptors ) { $ pointcut = new PriorityPointcut ( $ classMatcher , $ methodMatcher , $ interceptors ) ; $ this -> container -> addPointcut ( $ pointcut ) ; foreach ( $ interceptors as $ interceptor ) ... | Bind interceptor early |
2,073 | public function rename ( string $ interface , string $ newName , string $ sourceName = Name :: ANY , string $ targetInterface = '' ) { $ targetInterface = $ targetInterface ? : $ interface ; if ( $ this -> lastModule instanceof self ) { $ this -> lastModule -> getContainer ( ) -> move ( $ interface , $ sourceName , $ t... | Rename binding name |
2,074 | public function getNewInstance ( \ ReflectionClass $ class ) : NewInstance { $ setterMethods = new SetterMethods ( [ ] ) ; $ methods = $ class -> getMethods ( ) ; foreach ( $ methods as $ method ) { if ( $ method -> name === '__construct' ) { continue ; } $ setterMethods -> add ( $ this -> injectionMethod -> getSetterM... | Return factory instance |
2,075 | public function invoke ( MethodInvocation $ invocation ) { $ method = $ invocation -> getMethod ( ) ; $ assisted = $ method -> getAnnotation ( Assisted :: class ) ; $ parameters = $ method -> getParameters ( ) ; $ arguments = $ invocation -> getArguments ( ) -> getArrayCopy ( ) ; if ( $ assisted instanceof Assisted && ... | Intercepts any method and injects instances of the missing arguments when they are type hinted |
2,076 | private function getName ( ReflectionMethod $ method , \ ReflectionParameter $ parameter ) : string { $ named = $ method -> getAnnotation ( Named :: class ) ; if ( ! $ named instanceof Named ) { return Name :: ANY ; } parse_str ( $ named -> value , $ names ) ; $ paramName = $ parameter -> getName ( ) ; if ( isset ( $ n... | Return dependency name |
2,077 | public function add ( Bind $ bind ) { $ dependency = $ bind -> getBound ( ) ; $ dependency -> register ( $ this -> container , $ bind ) ; } | Add binding to container |
2,078 | public function getDependency ( string $ index ) { if ( ! isset ( $ this -> container [ $ index ] ) ) { throw $ this -> unbound ( $ index ) ; } $ dependency = $ this -> container [ $ index ] ; return $ dependency -> inject ( $ this ) ; } | Return dependency injected instance |
2,079 | public function move ( string $ sourceInterface , string $ sourceName , string $ targetInterface , string $ targetName ) { $ sourceIndex = $ sourceInterface . '-' . $ sourceName ; if ( ! isset ( $ this -> container [ $ sourceIndex ] ) ) { throw $ this -> unbound ( $ sourceIndex ) ; } $ targetIndex = $ targetInterface .... | Rename existing dependency interface + name |
2,080 | public function unbound ( string $ index ) { list ( $ class , $ name ) = explode ( '-' , $ index ) ; if ( class_exists ( $ class ) && ! ( new \ ReflectionClass ( $ class ) ) -> isAbstract ( ) ) { return new Untargeted ( $ class ) ; } return new Unbound ( "{$class}-{$name}" ) ; } | Return Unbound exception |
2,081 | public function weaveAspects ( CompilerInterface $ compiler ) { foreach ( $ this -> container as $ dependency ) { if ( ! $ dependency instanceof Dependency ) { continue ; } $ dependency -> weaveAspects ( $ compiler , $ this -> pointcuts ) ; } } | Weave aspects to all dependency in container |
2,082 | public function weaveAspect ( Compiler $ compiler , Dependency $ dependency ) : self { $ dependency -> weaveAspects ( $ compiler , $ this -> pointcuts ) ; return $ this ; } | Weave aspect to single dependency |
2,083 | public function to ( string $ class ) : self { $ this -> untarget = null ; $ this -> validate -> to ( $ this -> interface , $ class ) ; $ this -> bound = ( new DependencyFactory ) -> newAnnotatedDependency ( new \ ReflectionClass ( $ class ) ) ; $ this -> container -> add ( $ this ) ; return $ this ; } | Bind to class |
2,084 | public function toConstructor ( string $ class , $ name , InjectionPoints $ injectionPoints = null , string $ postConstruct = null ) : self { if ( \ is_array ( $ name ) ) { $ name = $ this -> getStringName ( $ name ) ; } $ this -> untarget = null ; $ postConstructRef = $ postConstruct ? new \ ReflectionMethod ( $ class... | Bind to constructor |
2,085 | public function toProvider ( string $ provider , string $ context = '' ) : self { $ this -> untarget = null ; $ this -> validate -> toProvider ( $ provider ) ; $ this -> bound = ( new DependencyFactory ) -> newProvider ( new \ ReflectionClass ( $ provider ) , $ context ) ; $ this -> container -> add ( $ this ) ; return... | Bind to provider |
2,086 | public function toInstance ( $ instance ) : self { $ this -> untarget = null ; $ this -> bound = new Instance ( $ instance ) ; $ this -> container -> add ( $ this ) ; return $ this ; } | Bind to instance |
2,087 | public function newAnnotatedDependency ( \ ReflectionClass $ class ) : Dependency { $ annotateClass = new AnnotatedClass ( new AnnotationReader ) ; $ newInstance = $ annotateClass -> getNewInstance ( $ class ) ; $ postConstruct = $ annotateClass -> getPostConstruct ( $ class ) ; return new Dependency ( $ newInstance , ... | Create dependency object |
2,088 | public function newProvider ( \ ReflectionClass $ provider , string $ context ) : DependencyProvider { $ dependency = $ this -> newAnnotatedDependency ( $ provider ) ; return new DependencyProvider ( $ dependency , $ context ) ; } | Create Provider binding |
2,089 | public function newToConstructor ( \ ReflectionClass $ class , string $ name , InjectionPoints $ injectionPoints = null , \ ReflectionMethod $ postConstruct = null ) : Dependency { $ setterMethods = $ injectionPoints ? $ injectionPoints ( $ class -> name ) : new SetterMethods ( [ ] ) ; $ newInstance = new NewInstance (... | Create ToConstructor binding |
2,090 | public function parse ( $ input = null ) { if ( null !== $ input ) { $ this -> reader -> load ( $ input ) ; } return $ this -> readGeometry ( ) ; } | Parse input data |
2,091 | private function readGeometry ( ) { $ this -> srid = null ; try { $ this -> byteOrder = $ this -> readByteOrder ( ) ; $ this -> type = $ this -> readType ( ) ; if ( $ this -> hasFlag ( $ this -> type , self :: WKB_FLAG_SRID ) ) { $ this -> srid = $ this -> readSrid ( ) ; } $ this -> dimensions = $ this -> getDimensions... | Parse geometry data |
2,092 | private function getTypeName ( $ type ) { switch ( $ this -> getTypePrimitive ( $ type ) ) { case ( self :: WKB_TYPE_POINT ) : $ typeName = self :: TYPE_POINT ; break ; case ( self :: WKB_TYPE_LINESTRING ) : $ typeName = self :: TYPE_LINESTRING ; break ; case ( self :: WKB_TYPE_POLYGON ) : $ typeName = self :: TYPE_POL... | Get name of data type |
2,093 | private function multiPoint ( ) { $ values = array ( ) ; $ count = $ this -> readCount ( ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> readByteOrder ( ) ; $ type = $ this -> readType ( ) ; if ( $ this -> getDimensionedPrimitive ( self :: WKB_TYPE_POINT ) !== $ type ) { throw new UnexpectedValueException ( $ ... | Parse MULTIPOINT value |
2,094 | private function multiLineString ( ) { $ values = array ( ) ; $ count = $ this -> readCount ( ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> readByteOrder ( ) ; $ type = $ this -> readType ( ) ; if ( $ this -> getDimensionedPrimitive ( self :: WKB_TYPE_LINESTRING ) !== $ type ) { throw new UnexpectedValueExce... | Parse MULTILINESTRING value |
2,095 | private function multiPolygon ( ) { $ count = $ this -> readCount ( ) ; $ values = array ( ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> readByteOrder ( ) ; $ type = $ this -> readType ( ) ; if ( $ this -> getDimensionedPrimitive ( self :: WKB_TYPE_POLYGON ) !== $ type ) { throw new UnexpectedValueException ... | Parse MULTIPOLYGON value |
2,096 | private function compoundCurve ( ) { $ values = array ( ) ; $ count = $ this -> readCount ( ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> readByteOrder ( ) ; $ type = $ this -> readType ( ) ; switch ( $ type ) { case ( $ this -> getDimensionedPrimitive ( self :: WKB_TYPE_LINESTRING ) ) : case ( $ this -> get... | Parse COMPOUNDCURVE value |
2,097 | private function multiSurface ( ) { $ values = array ( ) ; $ count = $ this -> readCount ( ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> readByteOrder ( ) ; $ type = $ this -> readType ( ) ; switch ( $ type ) { case ( $ this -> getDimensionedPrimitive ( self :: WKB_TYPE_POLYGON ) ) : $ value = $ this -> poly... | Parse MULTISURFACE value |
2,098 | private function polyhedralSurface ( ) { $ values = array ( ) ; $ count = $ this -> readCount ( ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> readByteOrder ( ) ; $ type = $ this -> readType ( ) ; switch ( $ type ) { case ( $ this -> getDimensionedPrimitive ( self :: WKB_TYPE_POLYGON ) ) : $ value = $ this ->... | Parse POLYHEDRALSURFACE value |
2,099 | private function geometryCollection ( ) { $ values = array ( ) ; $ count = $ this -> readCount ( ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> readByteOrder ( ) ; $ type = $ this -> readType ( ) ; $ typeName = $ this -> getTypeName ( $ type ) ; $ values [ ] = array ( 'type' => $ typeName , 'value' => $ this ... | Parse GEOMETRYCOLLECTION value |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.