idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
21,800 | public static function getOption ( $ name ) { $ constantName = self :: getOptionName ( $ name ) ; if ( ! \ defined ( $ constantName ) ) { throw new LdapException ( sprintf ( 'Unknown option "%s".' , $ name ) ) ; } return \ constant ( $ constantName ) ; } | Fetches an option s corresponding constant value from an option name . The option name can either be in snake or camel case . |
21,801 | public function getSource ( ) { if ( ! $ this -> deprecationTriggered && ( \ func_num_args ( ) < 1 || func_get_arg ( 0 ) ) ) { @ trigger_error ( sprintf ( 'The "%s" class is deprecated since version 4.3 and will be removed in 5.0. Use strings as roles instead.' , __CLASS__ ) , E_USER_DEPRECATED ) ; $ this -> deprecatio... | Returns the original Token . |
21,802 | public function createUser ( UserInterface $ user ) { if ( isset ( $ this -> users [ strtolower ( $ user -> getUsername ( ) ) ] ) ) { throw new \ LogicException ( 'Another user with the same username already exists.' ) ; } $ this -> users [ strtolower ( $ user -> getUsername ( ) ) ] = $ user ; } | Adds a new User to the provider . |
21,803 | private function getUser ( $ username ) { if ( ! isset ( $ this -> users [ strtolower ( $ username ) ] ) ) { $ ex = new UsernameNotFoundException ( sprintf ( 'Username "%s" does not exist.' , $ username ) ) ; $ ex -> setUsername ( $ username ) ; throw $ ex ; } return $ this -> users [ strtolower ( $ username ) ] ; } | Returns the user by given username . |
21,804 | protected function getFilename ( $ token ) { $ folderA = substr ( $ token , - 2 , 2 ) ; $ folderB = substr ( $ token , - 4 , 2 ) ; return $ this -> folder . '/' . $ folderA . '/' . $ folderB . '/' . $ token ; } | Gets filename to store data associated to the token . |
21,805 | protected function readLineFromFile ( $ file ) { $ line = '' ; $ position = ftell ( $ file ) ; if ( 0 === $ position ) { return ; } while ( true ) { $ chunkSize = min ( $ position , 1024 ) ; $ position -= $ chunkSize ; fseek ( $ file , $ position ) ; if ( 0 === $ chunkSize ) { break ; } $ buffer = fread ( $ file , $ ch... | Reads a line in the file backward . |
21,806 | protected function parseConstraints ( \ SimpleXMLElement $ nodes ) { $ constraints = [ ] ; foreach ( $ nodes as $ node ) { if ( \ count ( $ node ) > 0 ) { if ( \ count ( $ node -> value ) > 0 ) { $ options = $ this -> parseValues ( $ node -> value ) ; } elseif ( \ count ( $ node -> constraint ) > 0 ) { $ options = $ th... | Parses a collection of constraint XML nodes . |
21,807 | protected function formatValues ( array $ values , $ format = 0 ) { foreach ( $ values as $ key => $ value ) { $ values [ $ key ] = $ this -> formatValue ( $ value , $ format ) ; } return implode ( ', ' , $ values ) ; } | Returns a string representation of a list of values . |
21,808 | public function addPropertyConstraint ( $ property , Constraint $ constraint ) { if ( ! isset ( $ this -> properties [ $ property ] ) ) { $ this -> properties [ $ property ] = new PropertyMetadata ( $ this -> getClassName ( ) , $ property ) ; $ this -> addPropertyMetadata ( $ this -> properties [ $ property ] ) ; } $ c... | Adds a constraint to the given property . |
21,809 | public function addGetterConstraint ( $ property , Constraint $ constraint ) { if ( ! isset ( $ this -> getters [ $ property ] ) ) { $ this -> getters [ $ property ] = new GetterMetadata ( $ this -> getClassName ( ) , $ property ) ; $ this -> addPropertyMetadata ( $ this -> getters [ $ property ] ) ; } $ constraint -> ... | Adds a constraint to the getter of the given property . |
21,810 | public function mergeConstraints ( self $ source ) { if ( $ source -> isGroupSequenceProvider ( ) ) { $ this -> setGroupSequenceProvider ( true ) ; } foreach ( $ source -> getConstraints ( ) as $ constraint ) { $ this -> addConstraint ( clone $ constraint ) ; } foreach ( $ source -> getConstrainedProperties ( ) as $ pr... | Merges the constraints of the given metadata into this object . |
21,811 | public function setGroupSequence ( $ groupSequence ) { if ( $ this -> isGroupSequenceProvider ( ) ) { throw new GroupDefinitionException ( 'Defining a static group sequence is not allowed with a group sequence provider' ) ; } if ( \ is_array ( $ groupSequence ) ) { $ groupSequence = new GroupSequence ( $ groupSequence ... | Sets the default group sequence for this class . |
21,812 | public function getReflectionClass ( ) { if ( ! $ this -> reflClass ) { $ this -> reflClass = new \ ReflectionClass ( $ this -> getClassName ( ) ) ; } return $ this -> reflClass ; } | Returns a ReflectionClass instance for this class . |
21,813 | public function setGroupSequenceProvider ( $ active ) { if ( $ this -> hasGroupSequence ( ) ) { throw new GroupDefinitionException ( 'Defining a group sequence provider is not allowed with a static group sequence' ) ; } if ( ! $ this -> getReflectionClass ( ) -> implementsInterface ( 'Symfony\Component\Validator\GroupS... | Sets whether a group sequence provider should be used . |
21,814 | private static function normalizeHeaders ( array $ headers ) : array { $ normalizedHeaders = [ ] ; foreach ( $ headers as $ name => $ values ) { if ( \ is_int ( $ name ) ) { [ $ name , $ values ] = explode ( ':' , $ values , 2 ) ; $ values = [ ltrim ( $ values ) ] ; } elseif ( ! \ is_iterable ( $ values ) ) { $ values ... | Normalizes headers by putting their names as lowercased keys . |
21,815 | private static function resolveUrl ( array $ url , ? array $ base , array $ queryDefaults = [ ] ) : array { if ( null !== $ base && '' === ( $ base [ 'scheme' ] ?? '' ) . ( $ base [ 'authority' ] ?? '' ) ) { throw new InvalidArgumentException ( sprintf ( 'Invalid "base_uri" option: host or scheme is missing in "%s".' ,... | Resolves a URL against a base URI . |
21,816 | private static function removeDotSegments ( string $ path ) { $ result = '' ; while ( ! \ in_array ( $ path , [ '' , '.' , '..' ] , true ) ) { if ( '.' === $ path [ 0 ] && ( 0 === strpos ( $ path , $ p = '../' ) || 0 === strpos ( $ path , $ p = './' ) ) ) { $ path = substr ( $ path , \ strlen ( $ p ) ) ; } elseif ( '/.... | Removes dot - segments from a path . |
21,817 | private static function mergeQueryString ( ? string $ queryString , array $ queryArray , bool $ replace ) : ? string { if ( ! $ queryArray ) { return $ queryString ; } $ query = [ ] ; if ( null !== $ queryString ) { foreach ( explode ( '&' , $ queryString ) as $ v ) { if ( '' !== $ v ) { $ k = urldecode ( explode ( '='... | Merges and encodes a query array with a query string . |
21,818 | protected function writeError ( OutputInterface $ output , \ Exception $ error ) { if ( null !== $ this -> getHelperSet ( ) && $ this -> getHelperSet ( ) -> has ( 'formatter' ) ) { $ message = $ this -> getHelperSet ( ) -> get ( 'formatter' ) -> formatBlock ( $ error -> getMessage ( ) , 'error' ) ; } else { $ message =... | Outputs an error message . |
21,819 | private function hasSttyAvailable ( ) : bool { if ( null !== self :: $ stty ) { return self :: $ stty ; } exec ( 'stty 2>&1' , $ output , $ exitcode ) ; return self :: $ stty = 0 === $ exitcode ; } | Returns whether Stty is available or not . |
21,820 | public function add ( array $ parameters ) { foreach ( $ parameters as $ key => $ value ) { $ this -> set ( $ key , $ value ) ; } } | Adds parameters to the service container parameters . |
21,821 | private function flatten ( array $ array , array & $ result , string $ keySeparator , string $ parentKey = '' , bool $ escapeFormulas = false ) { foreach ( $ array as $ key => $ value ) { if ( \ is_array ( $ value ) ) { $ this -> flatten ( $ value , $ result , $ keySeparator , $ parentKey . $ key . $ keySeparator , $ e... | Flattens an array and generates keys including the path . |
21,822 | public static function validateSchema ( \ DOMDocument $ dom ) : array { $ xliffVersion = static :: getVersionNumber ( $ dom ) ; $ internalErrors = libxml_use_internal_errors ( true ) ; $ disableEntities = libxml_disable_entity_loader ( false ) ; $ isValid = @ $ dom -> schemaValidateSource ( self :: getSchema ( $ xliffV... | Validates and parses the given file into a DOMDocument . |
21,823 | private static function fixXmlLocation ( string $ schemaSource , string $ xmlUri ) : string { $ newPath = str_replace ( '\\' , '/' , __DIR__ ) . '/../Resources/schemas/xml.xsd' ; $ parts = explode ( '/' , $ newPath ) ; $ locationstart = 'file:///' ; if ( 0 === stripos ( $ newPath , 'phar://' ) ) { $ tmpfile = tempnam (... | Internally changes the URI of a dependent xsd to be loaded locally . |
21,824 | public function formatCurrency ( $ value , $ currency ) { if ( self :: DECIMAL == $ this -> style ) { return $ this -> format ( $ value ) ; } $ symbol = Currencies :: getSymbol ( $ currency , 'en' ) ; $ fractionDigits = Currencies :: getFractionDigits ( $ currency ) ; $ value = $ this -> roundCurrency ( $ value , $ cur... | Format a currency value . |
21,825 | public function getSymbol ( $ attr ) { return \ array_key_exists ( $ this -> style , self :: $ enSymbols ) && \ array_key_exists ( $ attr , self :: $ enSymbols [ $ this -> style ] ) ? self :: $ enSymbols [ $ this -> style ] [ $ attr ] : false ; } | Not supported . Returns a formatter symbol value . |
21,826 | public function getTextAttribute ( $ attr ) { return \ array_key_exists ( $ this -> style , self :: $ enTextAttributes ) && \ array_key_exists ( $ attr , self :: $ enTextAttributes [ $ this -> style ] ) ? self :: $ enTextAttributes [ $ this -> style ] [ $ attr ] : false ; } | Not supported . Returns a formatter text attribute value . |
21,827 | public function parse ( $ value , $ type = self :: TYPE_DOUBLE , & $ position = 0 ) { if ( self :: TYPE_DEFAULT == $ type || self :: TYPE_CURRENCY == $ type ) { trigger_error ( __METHOD__ . '(): Unsupported format type ' . $ type , \ E_USER_WARNING ) ; return false ; } $ groupingMatch = $ this -> getAttribute ( self ::... | Parse a number . |
21,828 | protected function resetError ( ) { IntlGlobals :: setError ( IntlGlobals :: U_ZERO_ERROR ) ; $ this -> errorCode = IntlGlobals :: getErrorCode ( ) ; $ this -> errorMessage = IntlGlobals :: getErrorMessage ( ) ; } | Set the error to the default U_ZERO_ERROR . |
21,829 | private function roundCurrency ( $ value , $ currency ) { $ fractionDigits = Currencies :: getFractionDigits ( $ currency ) ; $ roundingIncrement = Currencies :: getRoundingIncrement ( $ currency ) ; $ value = $ this -> round ( $ value , $ fractionDigits ) ; if ( 0 < $ roundingIncrement && 0 < $ fractionDigits ) { $ ro... | Rounds a currency value applying increment rounding if applicable . |
21,830 | private function round ( $ value , $ precision ) { $ precision = $ this -> getUninitializedPrecision ( $ value , $ precision ) ; $ roundingModeAttribute = $ this -> getAttribute ( self :: ROUNDING_MODE ) ; if ( isset ( self :: $ phpRoundingMap [ $ roundingModeAttribute ] ) ) { $ value = round ( $ value , $ precision , ... | Rounds a value . |
21,831 | private function getUninitializedPrecision ( $ value , $ precision ) { if ( self :: CURRENCY == $ this -> style ) { return $ precision ; } if ( ! $ this -> isInitializedAttribute ( self :: FRACTION_DIGITS ) ) { preg_match ( '/.*\.(.*)/' , ( string ) $ value , $ digits ) ; if ( isset ( $ digits [ 1 ] ) ) { $ precision =... | Returns the precision value if the DECIMAL style is being used and the FRACTION_DIGITS attribute is uninitialized . |
21,832 | private function parseImports ( \ DOMDocument $ xml , $ file ) { $ xpath = new \ DOMXPath ( $ xml ) ; $ xpath -> registerNamespace ( 'container' , self :: NS ) ; if ( false === $ imports = $ xpath -> query ( '//container:imports/container:import' ) ) { return ; } $ defaultDirectory = \ dirname ( $ file ) ; foreach ( $ ... | Parses imports . |
21,833 | private function validateAlias ( \ DOMElement $ alias , $ file ) { foreach ( $ alias -> attributes as $ name => $ node ) { if ( ! \ in_array ( $ name , [ 'alias' , 'id' , 'public' ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Invalid attribute "%s" defined for alias "%s" in "%s".' , $ name , $ alias -> getAtt... | Validates an alias . |
21,834 | public static function enable ( ) { class_exists ( 'Symfony\Component\Debug\ErrorHandler' ) ; class_exists ( 'Psr\Log\LogLevel' ) ; if ( ! \ is_array ( $ functions = spl_autoload_functions ( ) ) ) { return ; } foreach ( $ functions as $ function ) { spl_autoload_unregister ( $ function ) ; } foreach ( $ functions as $ ... | Wraps all autoloaders . |
21,835 | public static function disable ( ) { if ( ! \ is_array ( $ functions = spl_autoload_functions ( ) ) ) { return ; } foreach ( $ functions as $ function ) { spl_autoload_unregister ( $ function ) ; } foreach ( $ functions as $ function ) { if ( \ is_array ( $ function ) && $ function [ 0 ] instanceof self ) { $ function ... | Disables the wrapping . |
21,836 | private function darwinRealpath ( $ real ) { $ i = 1 + strrpos ( $ real , '/' ) ; $ file = substr ( $ real , $ i ) ; $ real = substr ( $ real , 0 , $ i ) ; if ( isset ( self :: $ darwinCache [ $ real ] ) ) { $ kDir = $ real ; } else { $ kDir = strtolower ( $ real ) ; if ( isset ( self :: $ darwinCache [ $ kDir ] ) ) { ... | realpath on MacOSX doesn t normalize the case of characters . |
21,837 | private function getOwnInterfaces ( $ class , $ parent ) { $ ownInterfaces = class_implements ( $ class , false ) ; if ( $ parent ) { foreach ( class_implements ( $ parent , false ) as $ interface ) { unset ( $ ownInterfaces [ $ interface ] ) ; } } foreach ( $ ownInterfaces as $ interface ) { foreach ( class_implements... | class_implements includes interfaces from the parents so we have to manually exclude them . |
21,838 | public static function castObject ( $ obj , $ class , $ hasDebugInfo = false ) { if ( $ hasDebugInfo ) { $ a = $ obj -> __debugInfo ( ) ; } elseif ( $ obj instanceof \ Closure ) { $ a = [ ] ; } else { $ a = ( array ) $ obj ; } if ( $ obj instanceof \ __PHP_Incomplete_Class ) { return $ a ; } if ( $ a ) { static $ publi... | Casts objects to arrays and adds the dynamic property prefix . |
21,839 | public static function filter ( array $ a , $ filter , array $ listedProperties = [ ] , & $ count = 0 ) { $ count = 0 ; foreach ( $ a as $ k => $ v ) { $ type = self :: EXCLUDE_STRICT & $ filter ; if ( null === $ v ) { $ type |= self :: EXCLUDE_NULL & $ filter ; $ type |= self :: EXCLUDE_EMPTY & $ filter ; } elseif ( f... | Filters out the specified properties . |
21,840 | private function applyCurrentStyle ( string $ text , string $ current , int $ width , int & $ currentLineLength ) : string { if ( '' === $ text ) { return '' ; } if ( ! $ width ) { return $ this -> isDecorated ( ) ? $ this -> styleStack -> getCurrent ( ) -> apply ( $ text ) : $ text ; } if ( ! $ currentLineLength && ''... | Applies current style from stack to text if must be applied . |
21,841 | public function chmod ( $ files , $ mode , $ umask = 0000 , $ recursive = false ) { foreach ( $ this -> toIterable ( $ files ) as $ file ) { if ( true !== @ chmod ( $ file , $ mode & ~ $ umask ) ) { throw new IOException ( sprintf ( 'Failed to chmod file "%s".' , $ file ) , 0 , null , $ file ) ; } if ( $ recursive && i... | Change mode for an array of files or directories . |
21,842 | public function chown ( $ files , $ user , $ recursive = false ) { foreach ( $ this -> toIterable ( $ files ) as $ file ) { if ( $ recursive && is_dir ( $ file ) && ! is_link ( $ file ) ) { $ this -> chown ( new \ FilesystemIterator ( $ file ) , $ user , true ) ; } if ( is_link ( $ file ) && \ function_exists ( 'lchown... | Change the owner of an array of files or directories . |
21,843 | public function chgrp ( $ files , $ group , $ recursive = false ) { foreach ( $ this -> toIterable ( $ files ) as $ file ) { if ( $ recursive && is_dir ( $ file ) && ! is_link ( $ file ) ) { $ this -> chgrp ( new \ FilesystemIterator ( $ file ) , $ group , true ) ; } if ( is_link ( $ file ) && \ function_exists ( 'lchg... | Change the group of an array of files or directories . |
21,844 | public function readlink ( $ path , $ canonicalize = false ) { if ( ! $ canonicalize && ! is_link ( $ path ) ) { return ; } if ( $ canonicalize ) { if ( ! $ this -> exists ( $ path ) ) { return ; } if ( '\\' === \ DIRECTORY_SEPARATOR ) { $ path = readlink ( $ path ) ; } return realpath ( $ path ) ; } if ( '\\' === \ DI... | Resolves links in paths . |
21,845 | public function tempnam ( $ dir , $ prefix ) { list ( $ scheme , $ hierarchy ) = $ this -> getSchemeAndHierarchy ( $ dir ) ; if ( null === $ scheme || 'file' === $ scheme || 'gs' === $ scheme ) { $ tmpFile = @ tempnam ( $ hierarchy , $ prefix ) ; if ( false !== $ tmpFile ) { if ( null !== $ scheme && 'gs' !== $ scheme ... | Creates a temporary file with support for custom stream wrappers . |
21,846 | public function getPath ( ) { $ controller = str_replace ( '\\' , '/' , $ this -> get ( 'controller' ) ) ; $ path = ( empty ( $ controller ) ? '' : $ controller . '/' ) . $ this -> get ( 'name' ) . '.' . $ this -> get ( 'format' ) . '.' . $ this -> get ( 'engine' ) ; return empty ( $ this -> parameters [ 'bundle' ] ) ?... | Returns the path to the template - as a path when the template is not part of a bundle - as a resource when the template is part of a bundle . |
21,847 | public function getLabel ( ) { $ xpath = new \ DOMXPath ( $ this -> node -> ownerDocument ) ; if ( $ this -> node -> hasAttribute ( 'id' ) ) { $ labels = $ xpath -> query ( sprintf ( 'descendant::label[@for="%s"]' , $ this -> node -> getAttribute ( 'id' ) ) ) ; if ( $ labels -> length > 0 ) { return $ labels -> item ( ... | Returns the label tag associated to the field or null if none . |
21,848 | private function round ( $ number ) { if ( null !== $ this -> scale && null !== $ this -> roundingMode ) { $ roundingCoef = pow ( 10 , $ this -> scale ) ; $ number = ( string ) ( $ number * $ roundingCoef ) ; switch ( $ this -> roundingMode ) { case self :: ROUND_CEILING : $ number = ceil ( $ number ) ; break ; case se... | Rounds a number according to the configured scale and rounding mode . |
21,849 | private function isAssociationNullable ( array $ associationMapping ) : bool { if ( isset ( $ associationMapping [ 'id' ] ) && $ associationMapping [ 'id' ] ) { return false ; } if ( ! isset ( $ associationMapping [ 'joinColumns' ] ) ) { return true ; } $ joinColumns = $ associationMapping [ 'joinColumns' ] ; foreach (... | Determines whether an association is nullable . |
21,850 | public function isPrefix ( $ propertyPath ) { $ length = \ strlen ( $ propertyPath ) ; $ prefix = substr ( $ this -> propertyPath , 0 , $ length ) ; $ next = isset ( $ this -> propertyPath [ $ length ] ) ? $ this -> propertyPath [ $ length ] : null ; return $ prefix === $ propertyPath && ( '[' === $ next || '.' === $ n... | Matches a property path against a prefix of the rule path . |
21,851 | public function setOperator ( $ operator ) { if ( ! $ operator ) { $ operator = '==' ; } if ( ! \ in_array ( $ operator , [ '>' , '<' , '>=' , '<=' , '==' , '!=' ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid operator "%s".' , $ operator ) ) ; } $ this -> operator = $ operator ; } | Sets the comparison operator . |
21,852 | public static function log ( LoggerInterface $ logger = null , $ message , $ context = [ ] ) { if ( $ logger ) { $ logger -> warning ( $ message , $ context ) ; } else { $ replace = [ ] ; foreach ( $ context as $ k => $ v ) { if ( is_scalar ( $ v ) ) { $ replace [ '{' . $ k . '}' ] = $ v ; } } @ trigger_error ( strtr (... | Internal logging helper . |
21,853 | public function check ( $ uri ) { $ url = parse_url ( $ uri ) ; if ( isset ( $ url [ 'query' ] ) ) { parse_str ( $ url [ 'query' ] , $ params ) ; } else { $ params = [ ] ; } if ( empty ( $ params [ $ this -> parameter ] ) ) { return false ; } $ hash = $ params [ $ this -> parameter ] ; unset ( $ params [ $ this -> para... | Checks that a URI contains the correct hash . |
21,854 | public function max ( $ max ) { if ( isset ( $ this -> min ) && $ this -> min > $ max ) { throw new \ InvalidArgumentException ( sprintf ( 'You cannot define a max(%s) as you already have a min(%s)' , $ max , $ this -> min ) ) ; } $ this -> max = $ max ; return $ this ; } | Ensures that the value is smaller than the given reference . |
21,855 | public function countMessagesInQueues ( ) : int { return array_sum ( array_map ( function ( $ queueName ) { return $ this -> queue ( $ queueName ) -> declareQueue ( ) ; } , $ this -> getQueueNames ( ) ) ) ; } | Returns an approximate count of the messages in defined queues . |
21,856 | private function createDelayQueue ( int $ delay , ? string $ routingKey ) { $ queue = $ this -> amqpFactory -> createQueue ( $ this -> channel ( ) ) ; $ queue -> setName ( str_replace ( '%delay%' , $ delay , $ this -> connectionOptions [ 'delay' ] [ 'queue_name_pattern' ] ) ) ; $ queue -> setArguments ( [ 'x-message-tt... | Creates a delay queue that will delay for a certain amount of time . |
21,857 | public function get ( string $ queueName ) : ? \ AMQPEnvelope { if ( $ this -> shouldSetup ( ) ) { $ this -> setup ( ) ; } try { if ( false !== $ message = $ this -> queue ( $ queueName ) -> get ( ) ) { return $ message ; } } catch ( \ AMQPQueueException $ e ) { if ( 404 === $ e -> getCode ( ) && $ this -> shouldSetup ... | Gets a message from the specified queue . |
21,858 | private static function getRequestMethod ( ) { $ method = isset ( $ _SERVER [ 'REQUEST_METHOD' ] ) ? strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) : 'GET' ; if ( 'POST' === $ method && isset ( $ _SERVER [ 'HTTP_X_HTTP_METHOD_OVERRIDE' ] ) ) { $ method = strtoupper ( $ _SERVER [ 'HTTP_X_HTTP_METHOD_OVERRIDE' ] ) ; } ret... | Returns the method used to submit the request to the server . |
21,859 | private static function stripEmptyFiles ( $ data ) { if ( ! \ is_array ( $ data ) ) { return $ data ; } $ keys = array_keys ( $ data ) ; sort ( $ keys ) ; if ( self :: $ fileKeys === $ keys ) { if ( UPLOAD_ERR_NO_FILE === $ data [ 'error' ] ) { return null ; } return $ data ; } foreach ( $ data as $ key => $ value ) { ... | Sets empty uploaded files to NULL in the given uploaded files array . |
21,860 | public function buildForm ( FormBuilderInterface $ builder , array $ options ) { if ( null !== $ this -> parent ) { $ this -> parent -> buildForm ( $ builder , $ options ) ; } $ this -> innerType -> buildForm ( $ builder , $ options ) ; foreach ( $ this -> typeExtensions as $ extension ) { $ extension -> buildForm ( $ ... | Configures a form builder for the type hierarchy . |
21,861 | public function buildView ( FormView $ view , FormInterface $ form , array $ options ) { if ( null !== $ this -> parent ) { $ this -> parent -> buildView ( $ view , $ form , $ options ) ; } $ this -> innerType -> buildView ( $ view , $ form , $ options ) ; foreach ( $ this -> typeExtensions as $ extension ) { $ extensi... | Configures a form view for the type hierarchy . |
21,862 | public function setCsvControl ( $ delimiter = ';' , $ enclosure = '"' , $ escape = '\\' ) { $ this -> delimiter = $ delimiter ; $ this -> enclosure = $ enclosure ; $ this -> escape = $ escape ; } | Sets the delimiter enclosure and escape character for CSV . |
21,863 | private function relativeSymlinkWithFallback ( string $ originDir , string $ targetDir ) : string { try { $ this -> symlink ( $ originDir , $ targetDir , true ) ; $ method = self :: METHOD_RELATIVE_SYMLINK ; } catch ( IOException $ e ) { $ method = $ this -> absoluteSymlinkWithFallback ( $ originDir , $ targetDir ) ; }... | Try to create relative symlink . |
21,864 | public function loadProfileFromResponse ( Response $ response ) { if ( ! $ token = $ response -> headers -> get ( 'X-Debug-Token' ) ) { return false ; } return $ this -> loadProfile ( $ token ) ; } | Loads the Profile for the given Response . |
21,865 | public function saveProfile ( Profile $ profile ) { foreach ( $ profile -> getCollectors ( ) as $ collector ) { if ( $ collector instanceof LateDataCollectorInterface ) { $ collector -> lateCollect ( ) ; } } if ( ! ( $ ret = $ this -> storage -> write ( $ profile ) ) && null !== $ this -> logger ) { $ this -> logger ->... | Saves a Profile . |
21,866 | public function find ( $ ip , $ url , $ limit , $ method , $ start , $ end , $ statusCode = null ) { return $ this -> storage -> find ( $ ip , $ url , $ limit , $ method , $ this -> getTimestamp ( $ start ) , $ this -> getTimestamp ( $ end ) , $ statusCode ) ; } | Finds profiler tokens for the given criteria . |
21,867 | public function set ( array $ collectors = [ ] ) { $ this -> collectors = [ ] ; foreach ( $ collectors as $ collector ) { $ this -> add ( $ collector ) ; } } | Sets the Collectors associated with this profiler . |
21,868 | public function wrapCallback ( OutputInterface $ output , Process $ process , callable $ callback = null ) { if ( $ output instanceof ConsoleOutputInterface ) { $ output = $ output -> getErrorOutput ( ) ; } $ formatter = $ this -> getHelperSet ( ) -> get ( 'debug_formatter' ) ; return function ( $ type , $ buffer ) use... | Wraps a Process callback to add debugging output . |
21,869 | public function openSection ( $ id = null ) { $ current = end ( $ this -> activeSections ) ; if ( null !== $ id && null === $ current -> get ( $ id ) ) { throw new \ LogicException ( sprintf ( 'The section "%s" has been started at an other level and can not be opened.' , $ id ) ) ; } $ this -> start ( '__section__.chil... | Creates a new section or re - opens an existing section . |
21,870 | public function stopSection ( $ id ) { $ this -> stop ( '__section__' ) ; if ( 1 == \ count ( $ this -> activeSections ) ) { throw new \ LogicException ( 'There is no started section to stop.' ) ; } $ this -> sections [ $ id ] = array_pop ( $ this -> activeSections ) -> setId ( $ id ) ; $ this -> stop ( '__section__.ch... | Stops the last started section . |
21,871 | public function getSectionEvents ( $ id ) { return isset ( $ this -> sections [ $ id ] ) ? $ this -> sections [ $ id ] -> getEvents ( ) : [ ] ; } | Gets all events for a given section . |
21,872 | public function serialize ( iterable $ links ) { $ elements = [ ] ; foreach ( $ links as $ link ) { if ( $ link -> isTemplated ( ) ) { continue ; } $ attributesParts = [ '' , sprintf ( 'rel="%s"' , implode ( ' ' , $ link -> getRels ( ) ) ) ] ; foreach ( $ link -> getAttributes ( ) as $ key => $ value ) { if ( \ is_arra... | Builds the value of the Link HTTP header . |
21,873 | public function depth ( $ levels ) { foreach ( ( array ) $ levels as $ level ) { $ this -> depths [ ] = new Comparator \ NumberComparator ( $ level ) ; } return $ this ; } | Adds tests for the directory depth . |
21,874 | public function ignoreVCS ( $ ignoreVCS ) { if ( $ ignoreVCS ) { $ this -> ignore |= static :: IGNORE_VCS_FILES ; } else { $ this -> ignore &= ~ static :: IGNORE_VCS_FILES ; } return $ this ; } | Forces the finder to ignore version control directories . |
21,875 | public function ignoreVCSIgnored ( bool $ ignoreVCSIgnored ) { if ( $ ignoreVCSIgnored ) { $ this -> ignore |= static :: IGNORE_VCS_IGNORED_FILES ; } else { $ this -> ignore &= ~ static :: IGNORE_VCS_IGNORED_FILES ; } return $ this ; } | Forces Finder to obey . gitignore and ignore files based on rules listed there . |
21,876 | public static function addVCSPattern ( $ pattern ) { foreach ( ( array ) $ pattern as $ p ) { self :: $ vcsPatterns [ ] = $ p ; } self :: $ vcsPatterns = array_unique ( self :: $ vcsPatterns ) ; } | Adds VCS patterns . |
21,877 | public function sortByName ( ) { if ( \ func_num_args ( ) < 1 && __CLASS__ !== \ get_class ( $ this ) && __CLASS__ !== ( new \ ReflectionMethod ( $ this , __FUNCTION__ ) ) -> getDeclaringClass ( ) -> getName ( ) && ! $ this instanceof \ PHPUnit \ Framework \ MockObject \ MockObject && ! $ this instanceof \ Prophecy \ P... | Sorts files and directories by name . |
21,878 | private function normalizeDir ( $ dir ) { $ dir = rtrim ( $ dir , '/' . \ DIRECTORY_SEPARATOR ) ; if ( preg_match ( '#^s?ftp://#' , $ dir ) ) { $ dir .= '/' ; } return $ dir ; } | Normalizes given directory names by removing trailing slashes . |
21,879 | public function run ( array $ options = [ ] , callable $ onHandledCallback = null ) : void { $ options = array_merge ( [ 'sleep' => 1000000 , ] , $ options ) ; if ( \ function_exists ( 'pcntl_signal' ) ) { pcntl_signal ( SIGTERM , function ( ) { $ this -> stop ( ) ; } ) ; } $ onHandled = function ( ? Envelope $ envelop... | Receive the messages and dispatch them to the bus . |
21,880 | final public function autoconfigure ( bool $ autoconfigured = true ) { if ( $ autoconfigured && $ this -> definition instanceof ChildDefinition ) { throw new InvalidArgumentException ( sprintf ( 'The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.' , $... | Sets whether or not instanceof conditionals should be prepended with a global set . |
21,881 | public function filter ( $ pattern ) { return new self ( array_filter ( $ this -> items , function ( AcceptHeaderItem $ item ) use ( $ pattern ) { return preg_match ( $ pattern , $ item -> getValue ( ) ) ; } ) ) ; } | Filters items on their value using given regex . |
21,882 | public function rule ( \ Closure $ closure = null ) { if ( null !== $ closure ) { $ this -> rules [ ] = $ closure ; return $ this ; } return $ this -> rules [ ] = new ExprBuilder ( $ this -> node ) ; } | Registers a closure to run as normalization or an expression builder to build it if null is provided . |
21,883 | public function setHidden ( $ hidden ) { if ( $ this -> autocompleterCallback ) { throw new LogicException ( 'A hidden question cannot use the autocompleter.' ) ; } $ this -> hidden = ( bool ) $ hidden ; return $ this ; } | Sets whether the user response must be hidden or not . |
21,884 | public function setAutocompleterValues ( $ values ) { if ( \ is_array ( $ values ) ) { $ values = $ this -> isAssoc ( $ values ) ? array_merge ( array_keys ( $ values ) , array_values ( $ values ) ) : array_values ( $ values ) ; $ callback = static function ( ) use ( $ values ) { return $ values ; } ; } elseif ( $ valu... | Sets values for the autocompleter . |
21,885 | public function setAutocompleterCallback ( callable $ callback = null ) : self { if ( $ this -> hidden && null !== $ callback ) { throw new LogicException ( 'A hidden question cannot use the autocompleter.' ) ; } $ this -> autocompleterCallback = $ callback ; return $ this ; } | Sets the callback function used for the autocompleter . |
21,886 | public function setMaxAttempts ( $ attempts ) { if ( null !== $ attempts && $ attempts < 1 ) { throw new InvalidArgumentException ( 'Maximum number of attempts must be a positive value.' ) ; } $ this -> attempts = $ attempts ; return $ this ; } | Sets the maximum number of attempts . |
21,887 | public function always ( \ Closure $ then = null ) { $ this -> ifPart = function ( $ v ) { return true ; } ; if ( null !== $ then ) { $ this -> thenPart = $ then ; } return $ this ; } | Marks the expression as being always used . |
21,888 | public function ifTrue ( \ Closure $ closure = null ) { if ( null === $ closure ) { $ closure = function ( $ v ) { return true === $ v ; } ; } $ this -> ifPart = $ closure ; return $ this ; } | Sets a closure to use as tests . |
21,889 | public function castToArray ( ) { $ this -> ifPart = function ( $ v ) { return ! \ is_array ( $ v ) ; } ; $ this -> thenPart = function ( $ v ) { return [ $ v ] ; } ; return $ this ; } | Transforms variables of any type into an array . |
21,890 | public function thenInvalid ( $ message ) { $ this -> thenPart = function ( $ v ) use ( $ message ) { throw new \ InvalidArgumentException ( sprintf ( $ message , json_encode ( $ v ) ) ) ; } ; return $ this ; } | Sets a closure marking the value as invalid at processing time . |
21,891 | public function end ( ) { if ( null === $ this -> ifPart ) { throw new \ RuntimeException ( 'You must specify an if part.' ) ; } if ( null === $ this -> thenPart ) { throw new \ RuntimeException ( 'You must specify a then part.' ) ; } return $ this -> node ; } | Returns the related node . |
21,892 | public static function buildExpressions ( array $ expressions ) { foreach ( $ expressions as $ k => $ expr ) { if ( $ expr instanceof self ) { $ if = $ expr -> ifPart ; $ then = $ expr -> thenPart ; $ expressions [ $ k ] = function ( $ v ) use ( $ if , $ then ) { return $ if ( $ v ) ? $ then ( $ v ) : $ v ; } ; } } ret... | Builds the expressions . |
21,893 | protected function isAccepted ( $ string ) { foreach ( $ this -> noMatchRegexps as $ regex ) { if ( preg_match ( $ regex , $ string ) ) { return false ; } } if ( $ this -> matchRegexps ) { foreach ( $ this -> matchRegexps as $ regex ) { if ( preg_match ( $ regex , $ string ) ) { return true ; } } return false ; } retur... | Checks whether the string is accepted by the regex filters . |
21,894 | public function setErrorCode ( $ error ) { $ codes = [ UPLOAD_ERR_INI_SIZE , UPLOAD_ERR_FORM_SIZE , UPLOAD_ERR_PARTIAL , UPLOAD_ERR_NO_FILE , UPLOAD_ERR_NO_TMP_DIR , UPLOAD_ERR_CANT_WRITE , UPLOAD_ERR_EXTENSION ] ; if ( ! \ in_array ( $ error , $ codes ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The error c... | Sets the PHP error code associated with the field . |
21,895 | public function get ( $ key , $ default = null ) { if ( $ this !== $ result = $ this -> attributes -> get ( $ key , $ this ) ) { return $ result ; } if ( $ this !== $ result = $ this -> query -> get ( $ key , $ this ) ) { return $ result ; } if ( $ this !== $ result = $ this -> request -> get ( $ key , $ this ) ) { ret... | Gets a parameter value from any bag . |
21,896 | public function getSession ( ) { $ session = $ this -> session ; if ( ! $ session instanceof SessionInterface && null !== $ session ) { $ this -> setSession ( $ session = $ session ( ) ) ; } if ( null === $ session ) { @ trigger_error ( sprintf ( 'Calling "%s()" when no session has been set is deprecated since Symfony ... | Gets the Session . |
21,897 | public function getPathInfo ( ) { if ( null === $ this -> pathInfo ) { $ this -> pathInfo = $ this -> preparePathInfo ( ) ; } return $ this -> pathInfo ; } | Returns the path being requested relative to the executed script . |
21,898 | public function getBaseUrl ( ) { if ( null === $ this -> baseUrl ) { $ this -> baseUrl = $ this -> prepareBaseUrl ( ) ; } return $ this -> baseUrl ; } | Returns the root URL from which this request is executed . |
21,899 | public static function getMimeTypes ( $ format ) { if ( null === static :: $ formats ) { static :: initializeFormats ( ) ; } return isset ( static :: $ formats [ $ format ] ) ? static :: $ formats [ $ format ] : [ ] ; } | Gets the mime types associated with the format . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.