idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
22,000 | public function getEnvCounters ( ) { $ bag = $ this -> getParameterBag ( ) ; $ envPlaceholders = $ bag instanceof EnvPlaceholderParameterBag ? $ bag -> getEnvPlaceholders ( ) : $ this -> envPlaceholders ; foreach ( $ envPlaceholders as $ env => $ placeholders ) { if ( ! isset ( $ this -> envCounters [ $ env ] ) ) { $ t... | Get statistics about env usage . |
22,001 | public function removeBindings ( $ id ) { if ( $ this -> hasDefinition ( $ id ) ) { foreach ( $ this -> getDefinition ( $ id ) -> getBindings ( ) as $ key => $ binding ) { list ( , $ bindingId ) = $ binding -> getValues ( ) ; $ this -> removedBindingIds [ ( int ) $ bindingId ] = true ; } } } | Removes bindings for a service . |
22,002 | protected function mergePasswordAndSalt ( $ password , $ salt ) { if ( empty ( $ salt ) ) { return $ password ; } if ( false !== strrpos ( $ salt , '{' ) || false !== strrpos ( $ salt , '}' ) ) { throw new \ InvalidArgumentException ( 'Cannot use { or } in salt.' ) ; } return $ password . '{' . $ salt . '}' ; } | Merges a password and a salt . |
22,003 | private function getRoles ( UserInterface $ user , TokenInterface $ token ) { $ roles = $ user -> getRoles ( ) ; foreach ( $ token -> getRoles ( false ) as $ role ) { if ( $ role instanceof SwitchUserRole ) { $ roles [ ] = $ role ; break ; } } return $ roles ; } | Retrieves roles from user and appends SwitchUserRole if original token contained one . |
22,004 | public function overload ( string $ path , string ... $ extraPaths ) : void { $ this -> doLoad ( true , \ func_get_args ( ) ) ; } | Loads one or several . env files and enables override existing vars . |
22,005 | public function parse ( string $ data , string $ path = '.env' ) : array { $ this -> path = $ path ; $ this -> data = str_replace ( [ "\r\n" , "\r" ] , "\n" , $ data ) ; $ this -> lineno = 1 ; $ this -> cursor = 0 ; $ this -> end = \ strlen ( $ this -> data ) ; $ state = self :: STATE_VARNAME ; $ this -> values = [ ] ;... | Parses the contents of an . env file . |
22,006 | public function get ( $ id ) { foreach ( $ this -> children as $ child ) { if ( $ id === $ child -> getId ( ) ) { return $ child ; } } } | Returns the child section . |
22,007 | public function open ( $ id ) { if ( null === $ session = $ this -> get ( $ id ) ) { $ session = $ this -> children [ ] = new self ( microtime ( true ) * 1000 , $ this -> morePrecision ) ; } return $ session ; } | Creates or re - opens a child section . |
22,008 | public function isEventStarted ( $ name ) { return isset ( $ this -> events [ $ name ] ) && $ this -> events [ $ name ] -> isStarted ( ) ; } | Checks if the event was started . |
22,009 | public function stopEvent ( $ name ) { if ( ! isset ( $ this -> events [ $ name ] ) ) { throw new \ LogicException ( sprintf ( 'Event "%s" is not started.' , $ name ) ) ; } return $ this -> events [ $ name ] -> stop ( ) ; } | Stops an event . |
22,010 | public function getEvent ( $ name ) { if ( ! isset ( $ this -> events [ $ name ] ) ) { throw new \ LogicException ( sprintf ( 'Event "%s" is not known.' , $ name ) ) ; } return $ this -> events [ $ name ] ; } | Returns a specific event by name . |
22,011 | public function setData ( $ data = [ ] ) { try { $ data = json_encode ( $ data , $ this -> encodingOptions ) ; } catch ( \ Exception $ e ) { if ( 'Exception' === \ get_class ( $ e ) && 0 === strpos ( $ e -> getMessage ( ) , 'Failed calling ' ) ) { throw $ e -> getPrevious ( ) ? : $ e ; } throw $ e ; } if ( JSON_ERROR_N... | Sets the data to be sent as JSON . |
22,012 | public function getClickedButton ( ) { if ( $ this -> clickedButton ) { return $ this -> clickedButton ; } if ( $ this -> parent && method_exists ( $ this -> parent , 'getClickedButton' ) ) { return $ this -> parent -> getClickedButton ( ) ; } } | Returns the button that was used to submit the form . |
22,013 | private function normToModel ( $ value ) { try { $ transformers = $ this -> config -> getModelTransformers ( ) ; for ( $ i = \ count ( $ transformers ) - 1 ; $ i >= 0 ; -- $ i ) { $ value = $ transformers [ $ i ] -> reverseTransform ( $ value ) ; } } catch ( TransformationFailedException $ exception ) { throw new Trans... | Reverse transforms a value if a model transformer is set . |
22,014 | private function normToView ( $ value ) { if ( ! ( $ transformers = $ this -> config -> getViewTransformers ( ) ) && ! $ this -> config -> getCompound ( ) ) { return null === $ value || is_scalar ( $ value ) ? ( string ) $ value : $ value ; } try { foreach ( $ transformers as $ transformer ) { $ value = $ transformer -... | Transforms the value if a view transformer is set . |
22,015 | private function viewToNorm ( $ value ) { if ( ! $ transformers = $ this -> config -> getViewTransformers ( ) ) { return '' === $ value ? null : $ value ; } try { for ( $ i = \ count ( $ transformers ) - 1 ; $ i >= 0 ; -- $ i ) { $ value = $ transformers [ $ i ] -> reverseTransform ( $ value ) ; } } catch ( Transformat... | Reverse transforms a value if a view transformer is set . |
22,016 | private function createPasswordQuestion ( ) : Question { $ passwordQuestion = new Question ( 'Type in your password to be encoded' ) ; return $ passwordQuestion -> setValidator ( function ( $ value ) { if ( '' === trim ( $ value ) ) { throw new InvalidArgumentException ( 'The password must not be empty.' ) ; } return $... | Create the password question to ask the user for the password to be encoded . |
22,017 | public function add ( FormField $ field ) { $ segments = $ this -> getSegments ( $ field -> getName ( ) ) ; $ target = & $ this -> fields ; while ( $ segments ) { if ( ! \ is_array ( $ target ) ) { $ target = [ ] ; } $ path = array_shift ( $ segments ) ; if ( '' === $ path ) { $ target = & $ target [ ] ; } else { $ tar... | Adds a field to the registry . |
22,018 | private static function create ( $ base , array $ values ) { $ registry = new static ( ) ; $ registry -> base = $ base ; $ registry -> fields = $ values ; return $ registry ; } | Creates an instance of the class . |
22,019 | private function getSegments ( $ name ) { if ( preg_match ( '/^(?P<base>[^[]+)(?P<extra>(\[.*)|$)/' , $ name , $ m ) ) { $ segments = [ $ m [ 'base' ] ] ; while ( ! empty ( $ m [ 'extra' ] ) ) { $ extra = $ m [ 'extra' ] ; if ( preg_match ( '/^\[(?P<segment>.*?)\](?P<extra>.*)$/' , $ extra , $ m ) ) { $ segments [ ] = ... | Splits a field name into segments as a web browser would do . |
22,020 | public function addCasters ( array $ casters ) { foreach ( $ casters as $ type => $ callback ) { $ closure = & $ this -> casters [ $ type ] [ ] ; $ closure = $ callback instanceof \ Closure ? $ callback : static function ( ... $ args ) use ( $ callback , & $ closure ) { return ( $ closure = \ Closure :: fromCallable ( ... | Adds casters for resources and objects . |
22,021 | public function cloneVar ( $ var , $ filter = 0 ) { $ this -> prevErrorHandler = set_error_handler ( function ( $ type , $ msg , $ file , $ line , $ context = [ ] ) { if ( E_RECOVERABLE_ERROR === $ type || E_USER_ERROR === $ type ) { throw new \ ErrorException ( $ msg , 0 , $ type , $ file , $ line ) ; } if ( $ this ->... | Clones a PHP variable . |
22,022 | protected function loadSession ( array & $ session = null ) { if ( null === $ session ) { $ session = & $ _SESSION ; } $ bags = array_merge ( $ this -> bags , [ $ this -> metadataBag ] ) ; foreach ( $ bags as $ bag ) { $ key = $ bag -> getStorageKey ( ) ; $ session [ $ key ] = isset ( $ session [ $ key ] ) ? $ session ... | Load the session with attributes . |
22,023 | public function hasPlaceholder ( ) { if ( $ this -> preferredChoices ) { $ firstChoice = reset ( $ this -> preferredChoices ) ; return $ firstChoice instanceof ChoiceView && '' === $ firstChoice -> value ; } $ firstChoice = reset ( $ this -> choices ) ; return $ firstChoice instanceof ChoiceView && '' === $ firstChoice... | Returns whether a placeholder is in the choices . |
22,024 | public function getTtl ( ) : ? int { $ maxAge = $ this -> getMaxAge ( ) ; return null !== $ maxAge ? $ maxAge - $ this -> getAge ( ) : null ; } | Returns the response s time - to - live in seconds . |
22,025 | private function createNewLock ( string $ node , string $ value ) { $ acl = [ [ 'perms' => \ Zookeeper :: PERM_ALL , 'scheme' => 'world' , 'id' => 'anyone' ] ] ; $ type = \ Zookeeper :: EPHEMERAL ; try { $ this -> zookeeper -> create ( $ node , $ value , $ acl , $ type ) ; } catch ( \ ZookeeperException $ ex ) { if ( \... | Creates a zookeeper node . |
22,026 | public static function createSystemCache ( $ namespace , $ defaultLifetime , $ version , $ directory , LoggerInterface $ logger = null ) { $ opcache = new PhpFilesAdapter ( $ namespace , $ defaultLifetime , $ directory , true ) ; if ( null !== $ logger ) { $ opcache -> setLogger ( $ logger ) ; } if ( ! self :: $ apcuSu... | Returns the best possible adapter that your runtime supports . |
22,027 | public function validate ( $ value , Constraint $ constraint ) { if ( ! $ constraint instanceof Luhn ) { throw new UnexpectedTypeException ( $ constraint , __NAMESPACE__ . '\Luhn' ) ; } if ( null === $ value || '' === $ value ) { return ; } if ( ! \ is_string ( $ value ) && ! ( \ is_object ( $ value ) && method_exists ... | Validates a credit card number with the Luhn algorithm . |
22,028 | public function createTable ( ) : void { $ conn = $ this -> getConnection ( ) ; $ driver = $ this -> getDriver ( ) ; if ( $ conn instanceof Connection ) { $ schema = new Schema ( ) ; $ table = $ schema -> createTable ( $ this -> table ) ; $ table -> addColumn ( $ this -> idCol , 'string' , [ 'length' => 64 ] ) ; $ tabl... | Creates the table to store lock keys which can be called once for setup . |
22,029 | public function link ( $ uri , $ rel , array $ attributes = [ ] ) { if ( ! $ request = $ this -> requestStack -> getMasterRequest ( ) ) { return $ uri ; } $ link = new Link ( $ rel , $ uri ) ; foreach ( $ attributes as $ key => $ value ) { $ link = $ link -> withAttribute ( $ key , $ value ) ; } $ linkProvider = $ requ... | Adds a Link HTTP header . |
22,030 | public function isIndirect ( ) { $ erroringFile = $ erroringPackage = null ; foreach ( $ this -> trace as $ line ) { if ( \ in_array ( $ line [ 'function' ] , [ 'require' , 'require_once' , 'include' , 'include_once' ] , true ) ) { continue ; } if ( ! isset ( $ line [ 'file' ] ) ) { continue ; } $ file = $ line [ 'file... | Tells whether both the calling package and the called package are vendor packages . |
22,031 | public function start ( $ name ) { if ( \ in_array ( $ name , $ this -> openSlots ) ) { throw new \ InvalidArgumentException ( sprintf ( 'A slot named "%s" is already started.' , $ name ) ) ; } $ this -> openSlots [ ] = $ name ; $ this -> slots [ $ name ] = '' ; ob_start ( ) ; ob_implicit_flush ( 0 ) ; } | Starts a new slot . |
22,032 | public function stop ( ) { if ( ! $ this -> openSlots ) { throw new \ LogicException ( 'No slot started.' ) ; } $ name = array_pop ( $ this -> openSlots ) ; $ this -> slots [ $ name ] = ob_get_clean ( ) ; } | Stops a slot . |
22,033 | public function get ( $ name , $ default = false ) { return isset ( $ this -> slots [ $ name ] ) ? $ this -> slots [ $ name ] : $ default ; } | Gets the slot value . |
22,034 | public function output ( $ name , $ default = false ) { if ( ! isset ( $ this -> slots [ $ name ] ) ) { if ( false !== $ default ) { echo $ default ; return true ; } return false ; } echo $ this -> slots [ $ name ] ; return true ; } | Outputs a slot . |
22,035 | public function guessMaxLengthForConstraint ( Constraint $ constraint ) { switch ( \ get_class ( $ constraint ) ) { case 'Symfony\Component\Validator\Constraints\Length' : if ( is_numeric ( $ constraint -> max ) ) { return new ValueGuess ( $ constraint -> max , Guess :: HIGH_CONFIDENCE ) ; } break ; case 'Symfony\Compo... | Guesses a field s maximum length based on the given constraint . |
22,036 | public function guessPatternForConstraint ( Constraint $ constraint ) { switch ( \ get_class ( $ constraint ) ) { case 'Symfony\Component\Validator\Constraints\Length' : if ( is_numeric ( $ constraint -> min ) ) { return new ValueGuess ( sprintf ( '.{%s,}' , ( string ) $ constraint -> min ) , Guess :: LOW_CONFIDENCE ) ... | Guesses a field s pattern based on the given constraint . |
22,037 | public function onKernelResponse ( FilterResponseEvent $ event ) { if ( ! $ event -> isMasterRequest ( ) ) { return ; } $ request = $ event -> getRequest ( ) ; if ( ! $ request -> hasSession ( ) ) { return ; } $ this -> dispatcher -> removeListener ( KernelEvents :: RESPONSE , [ $ this , 'onKernelResponse' ] ) ; $ this... | Writes the security token into the session . |
22,038 | protected function refreshUser ( TokenInterface $ token ) { $ user = $ token -> getUser ( ) ; if ( ! $ user instanceof UserInterface ) { return $ token ; } $ userNotFoundByProvider = false ; $ userDeauthenticated = false ; foreach ( $ this -> userProviders as $ provider ) { if ( ! $ provider instanceof UserProviderInte... | Refreshes the user by reloading it from the user provider . |
22,039 | public function addHelpers ( array $ helpers ) { foreach ( $ helpers as $ alias => $ helper ) { $ this -> set ( $ helper , \ is_int ( $ alias ) ? null : $ alias ) ; } } | Adds some helpers . |
22,040 | public function escape ( $ value , $ context = 'html' ) { if ( is_numeric ( $ value ) ) { return $ value ; } if ( is_scalar ( $ value ) ) { if ( ! isset ( self :: $ escaperCache [ $ context ] [ $ value ] ) ) { self :: $ escaperCache [ $ context ] [ $ value ] = $ this -> getEscaper ( $ context ) ( $ value ) ; } return s... | Escapes a string by using the current charset . |
22,041 | public function setCharset ( $ charset ) { if ( 'UTF8' === $ charset = strtoupper ( $ charset ) ) { $ charset = 'UTF-8' ; } $ this -> charset = $ charset ; foreach ( $ this -> helpers as $ helper ) { $ helper -> setCharset ( $ this -> charset ) ; } } | Sets the charset to use . |
22,042 | public function setEscaper ( $ context , callable $ escaper ) { $ this -> escapers [ $ context ] = $ escaper ; self :: $ escaperCache [ $ context ] = [ ] ; } | Adds an escaper for the given context . |
22,043 | public function getEscaper ( $ context ) { if ( ! isset ( $ this -> escapers [ $ context ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'No registered escaper for context "%s".' , $ context ) ) ; } return $ this -> escapers [ $ context ] ; } | Gets an escaper for a given context . |
22,044 | protected function initializeEscapers ( ) { $ flags = ENT_QUOTES | ENT_SUBSTITUTE ; $ this -> escapers = [ 'html' => function ( $ value ) use ( $ flags ) { return \ is_string ( $ value ) ? htmlspecialchars ( $ value , $ flags , $ this -> getCharset ( ) , false ) : $ value ; } , 'js' => function ( $ value ) { if ( 'UTF-... | Initializes the built - in escapers . |
22,045 | public function setArguments ( $ arguments = [ ] ) { $ this -> arguments = [ ] ; $ this -> requiredCount = 0 ; $ this -> hasOptional = false ; $ this -> hasAnArrayArgument = false ; $ this -> addArguments ( $ arguments ) ; } | Sets the InputArgument objects . |
22,046 | public function addArguments ( $ arguments = [ ] ) { if ( null !== $ arguments ) { foreach ( $ arguments as $ argument ) { $ this -> addArgument ( $ argument ) ; } } } | Adds an array of InputArgument objects . |
22,047 | public function getArgument ( $ name ) { if ( ! $ this -> hasArgument ( $ name ) ) { throw new InvalidArgumentException ( sprintf ( 'The "%s" argument does not exist.' , $ name ) ) ; } $ arguments = \ is_int ( $ name ) ? array_values ( $ this -> arguments ) : $ this -> arguments ; return $ arguments [ $ name ] ; } | Returns an InputArgument by name or by position . |
22,048 | public function getArgumentDefaults ( ) { $ values = [ ] ; foreach ( $ this -> arguments as $ argument ) { $ values [ $ argument -> getName ( ) ] = $ argument -> getDefault ( ) ; } return $ values ; } | Gets the default values . |
22,049 | public function shortcutToName ( $ shortcut ) { if ( ! isset ( $ this -> shortcuts [ $ shortcut ] ) ) { throw new InvalidArgumentException ( sprintf ( 'The "-%s" option does not exist.' , $ shortcut ) ) ; } return $ this -> shortcuts [ $ shortcut ] ; } | Returns the InputOption name given a shortcut . |
22,050 | public function contains ( $ key , $ value ) { return \ in_array ( $ value , $ this -> get ( $ key , null , false ) ) ; } | Returns true if the given HTTP header contains the given value . |
22,051 | protected function getAttributes ( $ object , $ format = null , array $ context ) { $ class = $ this -> objectClassResolver ? ( $ this -> objectClassResolver ) ( $ object ) : \ get_class ( $ object ) ; $ key = $ class . '-' . $ context [ 'cache_key' ] ; if ( isset ( $ this -> attributesCache [ $ key ] ) ) { return $ th... | Gets and caches attributes for the given object format and context . |
22,052 | public function setMaxDepthHandler ( ? callable $ handler ) : void { @ trigger_error ( sprintf ( 'The "%s()" method is deprecated since Symfony 4.2, use the "max_depth_handler" key of the context instead.' , __METHOD__ ) , E_USER_DEPRECATED ) ; $ this -> maxDepthHandler = $ handler ; } | Sets a handler function that will be called when the max depth is reached . |
22,053 | private function validateAndDenormalize ( string $ currentClass , string $ attribute , $ data , ? string $ format , array $ context ) { if ( null === $ types = $ this -> getTypes ( $ currentClass , $ attribute ) ) { return $ data ; } $ expectedTypes = [ ] ; foreach ( $ types as $ type ) { if ( null === $ data && $ type... | Validates the submitted data and denormalizes it . |
22,054 | private function isMaxDepthReached ( array $ attributesMetadata , string $ class , string $ attribute , array & $ context ) : bool { $ enableMaxDepth = $ context [ self :: ENABLE_MAX_DEPTH ] ?? $ this -> defaultContext [ self :: ENABLE_MAX_DEPTH ] ?? false ; if ( ! $ enableMaxDepth || ! isset ( $ attributesMetadata [ $... | Is the max depth reached for the given attribute? |
22,055 | protected function createChildContext ( array $ parentContext , $ attribute ) { if ( \ func_num_args ( ) >= 3 ) { $ format = \ func_get_arg ( 2 ) ; } else { $ format = null ; } $ context = parent :: createChildContext ( $ parentContext , $ attribute , $ format ) ; $ context [ 'cache_key' ] = $ this -> getCacheKey ( $ f... | Overwritten to update the cache key for the child . |
22,056 | private function getCacheKey ( ? string $ format , array $ context ) { foreach ( $ context [ self :: EXCLUDE_FROM_CACHE_KEY ] ?? $ this -> defaultContext [ self :: EXCLUDE_FROM_CACHE_KEY ] as $ key ) { unset ( $ context [ $ key ] ) ; } unset ( $ context [ self :: EXCLUDE_FROM_CACHE_KEY ] ) ; unset ( $ context [ 'cache_... | Builds the cache key for the attributes cache . |
22,057 | public function getPackage ( $ name = null ) { if ( null === $ name ) { if ( null === $ this -> defaultPackage ) { throw new LogicException ( 'There is no default asset package, configure one first.' ) ; } return $ this -> defaultPackage ; } if ( ! isset ( $ this -> packages [ $ name ] ) ) { throw new InvalidArgumentEx... | Returns an asset package . |
22,058 | public function transform ( $ dateTime ) { if ( null === $ dateTime ) { return '' ; } if ( ! $ dateTime instanceof \ DateTimeInterface ) { throw new TransformationFailedException ( 'Expected a \DateTimeInterface.' ) ; } if ( ! $ dateTime instanceof \ DateTimeImmutable ) { $ dateTime = clone $ dateTime ; } $ dateTime = ... | Transforms a DateTime object into a date string with the configured format and timezone . |
22,059 | private function matchChild ( FormInterface $ form , PropertyPathIteratorInterface $ it ) { $ target = null ; $ chunk = '' ; $ foundAtIndex = null ; $ rules = [ ] ; foreach ( $ form -> getConfig ( ) -> getOption ( 'error_mapping' ) as $ propertyPath => $ targetPath ) { if ( '.' !== $ propertyPath ) { $ rules [ ] = new ... | Tries to match the beginning of the property path at the current position against the children of the scope . |
22,060 | private function reconstructPath ( ViolationPath $ violationPath , FormInterface $ origin ) { $ propertyPathBuilder = new PropertyPathBuilder ( $ violationPath ) ; $ it = $ violationPath -> getIterator ( ) ; $ scope = $ origin ; $ i = 0 ; for ( $ it -> rewind ( ) ; $ it -> valid ( ) && $ it -> mapsForm ( ) ; $ it -> ne... | Reconstructs a property path from a violation path and a form tree . |
22,061 | public function logout ( Request $ request , Response $ response , TokenInterface $ token ) { foreach ( $ this -> cookies as $ cookieName => $ cookieData ) { $ response -> headers -> clearCookie ( $ cookieName , $ cookieData [ 'path' ] , $ cookieData [ 'domain' ] ) ; } } | Implementation for the LogoutHandlerInterface . Deletes all requested cookies . |
22,062 | public function start ( $ message ) { if ( $ this -> started ) { throw new LogicException ( 'Progress indicator already started.' ) ; } $ this -> message = $ message ; $ this -> started = true ; $ this -> startTime = time ( ) ; $ this -> indicatorUpdateTime = $ this -> getCurrentTimeInMilliseconds ( ) + $ this -> indic... | Starts the indicator output . |
22,063 | public function advance ( ) { if ( ! $ this -> started ) { throw new LogicException ( 'Progress indicator has not yet been started.' ) ; } if ( ! $ this -> output -> isDecorated ( ) ) { return ; } $ currentTime = $ this -> getCurrentTimeInMilliseconds ( ) ; if ( $ currentTime < $ this -> indicatorUpdateTime ) { return ... | Advances the indicator . |
22,064 | public function finish ( $ message ) { if ( ! $ this -> started ) { throw new LogicException ( 'Progress indicator has not yet been started.' ) ; } $ this -> message = $ message ; $ this -> display ( ) ; $ this -> output -> writeln ( '' ) ; $ this -> started = false ; } | Finish the indicator with message . |
22,065 | public static function popSessionCookie ( string $ sessionName , string $ sessionId ) : ? string { $ sessionCookie = null ; $ sessionCookiePrefix = sprintf ( ' %s=' , urlencode ( $ sessionName ) ) ; $ sessionCookieWithId = sprintf ( '%s%s;' , $ sessionCookiePrefix , urlencode ( $ sessionId ) ) ; $ otherCookies = [ ] ; ... | Finds the session header amongst the headers that are to be sent removes it and returns it so the caller can process it further . |
22,066 | private function make ( string $ id , int $ invalidBehavior ) { if ( isset ( $ this -> loading [ $ id ] ) ) { throw new ServiceCircularReferenceException ( $ id , array_merge ( array_keys ( $ this -> loading ) , [ $ id ] ) ) ; } $ this -> loading [ $ id ] = true ; try { if ( isset ( $ this -> fileMap [ $ id ] ) ) { ret... | Creates a service . |
22,067 | public static function singularize ( string $ plural ) { $ pluralRev = strrev ( $ plural ) ; $ lowerPluralRev = strtolower ( $ pluralRev ) ; $ pluralLength = \ strlen ( $ lowerPluralRev ) ; if ( \ in_array ( $ lowerPluralRev , self :: $ uninflected , true ) ) { return $ plural ; } foreach ( self :: $ pluralMap as $ map... | Returns the singular form of a word . |
22,068 | public static function pluralize ( string $ singular ) { $ singularRev = strrev ( $ singular ) ; $ lowerSingularRev = strtolower ( $ singularRev ) ; $ singularLength = \ strlen ( $ lowerSingularRev ) ; if ( \ in_array ( $ lowerSingularRev , self :: $ uninflected , true ) ) { return $ singular ; } foreach ( self :: $ si... | Returns the plural form of a word . |
22,069 | private function determineSymfonyState ( ) { $ now = new \ DateTime ( ) ; $ eom = \ DateTime :: createFromFormat ( 'm/Y' , Kernel :: END_OF_MAINTENANCE ) -> modify ( 'last day of this month' ) ; $ eol = \ DateTime :: createFromFormat ( 'm/Y' , Kernel :: END_OF_LIFE ) -> modify ( 'last day of this month' ) ; if ( $ now ... | Tries to retrieve information about the current Symfony version . |
22,070 | private function extractXliff1 ( \ DOMDocument $ dom , MessageCatalogue $ catalogue , string $ domain ) { $ xml = simplexml_import_dom ( $ dom ) ; $ encoding = strtoupper ( $ dom -> encoding ) ; $ namespace = 'urn:oasis:names:tc:xliff:document:1.2' ; $ xml -> registerXPathNamespace ( 'xliff' , $ namespace ) ; foreach (... | Extract messages and metadata from DOMDocument into a MessageCatalogue . |
22,071 | public function setAutoEtag ( ) { $ this -> setEtag ( base64_encode ( hash_file ( 'sha256' , $ this -> file -> getPathname ( ) , true ) ) ) ; return $ this ; } | Automatically sets the ETag header according to the checksum of the file . |
22,072 | protected function processValue ( $ value , $ isRoot = false ) { if ( \ is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { if ( $ isRoot ) { $ this -> currentId = $ k ; } if ( $ v !== $ processedValue = $ this -> processValue ( $ v , $ isRoot ) ) { $ value [ $ k ] = $ processedValue ; } } } elseif ( $ value i... | Processes a value found in a definition tree . |
22,073 | public function getSession ( ) { if ( null === $ this -> requestStack ) { throw new \ RuntimeException ( 'The "app.session" variable is not available.' ) ; } if ( $ request = $ this -> getRequest ( ) ) { return $ request -> getSession ( ) ; } } | Returns the current session . |
22,074 | public function disableBackup ( ) { @ trigger_error ( sprintf ( 'The "%s()" method is deprecated since Symfony 4.1.' , __METHOD__ ) , E_USER_DEPRECATED ) ; foreach ( $ this -> dumpers as $ dumper ) { if ( method_exists ( $ dumper , 'setBackup' ) ) { $ dumper -> setBackup ( false ) ; } } } | Disables dumper backup . |
22,075 | public function write ( MessageCatalogue $ catalogue , $ format , $ options = [ ] ) { if ( ! isset ( $ this -> dumpers [ $ format ] ) ) { throw new InvalidArgumentException ( sprintf ( 'There is no dumper associated with format "%s".' , $ format ) ) ; } $ dumper = $ this -> dumpers [ $ format ] ; if ( isset ( $ options... | Writes translation from the catalogue according to the selected format . |
22,076 | public function getBaseUrl ( $ path ) { if ( 1 === \ count ( $ this -> baseUrls ) ) { return $ this -> baseUrls [ 0 ] ; } return $ this -> baseUrls [ $ this -> chooseBaseUrl ( $ path ) ] ; } | Returns the base URL for a path . |
22,077 | protected function chooseBaseUrl ( $ path ) { return ( int ) fmod ( hexdec ( substr ( hash ( 'sha256' , $ path ) , 0 , 10 ) ) , \ count ( $ this -> baseUrls ) ) ; } | Determines which base URL to use for the given path . |
22,078 | protected function cloneVar ( $ var ) { if ( $ var instanceof Data ) { return $ var ; } if ( null === $ this -> cloner ) { if ( ! class_exists ( CutStub :: class ) ) { throw new \ LogicException ( sprintf ( 'The VarDumper component is needed for the %s() method. Install symfony/var-dumper version 3.4 or above.' , __MET... | Converts the variable into a serializable Data instance . |
22,079 | public function setHorizontalBorderChars ( string $ outside , string $ inside = null ) : self { $ this -> horizontalOutsideBorderChar = $ outside ; $ this -> horizontalInsideBorderChar = $ inside ?? $ outside ; return $ this ; } | Sets horizontal border characters . |
22,080 | public function setHorizontalBorderChar ( $ horizontalBorderChar ) { @ trigger_error ( sprintf ( 'The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.' , __METHOD__ ) , E_USER_DEPRECATED ) ; return $ this -> setHorizontalBorderChars ( $ horizontalBorderChar , $ horizontalBorderChar... | Sets horizontal border character . |
22,081 | public function setVerticalBorderChars ( string $ outside , string $ inside = null ) : self { $ this -> verticalOutsideBorderChar = $ outside ; $ this -> verticalInsideBorderChar = $ inside ?? $ outside ; return $ this ; } | Sets vertical border characters . |
22,082 | public function setVerticalBorderChar ( $ verticalBorderChar ) { @ trigger_error ( sprintf ( 'The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.' , __METHOD__ ) , E_USER_DEPRECATED ) ; return $ this -> setVerticalBorderChars ( $ verticalBorderChar , $ verticalBorderChar ) ; } | Sets vertical border character . |
22,083 | public function setCrossingChars ( string $ cross , string $ topLeft , string $ topMid , string $ topRight , string $ midRight , string $ bottomRight , string $ bottomMid , string $ bottomLeft , string $ midLeft , string $ topLeftBottom = null , string $ topMidBottom = null , string $ topRightBottom = null ) : self { $... | Sets crossing characters . |
22,084 | public function setDefaultCrossingChar ( string $ char ) : self { return $ this -> setCrossingChars ( $ char , $ char , $ char , $ char , $ char , $ char , $ char , $ char , $ char ) ; } | Sets default crossing character used for each cross . |
22,085 | public function getCrossingChars ( ) : array { return [ $ this -> crossingChar , $ this -> crossingTopLeftChar , $ this -> crossingTopMidChar , $ this -> crossingTopRightChar , $ this -> crossingMidRightChar , $ this -> crossingBottomRightChar , $ this -> crossingBottomMidChar , $ this -> crossingBottomLeftChar , $ thi... | Gets crossing characters . |
22,086 | public function setPadType ( $ padType ) { if ( ! \ in_array ( $ padType , [ STR_PAD_LEFT , STR_PAD_RIGHT , STR_PAD_BOTH ] , true ) ) { throw new InvalidArgumentException ( 'Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).' ) ; } $ this -> padType = $ padType ; return $ this ; } | Sets cell padding type . |
22,087 | private function expandClasses ( array $ patterns , array $ classes ) { $ expanded = [ ] ; foreach ( $ patterns as $ key => $ pattern ) { if ( '\\' !== substr ( $ pattern , - 1 ) && false === strpos ( $ pattern , '*' ) ) { unset ( $ patterns [ $ key ] ) ; $ expanded [ ] = ltrim ( $ pattern , '\\' ) ; } } $ regexps = $ ... | Expands the given class patterns using a list of existing classes . |
22,088 | public function getNext ( ) { if ( $ this -> peeking ) { $ this -> peeking = false ; $ this -> used [ ] = $ this -> peeked ; return $ this -> peeked ; } if ( ! isset ( $ this -> tokens [ $ this -> cursor ] ) ) { throw new InternalErrorException ( 'Unexpected token stream end.' ) ; } return $ this -> tokens [ $ this -> ... | Returns next token . |
22,089 | public function getPeek ( ) { if ( ! $ this -> peeking ) { $ this -> peeked = $ this -> getNext ( ) ; $ this -> peeking = true ; } return $ this -> peeked ; } | Returns peeked token . |
22,090 | public function getNextIdentifier ( ) { $ next = $ this -> getNext ( ) ; if ( ! $ next -> isIdentifier ( ) ) { throw SyntaxErrorException :: unexpectedToken ( 'identifier' , $ next ) ; } return $ next -> getValue ( ) ; } | Returns nex identifier token . |
22,091 | public function getNextIdentifierOrStar ( ) { $ next = $ this -> getNext ( ) ; if ( $ next -> isIdentifier ( ) ) { return $ next -> getValue ( ) ; } if ( $ next -> isDelimiter ( [ '*' ] ) ) { return ; } throw SyntaxErrorException :: unexpectedToken ( 'identifier or "*"' , $ next ) ; } | Returns nex identifier or star delimiter token . |
22,092 | public function fromRequest ( Request $ request ) { $ this -> setBaseUrl ( $ request -> getBaseUrl ( ) ) ; $ this -> setPathInfo ( $ request -> getPathInfo ( ) ) ; $ this -> setMethod ( $ request -> getMethod ( ) ) ; $ this -> setHost ( $ request -> getHost ( ) ) ; $ this -> setScheme ( $ request -> getScheme ( ) ) ; $... | Updates the RequestContext information based on a HttpFoundation Request . |
22,093 | private function getConfigForPath ( array $ config , string $ path , string $ alias ) { $ steps = explode ( '.' , $ path ) ; foreach ( $ steps as $ step ) { if ( ! \ array_key_exists ( $ step , $ config ) ) { throw new LogicException ( sprintf ( 'Unable to find configuration for "%s.%s"' , $ alias , $ path ) ) ; } $ co... | Iterate over configuration until the last step of the given path . |
22,094 | public function section ( ) : ConsoleSectionOutput { return new ConsoleSectionOutput ( $ this -> getStream ( ) , $ this -> consoleSectionOutputs , $ this -> getVerbosity ( ) , $ this -> isDecorated ( ) , $ this -> getFormatter ( ) ) ; } | Creates a new output section . |
22,095 | private function doDestruct ( ) { if ( $ this -> initializer && null === $ this -> info [ 'error' ] ) { ( $ this -> initializer ) ( $ this ) ; $ this -> initializer = null ; $ this -> checkStatusCode ( ) ; } } | Ensures the request is always sent and that the response code was checked . |
22,096 | public static function append ( $ basePath , $ subPath ) { if ( '' !== ( string ) $ subPath ) { if ( '[' === $ subPath [ 0 ] ) { return $ basePath . $ subPath ; } return '' !== ( string ) $ basePath ? $ basePath . '.' . $ subPath : $ subPath ; } return $ basePath ; } | Appends a path to a given property path . |
22,097 | public static function fromString ( $ cookie , $ url = null ) { $ parts = explode ( ';' , $ cookie ) ; if ( false === strpos ( $ parts [ 0 ] , '=' ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The cookie string "%s" is not valid.' , $ parts [ 0 ] ) ) ; } list ( $ name , $ value ) = explode ( '=' , array_shift... | Creates a Cookie instance from a Set - Cookie header value . |
22,098 | private function addSubForms ( FormBuilderInterface $ builder , array $ choiceViews , array $ options ) { foreach ( $ choiceViews as $ name => $ choiceView ) { if ( \ is_array ( $ choiceView ) ) { $ this -> addSubForms ( $ builder , $ choiceView , $ options ) ; continue ; } if ( $ choiceView instanceof ChoiceGroupView ... | Adds the sub fields for an expanded choice field . |
22,099 | public function process ( ContainerBuilder $ container ) { if ( ! $ this -> enabled ( $ container ) ) { return ; } $ mappingDriverDef = $ this -> getDriver ( $ container ) ; $ chainDriverDefService = $ this -> getChainDriverServiceName ( $ container ) ; $ chainDriverDef = $ container -> getDefinition ( $ chainDriverDef... | Register mappings and alias with the metadata drivers . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.