idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
21,600
public function getTermSignal ( ) { $ this -> requireProcessIsTerminated ( __FUNCTION__ ) ; if ( $ this -> isSigchildEnabled ( ) && - 1 === $ this -> processInformation [ 'termsig' ] ) { throw new RuntimeException ( 'This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.' ) ; } return $ th...
Returns the number of the signal that caused the child process to terminate its execution .
21,601
public function isRunning ( ) { if ( self :: STATUS_STARTED !== $ this -> status ) { return false ; } $ this -> updateStatus ( false ) ; return $ this -> processInformation [ 'running' ] ; }
Checks if the process is currently running .
21,602
public function setCommandLine ( $ commandline ) { @ trigger_error ( sprintf ( 'The "%s()" method is deprecated since Symfony 4.2.' , __METHOD__ ) , E_USER_DEPRECATED ) ; $ this -> commandline = $ commandline ; return $ this ; }
Sets the command line to be executed .
21,603
public function setInput ( $ input ) { if ( $ this -> isRunning ( ) ) { throw new LogicException ( 'Input can not be set while the process is running.' ) ; } $ this -> input = ProcessUtils :: validateInput ( __METHOD__ , $ input ) ; return $ this ; }
Sets the input .
21,604
public function checkTimeout ( ) { if ( self :: STATUS_STARTED !== $ this -> status ) { return ; } if ( null !== $ this -> timeout && $ this -> timeout < microtime ( true ) - $ this -> starttime ) { $ this -> stop ( 0 ) ; throw new ProcessTimedOutException ( $ this , ProcessTimedOutException :: TYPE_GENERAL ) ; } if ( ...
Performs a check between the timeout definition and the time the process started .
21,605
public static function isTtySupported ( ) : bool { static $ isTtySupported ; if ( null === $ isTtySupported ) { $ isTtySupported = ( bool ) @ proc_open ( 'echo 1 >/dev/null' , [ [ 'file' , '/dev/tty' , 'r' ] , [ 'file' , '/dev/tty' , 'w' ] , [ 'file' , '/dev/tty' , 'w' ] ] , $ pipes ) ; } return $ isTtySupported ; }
Returns whether TTY is supported on the current operating system .
21,606
public static function isPtySupported ( ) { static $ result ; if ( null !== $ result ) { return $ result ; } if ( '\\' === \ DIRECTORY_SEPARATOR ) { return $ result = false ; } return $ result = ( bool ) @ proc_open ( 'echo 1 >/dev/null' , [ [ 'pty' ] , [ 'pty' ] , [ 'pty' ] ] , $ pipes ) ; }
Returns whether PTY is supported on the current operating system .
21,607
private function getDescriptors ( ) : array { if ( $ this -> input instanceof \ Iterator ) { $ this -> input -> rewind ( ) ; } if ( '\\' === \ DIRECTORY_SEPARATOR ) { $ this -> processPipes = new WindowsPipes ( $ this -> input , ! $ this -> outputDisabled || $ this -> hasCallback ) ; } else { $ this -> processPipes = n...
Creates the descriptors needed by the proc_open .
21,608
protected function updateStatus ( $ blocking ) { if ( self :: STATUS_STARTED !== $ this -> status ) { return ; } $ this -> processInformation = proc_get_status ( $ this -> process ) ; $ running = $ this -> processInformation [ 'running' ] ; $ this -> readPipes ( $ running && $ blocking , '\\' !== \ DIRECTORY_SEPARATOR ...
Updates the status of the process reads pipes .
21,609
private function validateTimeout ( ? float $ timeout ) : ? float { $ timeout = ( float ) $ timeout ; if ( 0.0 === $ timeout ) { $ timeout = null ; } elseif ( $ timeout < 0 ) { throw new InvalidArgumentException ( 'The timeout value must be a valid positive integer or float number.' ) ; } return $ timeout ; }
Validates and returns the filtered timeout .
21,610
private function readPipes ( bool $ blocking , bool $ close ) { $ result = $ this -> processPipes -> readAndWrite ( $ blocking , $ close ) ; $ callback = $ this -> callback ; foreach ( $ result as $ type => $ data ) { if ( 3 !== $ type ) { $ callback ( self :: STDOUT === $ type ? self :: OUT : self :: ERR , $ data ) ; ...
Reads pipes executes callback .
21,611
private function close ( ) : int { $ this -> processPipes -> close ( ) ; if ( \ is_resource ( $ this -> process ) ) { proc_close ( $ this -> process ) ; } $ this -> exitcode = $ this -> processInformation [ 'exitcode' ] ; $ this -> status = self :: STATUS_TERMINATED ; if ( - 1 === $ this -> exitcode ) { if ( $ this -> ...
Closes process resource closes file handles sets the exitcode .
21,612
private function resetProcessData ( ) { $ this -> starttime = null ; $ this -> callback = null ; $ this -> exitcode = null ; $ this -> fallbackStatus = [ ] ; $ this -> processInformation = null ; $ this -> stdout = fopen ( 'php://temp/maxmemory:' . ( 1024 * 1024 ) , 'w+b' ) ; $ this -> stderr = fopen ( 'php://temp/maxm...
Resets data related to the latest run of the process .
21,613
private function doSignal ( int $ signal , bool $ throwException ) : bool { if ( null === $ pid = $ this -> getPid ( ) ) { if ( $ throwException ) { throw new LogicException ( 'Can not send signal on a non running process.' ) ; } return false ; } if ( '\\' === \ DIRECTORY_SEPARATOR ) { exec ( sprintf ( 'taskkill /F /T ...
Sends a POSIX signal to the process .
21,614
public function getLog ( ) { $ log = [ ] ; foreach ( $ this -> traces as $ request => $ traces ) { $ log [ ] = sprintf ( '%s: %s' , $ request , implode ( ', ' , $ traces ) ) ; } return implode ( '; ' , $ log ) ; }
Returns a log message for the events of the last request processing .
21,615
protected function pass ( Request $ request , $ catch = false ) { $ this -> record ( $ request , 'pass' ) ; return $ this -> forward ( $ request , $ catch ) ; }
Forwards the Request to the backend without storing the Response in the cache .
21,616
protected function lookup ( Request $ request , $ catch = false ) { try { $ entry = $ this -> store -> lookup ( $ request ) ; } catch ( \ Exception $ e ) { $ this -> record ( $ request , 'lookup-failed' ) ; if ( $ this -> options [ 'debug' ] ) { throw $ e ; } return $ this -> pass ( $ request , $ catch ) ; } if ( null ...
Lookups a Response from the cache for the given Request .
21,617
protected function validate ( Request $ request , Response $ entry , $ catch = false ) { $ subRequest = clone $ request ; if ( 'HEAD' === $ request -> getMethod ( ) ) { $ subRequest -> setMethod ( 'GET' ) ; } $ subRequest -> headers -> set ( 'if_modified_since' , $ entry -> headers -> get ( 'Last-Modified' ) ) ; $ cach...
Validates that a cache entry is fresh .
21,618
protected function fetch ( Request $ request , $ catch = false ) { $ subRequest = clone $ request ; if ( 'HEAD' === $ request -> getMethod ( ) ) { $ subRequest -> setMethod ( 'GET' ) ; } $ subRequest -> headers -> remove ( 'if_modified_since' ) ; $ subRequest -> headers -> remove ( 'if_none_match' ) ; $ response = $ th...
Unconditionally fetches a fresh response from the backend and stores it in the cache if is cacheable .
21,619
protected function isFreshEnough ( Request $ request , Response $ entry ) { if ( ! $ entry -> isFresh ( ) ) { return $ this -> lock ( $ request , $ entry ) ; } if ( $ this -> options [ 'allow_revalidate' ] && null !== $ maxAge = $ request -> headers -> getCacheControlDirective ( 'max-age' ) ) { return $ maxAge > 0 && $...
Checks whether the cache entry is fresh enough to satisfy the Request .
21,620
protected function lock ( Request $ request , Response $ entry ) { $ lock = $ this -> store -> lock ( $ request ) ; if ( true === $ lock ) { return false ; } if ( $ this -> mayServeStaleWhileRevalidate ( $ entry ) ) { $ this -> record ( $ request , 'stale-while-revalidate' ) ; return true ; } if ( $ this -> waitForLock...
Locks a Request during the call to the backend .
21,621
protected function store ( Request $ request , Response $ response ) { try { $ this -> store -> write ( $ request , $ response ) ; $ this -> record ( $ request , 'store' ) ; $ response -> headers -> set ( 'Age' , $ response -> getAge ( ) ) ; } catch ( \ Exception $ e ) { $ this -> record ( $ request , 'store-failed' ) ...
Writes the Response to the cache .
21,622
private function restoreResponseBody ( Request $ request , Response $ response ) { if ( $ response -> headers -> has ( 'X-Body-Eval' ) ) { ob_start ( ) ; if ( $ response -> headers -> has ( 'X-Body-File' ) ) { include $ response -> headers -> get ( 'X-Body-File' ) ; } else { eval ( '; ?>' . $ response -> getContent ( )...
Restores the Response body .
21,623
private function isPrivateRequest ( Request $ request ) { foreach ( $ this -> options [ 'private_headers' ] as $ key ) { $ key = strtolower ( str_replace ( 'HTTP_' , '' , $ key ) ) ; if ( 'cookie' === $ key ) { if ( \ count ( $ request -> cookies -> all ( ) ) ) { return true ; } } elseif ( $ request -> headers -> has (...
Checks if the Request includes authorization or other sensitive information that should cause the Response to be considered private by default .
21,624
private function record ( Request $ request , string $ event ) { $ this -> traces [ $ this -> getTraceKey ( $ request ) ] [ ] = $ event ; }
Records that an event took place .
21,625
private function getTraceKey ( Request $ request ) : string { $ path = $ request -> getPathInfo ( ) ; if ( $ qs = $ request -> getQueryString ( ) ) { $ path .= '?' . $ qs ; } return $ request -> getMethod ( ) . ' ' . $ path ; }
Calculates the key we use in the trace array for a given request .
21,626
private function waitForLock ( Request $ request ) : bool { $ wait = 0 ; while ( $ this -> store -> isLocked ( $ request ) && $ wait < 100 ) { usleep ( 50000 ) ; ++ $ wait ; } return $ wait < 100 ; }
Waits for the store to release a locked entry .
21,627
public function node ( $ name , $ type ) { $ class = $ this -> getNodeClass ( $ type ) ; $ node = new $ class ( $ name ) ; $ this -> append ( $ node ) ; return $ node ; }
Creates a child node .
21,628
protected function getNodeClass ( $ type ) { $ type = strtolower ( $ type ) ; if ( ! isset ( $ this -> nodeMapping [ $ type ] ) ) { throw new \ RuntimeException ( sprintf ( 'The node type "%s" is not registered.' , $ type ) ) ; } $ class = $ this -> nodeMapping [ $ type ] ; if ( ! class_exists ( $ class ) ) { throw new...
Returns the class name of the node definition .
21,629
public function setOrigin ( FormInterface $ origin ) { if ( null !== $ this -> origin ) { throw new BadMethodCallException ( 'setOrigin() must only be called once.' ) ; } $ this -> origin = $ origin ; }
Sets the form that caused this error .
21,630
public function addCollection ( self $ collection ) { foreach ( $ collection -> all ( ) as $ name => $ route ) { unset ( $ this -> routes [ $ name ] ) ; $ this -> routes [ $ name ] = $ route ; } foreach ( $ collection -> getResources ( ) as $ resource ) { $ this -> addResource ( $ resource ) ; } }
Adds a route collection at the end of the current set by appending all routes of the added collection .
21,631
public function addPrefix ( $ prefix , array $ defaults = [ ] , array $ requirements = [ ] ) { $ prefix = trim ( trim ( $ prefix ) , '/' ) ; if ( '' === $ prefix ) { return ; } foreach ( $ this -> routes as $ route ) { $ route -> setPath ( '/' . $ prefix . $ route -> getPath ( ) ) ; $ route -> addDefaults ( $ defaults ...
Adds a prefix to the path of all child routes .
21,632
public function addNamePrefix ( string $ prefix ) { $ prefixedRoutes = [ ] ; foreach ( $ this -> routes as $ name => $ route ) { $ prefixedRoutes [ $ prefix . $ name ] = $ route ; if ( null !== $ name = $ route -> getDefault ( '_canonical_route' ) ) { $ route -> setDefault ( '_canonical_route' , $ prefix . $ name ) ; }...
Adds a prefix to the name of all the routes within in the collection .
21,633
public function setHost ( $ pattern , array $ defaults = [ ] , array $ requirements = [ ] ) { foreach ( $ this -> routes as $ route ) { $ route -> setHost ( $ pattern ) ; $ route -> addDefaults ( $ defaults ) ; $ route -> addRequirements ( $ requirements ) ; } }
Sets the host pattern on all routes .
21,634
public function addDefaults ( array $ defaults ) { if ( $ defaults ) { foreach ( $ this -> routes as $ route ) { $ route -> addDefaults ( $ defaults ) ; } } }
Adds defaults to all routes .
21,635
public function addRequirements ( array $ requirements ) { if ( $ requirements ) { foreach ( $ this -> routes as $ route ) { $ route -> addRequirements ( $ requirements ) ; } } }
Adds requirements to all routes .
21,636
public function addOptions ( array $ options ) { if ( $ options ) { foreach ( $ this -> routes as $ route ) { $ route -> addOptions ( $ options ) ; } } }
Adds options to all routes .
21,637
public function addResource ( ResourceInterface $ resource ) { $ key = ( string ) $ resource ; if ( ! isset ( $ this -> resources [ $ key ] ) ) { $ this -> resources [ $ key ] = $ resource ; } }
Adds a resource for this collection . If the resource already exists it is not added .
21,638
private function createPackageDefinition ( $ basePath , array $ baseUrls , Reference $ version ) { if ( $ basePath && $ baseUrls ) { throw new \ LogicException ( 'An asset package cannot have base URLs and base paths.' ) ; } $ package = new ChildDefinition ( $ baseUrls ? 'assets.url_package' : 'assets.path_package' ) ;...
Returns a definition for an asset package .
21,639
public function has ( $ name ) { $ this -> init ( ) ; return isset ( $ this -> commands [ $ name ] ) || ( $ this -> commandLoader && $ this -> commandLoader -> has ( $ name ) && $ this -> add ( $ this -> commandLoader -> get ( $ name ) ) ) ; }
Returns true if the command exists false otherwise .
21,640
public function extractNamespace ( $ name , $ limit = null ) { $ parts = explode ( ':' , $ name ) ; array_pop ( $ parts ) ; return implode ( ':' , null === $ limit ? $ parts : \ array_slice ( $ parts , 0 , $ limit ) ) ; }
Returns the namespace part of the command name .
21,641
public function setDefaultCommand ( $ commandName , $ isSingleCommand = false ) { $ this -> defaultCommand = $ commandName ; if ( $ isSingleCommand ) { $ this -> find ( $ commandName ) ; $ this -> singleCommand = true ; } return $ this ; }
Sets the default Command name .
21,642
private function getClass ( $ value ) { if ( \ is_string ( $ value ) ) { if ( ! class_exists ( $ value ) && ! interface_exists ( $ value , false ) ) { throw new InvalidArgumentException ( sprintf ( 'The class or interface "%s" does not exist.' , $ value ) ) ; } return ltrim ( $ value , '\\' ) ; } if ( ! \ is_object ( $...
Gets a class name for a given class or instance .
21,643
private function createEncoder ( array $ config ) { if ( isset ( $ config [ 'algorithm' ] ) ) { $ config = $ this -> getEncoderConfigFromAlgorithm ( $ config ) ; } if ( ! isset ( $ config [ 'class' ] ) ) { throw new \ InvalidArgumentException ( sprintf ( '"class" must be set in %s.' , json_encode ( $ config ) ) ) ; } i...
Creates the actual encoder instance .
21,644
public static function getFallback ( $ locale ) : ? string { if ( \ function_exists ( 'locale_parse' ) ) { $ localeSubTags = locale_parse ( $ locale ) ; if ( 1 === \ count ( $ localeSubTags ) ) { if ( self :: $ defaultFallback === $ localeSubTags [ 'language' ] ) { return 'root' ; } if ( \ strlen ( $ locale ) < 4 ) { r...
Returns the fallback locale for a given locale .
21,645
protected function beforeDispatch ( string $ eventName , $ event ) { $ this -> preDispatch ( $ eventName , $ event instanceof Event ? $ event : new LegacyEventProxy ( $ event ) ) ; }
Called before dispatching the event .
21,646
protected function afterDispatch ( string $ eventName , $ event ) { $ this -> postDispatch ( $ eventName , $ event instanceof Event ? $ event : new LegacyEventProxy ( $ event ) ) ; }
Called after dispatching the event .
21,647
public static function compare ( $ version1 , $ version2 , $ operator , $ precision = null ) { $ version1 = self :: normalize ( $ version1 , $ precision ) ; $ version2 = self :: normalize ( $ version2 , $ precision ) ; return version_compare ( $ version1 , $ version2 , $ operator ) ; }
Compares two versions with an operator .
21,648
private function read ( ) { $ filePath = $ this -> getFilePath ( ) ; $ this -> data = is_readable ( $ filePath ) && is_file ( $ filePath ) ? unserialize ( file_get_contents ( $ filePath ) ) : [ ] ; $ this -> loadSession ( ) ; }
Reads session from storage and loads session .
21,649
final protected static function readEntry ( array $ indices , string $ locale = null , bool $ fallback = true ) { if ( null === self :: $ entryReader ) { self :: $ entryReader = new BundleEntryReader ( new BufferedBundleReader ( new JsonBundleReader ( ) , Intl :: BUFFER_SIZE ) ) ; $ localeAliases = self :: $ entryReade...
Reads an entry from a resource bundle .
21,650
public function prototype ( $ type ) { return $ this -> prototype = $ this -> getNodeBuilder ( ) -> node ( null , $ type ) -> setParent ( $ this ) ; }
Sets a prototype for child nodes .
21,651
public function fixXmlConfig ( $ singular , $ plural = null ) { $ this -> normalization ( ) -> remap ( $ singular , $ plural ) ; return $ this ; }
Sets a normalization rule for XML configurations .
21,652
public function ignoreExtraKeys ( $ remove = true ) { $ this -> ignoreExtraKeys = true ; $ this -> removeExtraKeys = $ remove ; return $ this ; }
Allows extra config keys to be specified under an array without throwing an exception .
21,653
protected function getNodeBuilder ( ) { if ( null === $ this -> nodeBuilder ) { $ this -> nodeBuilder = new NodeBuilder ( ) ; } return $ this -> nodeBuilder -> setParent ( $ this ) ; }
Returns a node builder to be used to add children and prototype .
21,654
protected function validateConcreteNode ( ArrayNode $ node ) { $ path = $ node -> getPath ( ) ; if ( null !== $ this -> key ) { throw new InvalidDefinitionException ( sprintf ( '->useAttributeAsKey() is not applicable to concrete nodes at path "%s"' , $ path ) ) ; } if ( false === $ this -> allowEmptyValue ) { throw ne...
Validate the configuration of a concrete node .
21,655
private function seekToNextRelevantToken ( \ Iterator $ tokenIterator ) { for ( ; $ tokenIterator -> valid ( ) ; $ tokenIterator -> next ( ) ) { $ t = $ tokenIterator -> current ( ) ; if ( T_WHITESPACE !== $ t [ 0 ] ) { break ; } } }
Seeks to a non - whitespace token .
21,656
private function getValue ( \ Iterator $ tokenIterator ) { $ message = '' ; $ docToken = '' ; $ docPart = '' ; for ( ; $ tokenIterator -> valid ( ) ; $ tokenIterator -> next ( ) ) { $ t = $ tokenIterator -> current ( ) ; if ( '.' === $ t ) { continue ; } if ( ! isset ( $ t [ 1 ] ) ) { break ; } switch ( $ t [ 0 ] ) { c...
Extracts the message from the iterator while the tokens match allowed message tokens .
21,657
protected function parseTokens ( $ tokens , MessageCatalogue $ catalog ) { $ tokenIterator = new \ ArrayIterator ( $ tokens ) ; for ( $ key = 0 ; $ key < $ tokenIterator -> count ( ) ; ++ $ key ) { foreach ( $ this -> sequences as $ sequence ) { $ message = '' ; $ domain = 'messages' ; $ tokenIterator -> seek ( $ key )...
Extracts trans message from PHP tokens .
21,658
protected function convertFileInformation ( $ file ) { if ( $ file instanceof UploadedFile ) { return $ file ; } $ file = $ this -> fixPhpFilesArray ( $ file ) ; if ( \ is_array ( $ file ) ) { $ keys = array_keys ( $ file ) ; sort ( $ keys ) ; if ( $ keys == self :: $ fileKeys ) { if ( UPLOAD_ERR_NO_FILE == $ file [ 'e...
Converts uploaded files to UploadedFile instances .
21,659
public function compareTo ( self $ specificity ) { if ( $ this -> a !== $ specificity -> a ) { return $ this -> a > $ specificity -> a ? 1 : - 1 ; } if ( $ this -> b !== $ specificity -> b ) { return $ this -> b > $ specificity -> b ? 1 : - 1 ; } if ( $ this -> c !== $ specificity -> c ) { return $ this -> c > $ specif...
Returns - 1 if the object specificity is lower than the argument 0 if they are equal and 1 if the argument is lower .
21,660
public function mapsForm ( $ index ) { if ( ! isset ( $ this -> mapsForm [ $ index ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The index %s is not within the violation path' , $ index ) ) ; } return $ this -> mapsForm [ $ index ] ; }
Returns whether an element maps directly to a form .
21,661
private function buildString ( ) { $ this -> pathAsString = '' ; $ data = false ; foreach ( $ this -> elements as $ index => $ element ) { if ( $ this -> mapsForm [ $ index ] ) { $ this -> pathAsString .= ".children[$element]" ; } elseif ( ! $ data ) { $ this -> pathAsString .= '.data' . ( $ this -> isIndex [ $ index ]...
Builds the string representation from the elements .
21,662
public function reverseTransform ( $ rfc3339 ) { if ( ! \ is_string ( $ rfc3339 ) ) { throw new TransformationFailedException ( 'Expected a string.' ) ; } if ( '' === $ rfc3339 ) { return ; } if ( ! preg_match ( '/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/' , $ rfc3339 , $ ...
Transforms a formatted string following RFC 3339 into a normalized date .
21,663
public static function setFiles ( array $ files ) : array { $ previousFiles = self :: $ files ; self :: $ files = $ files ; foreach ( self :: $ openedFiles as $ file ) { if ( $ file ) { flock ( $ file , LOCK_UN ) ; fclose ( $ file ) ; } } self :: $ openedFiles = self :: $ lockedFiles = [ ] ; return $ previousFiles ; }
Defines a set of existing files that will be used as keys to acquire locks .
21,664
public static function processValue ( $ value , $ allowServices = false ) { if ( \ is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { $ value [ $ k ] = static :: processValue ( $ v , $ allowServices ) ; } return $ value ; } if ( $ value instanceof ReferenceConfigurator ) { return new Reference ( $ value -> id...
Checks that a value is valid optionally replacing Definition and Reference configurators by their configure value .
21,665
final public function autoLogin ( Request $ request ) : ? TokenInterface { if ( null === $ cookie = $ request -> cookies -> get ( $ this -> options [ 'name' ] ) ) { return null ; } if ( null !== $ this -> logger ) { $ this -> logger -> debug ( 'Remember-me cookie detected.' ) ; } $ cookieParts = $ this -> decodeCookie ...
Implementation of RememberMeServicesInterface . Detects whether a remember - me cookie was set decodes it and hands it to subclasses for further processing .
21,666
public function logout ( Request $ request , Response $ response , TokenInterface $ token ) { $ this -> cancelCookie ( $ request ) ; }
Implementation for LogoutHandlerInterface . Deletes the cookie .
21,667
final public function loginFail ( Request $ request , \ Exception $ exception = null ) { $ this -> cancelCookie ( $ request ) ; $ this -> onLoginFail ( $ request , $ exception ) ; }
Implementation for RememberMeServicesInterface . Deletes the cookie when an attempted authentication fails .
21,668
final public function loginSuccess ( Request $ request , Response $ response , TokenInterface $ token ) { $ this -> cancelCookie ( $ request ) ; if ( ! $ token -> getUser ( ) instanceof UserInterface ) { if ( null !== $ this -> logger ) { $ this -> logger -> debug ( 'Remember-me ignores token since it does not contain ...
Implementation for RememberMeServicesInterface . This is called when an authentication is successful .
21,669
protected function encodeCookie ( array $ cookieParts ) { foreach ( $ cookieParts as $ cookiePart ) { if ( false !== strpos ( $ cookiePart , self :: COOKIE_DELIMITER ) ) { throw new \ InvalidArgumentException ( sprintf ( '$cookieParts should not contain the cookie delimiter "%s"' , self :: COOKIE_DELIMITER ) ) ; } } re...
Encodes the cookie parts .
21,670
protected function cancelCookie ( Request $ request ) { if ( null !== $ this -> logger ) { $ this -> logger -> debug ( 'Clearing remember-me cookie.' , [ 'name' => $ this -> options [ 'name' ] ] ) ; } $ request -> attributes -> set ( self :: COOKIE_ATTR_NAME , new Cookie ( $ this -> options [ 'name' ] , null , 1 , $ th...
Deletes the remember - me cookie .
21,671
private function getProxyClassName ( Definition $ definition ) : string { $ class = $ this -> proxyGenerator -> getProxifiedClass ( $ definition ) ; return preg_replace ( '/^.*\\\\/' , '' , $ class ) . '_' . $ this -> getIdentifierSuffix ( $ definition ) ; }
Produces the proxy class name for the given definition .
21,672
public function guess ( $ mimeType ) { foreach ( $ this -> guessers as $ guesser ) { if ( null !== $ extension = $ guesser -> guess ( $ mimeType ) ) { return $ extension ; } } }
Tries to guess the extension .
21,673
public static function split ( string $ header , string $ separators ) : array { $ quotedSeparators = preg_quote ( $ separators , '/' ) ; preg_match_all ( ' / (?!\s) (?: # quoted-string "(?:[^"\\\\]|\\\\.)*(?:"|\\\\|$) ...
Splits an HTTP header by one or more separators .
21,674
public static function combine ( array $ parts ) : array { $ assoc = [ ] ; foreach ( $ parts as $ part ) { $ name = strtolower ( $ part [ 0 ] ) ; $ value = $ part [ 1 ] ?? true ; $ assoc [ $ name ] = $ value ; } return $ assoc ; }
Combines an array of arrays into one associative array .
21,675
public static function toString ( array $ assoc , string $ separator ) : string { $ parts = [ ] ; foreach ( $ assoc as $ name => $ value ) { if ( true === $ value ) { $ parts [ ] = $ name ; } else { $ parts [ ] = $ name . '=' . self :: quote ( $ value ) ; } } return implode ( $ separator . ' ' , $ parts ) ; }
Joins an associative array into a string for use in an HTTP header .
21,676
private static function readRequestBody ( int $ length , \ Closure $ body , string & $ buffer , bool & $ eof ) : string { if ( ! $ eof && \ strlen ( $ buffer ) < $ length ) { if ( ! \ is_string ( $ data = $ body ( $ length ) ) ) { throw new TransportException ( sprintf ( 'The return value of the "body" option callback ...
Wraps the request s body callback to allow it to return strings longer than curl requested .
21,677
private static function createRedirectResolver ( array $ options , string $ host ) : \ Closure { $ redirectHeaders = [ ] ; if ( 0 < $ options [ 'max_redirects' ] ) { $ redirectHeaders [ 'host' ] = $ host ; $ redirectHeaders [ 'with_auth' ] = $ redirectHeaders [ 'no_auth' ] = array_filter ( $ options [ 'request_headers'...
Resolves relative URLs on redirects and deals with authentication headers .
21,678
public function showAction ( $ token ) { if ( null === $ this -> profiler ) { throw new NotFoundHttpException ( 'The profiler must be enabled.' ) ; } $ this -> profiler -> disable ( ) ; $ exception = $ this -> profiler -> loadProfile ( $ token ) -> getCollector ( 'exception' ) -> getException ( ) ; $ template = $ this ...
Renders the exception panel for the given token .
21,679
public function cssAction ( $ token ) { if ( null === $ this -> profiler ) { throw new NotFoundHttpException ( 'The profiler must be enabled.' ) ; } $ this -> profiler -> disable ( ) ; $ exception = $ this -> profiler -> loadProfile ( $ token ) -> getCollector ( 'exception' ) -> getException ( ) ; $ template = $ this -...
Renders the exception panel stylesheet for the given token .
21,680
public function getProcessedHelp ( ) { $ name = $ this -> name ; $ isSingleCommand = $ this -> application && $ this -> application -> isSingleCommand ( ) ; $ placeholders = [ '%command.name%' , '%command.full_name%' , ] ; $ replacements = [ $ name , $ isSingleCommand ? $ _SERVER [ 'PHP_SELF' ] : $ _SERVER [ 'PHP_SELF'...
Returns the processed help for the command replacing the %command . name% and %command . full_name% patterns with the real values dynamically .
21,681
public function getSynopsis ( $ short = false ) { $ key = $ short ? 'short' : 'long' ; if ( ! isset ( $ this -> synopsis [ $ key ] ) ) { $ this -> synopsis [ $ key ] = trim ( sprintf ( '%s %s' , $ this -> name , $ this -> definition -> getSynopsis ( $ short ) ) ) ; } return $ this -> synopsis [ $ key ] ; }
Returns the synopsis for the command .
21,682
public function addUsage ( $ usage ) { if ( 0 !== strpos ( $ usage , $ this -> name ) ) { $ usage = sprintf ( '%s %s' , $ this -> name , $ usage ) ; } $ this -> usages [ ] = $ usage ; return $ this ; }
Add a command usage example .
21,683
public function getHelper ( $ name ) { if ( null === $ this -> helperSet ) { throw new LogicException ( sprintf ( 'Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can ...
Gets a helper instance by name .
21,684
public function setTargetUrl ( $ url ) { if ( empty ( $ url ) ) { throw new \ InvalidArgumentException ( 'Cannot redirect to an empty URL.' ) ; } $ this -> targetUrl = $ url ; $ this -> setContent ( sprintf ( '<!DOCTYPE html><html> <head> <meta charset="UTF-8" /> <meta http-equiv="refresh" content="0;u...
Sets the redirect target of this response .
21,685
protected function removeFromControl ( Response $ response ) { if ( ! $ response -> headers -> has ( 'Surrogate-Control' ) ) { return ; } $ value = $ response -> headers -> get ( 'Surrogate-Control' ) ; $ upperName = strtoupper ( $ this -> getName ( ) ) ; if ( sprintf ( 'content="%s/1.0"' , $ upperName ) == $ value ) {...
Remove the Surrogate from the Surrogate - Control header .
21,686
public function transform ( $ dateInterval ) { if ( null === $ dateInterval ) { return array_intersect_key ( [ 'years' => '' , 'months' => '' , 'weeks' => '' , 'days' => '' , 'hours' => '' , 'minutes' => '' , 'seconds' => '' , 'invert' => false , ] , array_flip ( $ this -> fields ) ) ; } if ( ! $ dateInterval instanceo...
Transforms a normalized date interval into an interval array .
21,687
public function validateForm ( FormEvent $ event ) { $ form = $ event -> getForm ( ) ; if ( $ form -> isRoot ( ) ) { foreach ( $ this -> validator -> validate ( $ form ) as $ violation ) { $ allowNonSynchronized = ( null === $ violation -> getConstraint ( ) || $ violation -> getConstraint ( ) instanceof Form ) && Form ...
Validates the form and its domain object .
21,688
public function setTemplating ( $ templating ) { if ( null !== $ templating && ! $ templating instanceof EngineInterface && ! $ templating instanceof Environment ) { throw new \ InvalidArgumentException ( 'The hinclude rendering strategy needs an instance of Twig\Environment or Symfony\Component\Templating\EngineInterf...
Sets the templating engine to use to render the default content .
21,689
private function writeValue ( $ value ) : string { if ( '%%%%not_defined%%%%' === $ value ) { return '' ; } if ( \ is_string ( $ value ) || is_numeric ( $ value ) ) { return $ value ; } if ( false === $ value ) { return 'false' ; } if ( true === $ value ) { return 'true' ; } if ( null === $ value ) { return 'null' ; } ...
Renders the string conversion of the value .
21,690
final public function tag ( string $ name , array $ attributes = [ ] ) { if ( '' === $ name ) { throw new InvalidArgumentException ( 'The tag name in "_defaults" must be a non-empty string.' ) ; } foreach ( $ attributes as $ attribute => $ value ) { if ( null !== $ value && ! is_scalar ( $ value ) ) { throw new Invalid...
Adds a tag for this definition .
21,691
protected function json ( $ data , int $ status = 200 , array $ headers = [ ] , array $ context = [ ] ) : JsonResponse { if ( $ this -> container -> has ( 'serializer' ) ) { $ json = $ this -> container -> get ( 'serializer' ) -> serialize ( $ data , 'json' , array_merge ( [ 'json_encode_options' => JsonResponse :: DEF...
Returns a JsonResponse that uses the serializer component if enabled or json_encode .
21,692
protected function file ( $ file , string $ fileName = null , string $ disposition = ResponseHeaderBag :: DISPOSITION_ATTACHMENT ) : BinaryFileResponse { $ response = new BinaryFileResponse ( $ file ) ; $ response -> setContentDisposition ( $ disposition , null === $ fileName ? $ response -> getFile ( ) -> getFilename ...
Returns a BinaryFileResponse object with original or customized file name and disposition header .
21,693
protected function addFlash ( string $ type , string $ message ) { if ( ! $ this -> container -> has ( 'session' ) ) { throw new \ LogicException ( 'You can not use the addFlash method if sessions are disabled. Enable them in "config/packages/framework.yaml".' ) ; } $ this -> container -> get ( 'session' ) -> getFlashB...
Adds a flash message to the current session for type .
21,694
protected function denyAccessUnlessGranted ( $ attributes , $ subject = null , string $ message = 'Access Denied.' ) { if ( ! $ this -> isGranted ( $ attributes , $ subject ) ) { $ exception = $ this -> createAccessDeniedException ( $ message ) ; $ exception -> setAttributes ( $ attributes ) ; $ exception -> setSubject...
Throws an exception unless the attributes are granted against the current authentication token and optionally supplied subject .
21,695
protected function dispatchMessage ( $ message ) : Envelope { if ( ! $ this -> container -> has ( 'messenger.default_bus' ) ) { $ message = class_exists ( Envelope :: class ) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".' ; throw new \ Logi...
Dispatches a message to the bus .
21,696
protected function addLink ( Request $ request , Link $ link ) { if ( ! class_exists ( AddLinkHeaderListener :: class ) ) { throw new \ LogicException ( 'You can not use the "addLink" method if the WebLink component is not available. Try running "composer require symfony/web-link".' ) ; } if ( null === $ linkProvider =...
Adds a Link HTTP header to the current response .
21,697
public function guess ( $ path ) { if ( ! is_file ( $ path ) ) { throw new FileNotFoundException ( $ path ) ; } if ( ! is_readable ( $ path ) ) { throw new AccessDeniedException ( $ path ) ; } foreach ( $ this -> guessers as $ guesser ) { if ( null !== $ mimeType = $ guesser -> guess ( $ path ) ) { return $ mimeType ; ...
Tries to guess the mime type of the given file .
21,698
public function encode ( $ data , $ format , array $ context = [ ] ) { $ jsonEncodeOptions = $ context [ self :: OPTIONS ] ?? $ this -> defaultContext [ self :: OPTIONS ] ; $ encodedJson = json_encode ( $ data , $ jsonEncodeOptions ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) && ( false === $ encodedJson || ! ( $ j...
Encodes PHP data to a JSON string .
21,699
public function load ( array $ configs , ContainerBuilder $ container ) { $ configuration = $ this -> getConfiguration ( $ configs , $ container ) ; $ config = $ this -> processConfiguration ( $ configuration , $ configs ) ; $ loader = new XmlFileLoader ( $ container , new FileLocator ( __DIR__ . '/../Resources/config'...
Loads the web profiler configuration .