idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
21,500 | public function repr ( $ value ) { if ( \ is_int ( $ value ) || \ is_float ( $ value ) ) { if ( false !== $ locale = setlocale ( LC_NUMERIC , 0 ) ) { setlocale ( LC_NUMERIC , 'C' ) ; } $ this -> raw ( $ value ) ; if ( false !== $ locale ) { setlocale ( LC_NUMERIC , $ locale ) ; } } elseif ( null === $ value ) { $ this ... | Returns a PHP representation of a given value . |
21,501 | private function optimizeListeners ( string $ eventName ) : array { krsort ( $ this -> listeners [ $ eventName ] ) ; $ this -> optimized [ $ eventName ] = [ ] ; foreach ( $ this -> listeners [ $ eventName ] as & $ listeners ) { foreach ( $ listeners as & $ listener ) { $ closure = & $ this -> optimized [ $ eventName ] ... | Optimizes the internal list of listeners for the given event by priority . |
21,502 | protected function instantiateNode ( ) { if ( null === $ this -> values ) { throw new \ RuntimeException ( 'You must call ->values() on enum nodes.' ) ; } return new EnumNode ( $ this -> name , $ this -> parent , $ this -> values , $ this -> pathSeparator ) ; } | Instantiate a Node . |
21,503 | public function asort ( & $ array , $ sortFlag = self :: SORT_REGULAR ) { $ intlToPlainFlagMap = [ self :: SORT_REGULAR => \ SORT_REGULAR , self :: SORT_NUMERIC => \ SORT_NUMERIC , self :: SORT_STRING => \ SORT_STRING , ] ; $ plainSortFlag = isset ( $ intlToPlainFlagMap [ $ sortFlag ] ) ? $ intlToPlainFlagMap [ $ sortF... | Sort array maintaining index association . |
21,504 | public function scanLocales ( $ sourceDir ) { $ locales = glob ( $ sourceDir . '/*.txt' ) ; array_walk ( $ locales , function ( & $ locale ) { $ locale = basename ( $ locale , '.txt' ) ; } ) ; $ locales = array_filter ( $ locales , function ( $ locale ) { return preg_match ( '/^[a-z]{2}(_.+)?$/' , $ locale ) ; } ) ; so... | Returns all locales found in the given directory . |
21,505 | public function scanAliases ( $ sourceDir ) { $ locales = $ this -> scanLocales ( $ sourceDir ) ; $ aliases = [ ] ; foreach ( $ locales as $ locale ) { $ content = file_get_contents ( $ sourceDir . '/' . $ locale . '.txt' ) ; if ( preg_match ( '/"%%ALIAS"\{"([^"]+)"\}/' , $ content , $ matches ) ) { $ aliases [ $ local... | Returns all locale aliases found in the given directory . |
21,506 | public function scanParents ( string $ sourceDir ) : array { $ locales = $ this -> scanLocales ( $ sourceDir ) ; $ fallbacks = [ ] ; foreach ( $ locales as $ locale ) { $ content = \ file_get_contents ( $ sourceDir . '/' . $ locale . '.txt' ) ; if ( \ preg_match ( '/%%Parent{"([^"]+)"}/' , $ content , $ matches ) ) { $... | Returns all locale parents found in the given directory . |
21,507 | final public function set ( string $ name , $ value ) { $ this -> container -> setParameter ( $ name , static :: processValue ( $ value , true ) ) ; return $ this ; } | Creates a parameter . |
21,508 | protected function validateInput ( InputInterface $ input ) { $ options = [ 'tags' , 'tag' , 'parameters' , 'parameter' ] ; $ optionsCount = 0 ; foreach ( $ options as $ option ) { if ( $ input -> getOption ( $ option ) ) { ++ $ optionsCount ; } } $ name = $ input -> getArgument ( 'name' ) ; if ( ( null !== $ name ) &&... | Validates input arguments and options . |
21,509 | public function truncate ( $ message , $ length , $ suffix = '...' ) { $ computedLength = $ length - $ this -> strlen ( $ suffix ) ; if ( $ computedLength > $ this -> strlen ( $ message ) ) { return $ message ; } if ( false === $ encoding = mb_detect_encoding ( $ message , null , true ) ) { return substr ( $ message , ... | Truncates a message to the given length . |
21,510 | final public function collection ( $ name = '' ) { return new self ( $ this -> collection , $ this -> name . $ name , $ this , $ this -> prefixes ) ; } | Creates a sub - collection . |
21,511 | public function getContainerExtension ( ) { if ( null === $ this -> extension ) { $ extension = $ this -> createContainerExtension ( ) ; if ( null !== $ extension ) { if ( ! $ extension instanceof ExtensionInterface ) { throw new \ LogicException ( sprintf ( 'Extension %s must implement Symfony\Component\DependencyInje... | Returns the bundle s container extension . |
21,512 | private function getNormalizer ( $ data , ? string $ format , array $ context ) { if ( $ this -> cachedNormalizers !== $ this -> normalizers ) { $ this -> cachedNormalizers = $ this -> normalizers ; $ this -> denormalizerCache = $ this -> normalizerCache = [ ] ; } $ type = \ is_object ( $ data ) ? \ get_class ( $ data ... | Returns a matching normalizer . |
21,513 | private function getDenormalizer ( $ data , string $ class , ? string $ format , array $ context ) { if ( $ this -> cachedNormalizers !== $ this -> normalizers ) { $ this -> cachedNormalizers = $ this -> normalizers ; $ this -> denormalizerCache = $ this -> normalizerCache = [ ] ; } if ( ! isset ( $ this -> denormalize... | Returns a matching denormalizer . |
21,514 | public static function wrap ( $ message , array $ stamps = [ ] ) : self { $ envelope = $ message instanceof self ? $ message : new self ( $ message ) ; return $ envelope -> with ( ... $ stamps ) ; } | Makes sure the message is in an Envelope and adds the given stamps . |
21,515 | private function formatDateTimeErrors ( array $ errors ) { $ formattedErrors = [ ] ; foreach ( $ errors as $ pos => $ message ) { $ formattedErrors [ ] = sprintf ( 'at position %d: %s' , $ pos , $ message ) ; } return $ formattedErrors ; } | Formats datetime errors . |
21,516 | private function resolveEngines ( ) { foreach ( $ this -> engines as $ i => $ engine ) { if ( \ is_string ( $ engine ) ) { $ this -> engines [ $ i ] = $ this -> container -> get ( $ engine ) ; } } } | Resolved engine ids to their real engine instances from the container . |
21,517 | public function addPass ( CompilerPassInterface $ pass , $ type = PassConfig :: TYPE_BEFORE_OPTIMIZATION , int $ priority = 0 ) { $ this -> passConfig -> addPass ( $ pass , $ type , $ priority ) ; } | Adds a pass to the PassConfig . |
21,518 | public function compile ( ContainerBuilder $ container ) { try { foreach ( $ this -> passConfig -> getPasses ( ) as $ pass ) { $ pass -> process ( $ container ) ; } } catch ( \ Exception $ e ) { $ usedEnvs = [ ] ; $ prev = $ e ; do { $ msg = $ prev -> getMessage ( ) ; if ( $ msg !== $ resolvedMsg = $ container -> resol... | Run the Compiler and process all Passes . |
21,519 | private function addMetadata ( array $ values ) { foreach ( $ values as $ domain => $ keys ) { foreach ( $ keys as $ key => $ value ) { $ this -> setMetadata ( $ key , $ value , $ domain ) ; } } } | Adds current values with the new values . |
21,520 | public function redirectAction ( Request $ request , string $ route , bool $ permanent = false , $ ignoreAttributes = false , bool $ keepRequestMethod = false , bool $ keepQueryParams = false ) : Response { if ( '' == $ route ) { throw new HttpException ( $ permanent ? 410 : 404 ) ; } $ attributes = [ ] ; if ( false ==... | Redirects to another route with the given name . |
21,521 | public function getEngine ( $ name ) { foreach ( $ this -> engines as $ engine ) { if ( $ engine -> supports ( $ name ) ) { return $ engine ; } } throw new \ RuntimeException ( sprintf ( 'No engine is able to work with the template "%s".' , $ name ) ) ; } | Get an engine able to render the given template . |
21,522 | protected function buildHeader ( $ name , $ value ) { @ trigger_error ( sprintf ( 'The "%s()" method is deprecated since Symfony 4.3.' , __METHOD__ ) , E_USER_DEPRECATED ) ; return sprintf ( "%s: %s\n" , $ name , $ value ) ; } | Returns the build header line . |
21,523 | public function addHint ( $ hint ) { if ( ! $ this -> containsHints ) { $ this -> message .= "\nHint: " . $ hint ; $ this -> containsHints = true ; } else { $ this -> message .= ', ' . $ hint ; } } | Adds extra information that is suffixed to the original exception message . |
21,524 | protected function preNormalize ( $ value ) { if ( ! $ this -> normalizeKeys || ! \ is_array ( $ value ) ) { return $ value ; } $ normalized = [ ] ; foreach ( $ value as $ k => $ v ) { if ( false !== strpos ( $ k , '-' ) && false === strpos ( $ k , '_' ) && ! \ array_key_exists ( $ normalizedKey = str_replace ( '-' , '... | Normalizes keys between the different configuration formats . |
21,525 | public function setIgnoreExtraKeys ( $ boolean , $ remove = true ) { $ this -> ignoreExtraKeys = ( bool ) $ boolean ; $ this -> removeExtraKeys = $ this -> ignoreExtraKeys && $ remove ; } | Whether extra keys should just be ignore without an exception . |
21,526 | public function addChild ( NodeInterface $ node ) { $ name = $ node -> getName ( ) ; if ( ! \ strlen ( $ name ) ) { throw new \ InvalidArgumentException ( 'Child nodes must be named.' ) ; } if ( isset ( $ this -> children [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'A child node named "%s" already... | Adds a child node . |
21,527 | protected function remapXml ( $ value ) { foreach ( $ this -> xmlRemappings as list ( $ singular , $ plural ) ) { if ( ! isset ( $ value [ $ singular ] ) ) { continue ; } $ value [ $ plural ] = Processor :: normalizeConfig ( $ value , $ singular , $ plural ) ; unset ( $ value [ $ singular ] ) ; } return $ value ; } | Remaps multiple singular values to a single plural value . |
21,528 | private function castableToString ( array $ choices , array & $ cache = [ ] ) { foreach ( $ choices as $ choice ) { if ( \ is_array ( $ choice ) ) { if ( ! $ this -> castableToString ( $ choice , $ cache ) ) { return false ; } continue ; } elseif ( ! is_scalar ( $ choice ) ) { return false ; } $ choice = false === $ ch... | Checks whether the given choices can be cast to strings without generating duplicates . This method is responsible for preventing conflict between scalar values and the empty value . |
21,529 | public function setPath ( $ pattern ) { if ( false !== strpbrk ( $ pattern , '?<' ) ) { $ pattern = preg_replace_callback ( '#\{(\w++)(<.*?>)?(\?[^\}]*+)?\}#' , function ( $ m ) { if ( isset ( $ m [ 3 ] [ 0 ] ) ) { $ this -> setDefault ( $ m [ 1 ] , '?' !== $ m [ 3 ] ? substr ( $ m [ 3 ] , 1 ) : null ) ; } if ( isset (... | Sets the pattern for the path . |
21,530 | public function setHost ( $ pattern ) { $ this -> host = ( string ) $ pattern ; $ this -> compiled = null ; return $ this ; } | Sets the pattern for the host . |
21,531 | public function setOption ( $ name , $ value ) { $ this -> options [ $ name ] = $ value ; $ this -> compiled = null ; return $ this ; } | Sets an option value . |
21,532 | public function getDefault ( $ name ) { return isset ( $ this -> defaults [ $ name ] ) ? $ this -> defaults [ $ name ] : null ; } | Gets a default value . |
21,533 | public function addRequirements ( array $ requirements ) { foreach ( $ requirements as $ key => $ regex ) { $ this -> requirements [ $ key ] = $ this -> sanitizeRequirement ( $ key , $ regex ) ; } $ this -> compiled = null ; return $ this ; } | Adds requirements . |
21,534 | public function getRequirement ( $ key ) { return isset ( $ this -> requirements [ $ key ] ) ? $ this -> requirements [ $ key ] : null ; } | Returns the requirement for the given key . |
21,535 | public function setRequirement ( $ key , $ regex ) { $ this -> requirements [ $ key ] = $ this -> sanitizeRequirement ( $ key , $ regex ) ; $ this -> compiled = null ; return $ this ; } | Sets a requirement for the given key . |
21,536 | public function setCondition ( $ condition ) { $ this -> condition = ( string ) $ condition ; $ this -> compiled = null ; return $ this ; } | Sets the condition . |
21,537 | public function compile ( ) { if ( null !== $ this -> compiled ) { return $ this -> compiled ; } $ class = $ this -> getOption ( 'compiler_class' ) ; return $ this -> compiled = $ class :: compile ( $ this ) ; } | Compiles the route . |
21,538 | public static function parse ( $ str ) { $ bLength = 0 ; if ( 'b' === $ str [ 0 ] ) { $ bLength = 1 ; } if ( '\'' === $ str [ $ bLength ] ) { return str_replace ( [ '\\\\' , '\\\'' ] , [ '\\' , '\'' ] , substr ( $ str , $ bLength + 1 , - 1 ) ) ; } else { return self :: parseEscapeSequences ( substr ( $ str , $ bLength ... | Parses a string token . |
21,539 | public static function parseDocString ( $ startToken , $ str ) { $ str = preg_replace ( '~(\r\n|\n|\r)$~' , '' , $ str ) ; if ( false !== strpos ( $ startToken , '\'' ) ) { return $ str ; } return self :: parseEscapeSequences ( $ str , null ) ; } | Parses a constant doc string . |
21,540 | public function setRestartThreshold ( int $ threshold , int $ sleep = 0 ) : self { $ this -> restartThreshold = $ threshold ; $ this -> restartThresholdSleep = $ sleep ; return $ this ; } | Sets the maximum number of messages to send before re - starting the transport . |
21,541 | public function setLocalDomain ( string $ domain ) : self { if ( '' !== $ domain && '[' !== $ domain [ 0 ] ) { if ( filter_var ( $ domain , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) ) { $ domain = '[' . $ domain . ']' ; } elseif ( filter_var ( $ domain , FILTER_VALIDATE_IP , FILTER_FLAG_IPV6 ) ) { $ domain = '[IPv6:' . $... | Sets the name of the local domain that will be used in HELO . |
21,542 | public function executeCommand ( string $ command , array $ codes ) : string { $ this -> getLogger ( ) -> debug ( sprintf ( 'Email transport "%s" sent command "%s"' , __CLASS__ , trim ( $ command ) ) ) ; $ this -> stream -> write ( $ command ) ; $ response = $ this -> getFullResponse ( ) ; $ this -> assertResponseCode ... | Runs a command against the stream expecting the given response codes . |
21,543 | protected function generateFragmentUri ( ControllerReference $ reference , Request $ request , $ absolute = false , $ strict = true ) { if ( $ strict ) { $ this -> checkNonScalar ( $ reference -> attributes ) ; } if ( ! isset ( $ reference -> attributes [ '_format' ] ) ) { $ reference -> attributes [ '_format' ] = $ re... | Generates a fragment URI for a given controller . |
21,544 | public function getValues ( ) { if ( ! $ this -> storeSerialized ) { return $ this -> values ; } $ values = $ this -> values ; foreach ( $ values as $ k => $ v ) { if ( null === $ v || 'N;' === $ v ) { continue ; } if ( ! \ is_string ( $ v ) || ! isset ( $ v [ 2 ] ) || ':' !== $ v [ 1 ] ) { $ values [ $ k ] = serialize... | Returns all cached values with cache miss as null . |
21,545 | protected function requiresLogout ( Request $ request ) { return isset ( $ this -> options [ 'logout_path' ] ) && $ this -> httpUtils -> checkRequestPath ( $ request , $ this -> options [ 'logout_path' ] ) ; } | Whether this request is asking for logout . |
21,546 | public static function getStyleDefinition ( $ name ) { if ( ! self :: $ styles ) { self :: $ styles = self :: initStyles ( ) ; } if ( isset ( self :: $ styles [ $ name ] ) ) { return self :: $ styles [ $ name ] ; } throw new InvalidArgumentException ( sprintf ( 'Style "%s" is not defined.' , $ name ) ) ; } | Gets a style definition by name . |
21,547 | public function setColumnStyle ( $ columnIndex , $ name ) { $ columnIndex = ( int ) $ columnIndex ; $ this -> columnStyles [ $ columnIndex ] = $ this -> resolveStyle ( $ name ) ; return $ this ; } | Sets table column style . |
21,548 | public function setColumnWidth ( $ columnIndex , $ width ) { $ this -> columnWidths [ ( int ) $ columnIndex ] = ( int ) $ width ; return $ this ; } | Sets the minimum width of a column . |
21,549 | public function setColumnWidths ( array $ widths ) { $ this -> columnWidths = [ ] ; foreach ( $ widths as $ index => $ width ) { $ this -> setColumnWidth ( $ index , $ width ) ; } return $ this ; } | Sets the minimum width of all columns . |
21,550 | public function setColumnMaxWidth ( int $ columnIndex , int $ width ) : self { if ( ! $ this -> output -> getFormatter ( ) instanceof WrappableOutputFormatterInterface ) { throw new \ LogicException ( sprintf ( 'Setting a maximum column width is only supported when using a "%s" formatter, got "%s".' , WrappableOutputFo... | Sets the maximum width of a column . |
21,551 | public function appendRow ( $ row ) : self { if ( ! $ this -> output instanceof ConsoleSectionOutput ) { throw new RuntimeException ( sprintf ( 'Output should be an instance of "%s" when calling "%s".' , ConsoleSectionOutput :: class , __METHOD__ ) ) ; } if ( $ this -> rendered ) { $ this -> output -> clear ( $ this ->... | Adds a row to the table and re - renders the table . |
21,552 | private function renderColumnSeparator ( $ type = self :: BORDER_OUTSIDE ) { $ borders = $ this -> style -> getBorderChars ( ) ; return sprintf ( $ this -> style -> getBorderFormat ( ) , self :: BORDER_OUTSIDE === $ type ? $ borders [ 1 ] : $ borders [ 3 ] ) ; } | Renders vertical column separator . |
21,553 | private function fillCells ( $ row ) { $ newRow = [ ] ; foreach ( $ row as $ column => $ cell ) { $ newRow [ ] = $ cell ; if ( $ cell instanceof TableCell && $ cell -> getColspan ( ) > 1 ) { foreach ( range ( $ column + 1 , $ column + $ cell -> getColspan ( ) - 1 ) as $ position ) { $ newRow [ ] = '' ; } } } return $ n... | fill cells for a row that contains colspan > 1 . |
21,554 | public function getIdValue ( $ object ) { if ( ! $ object ) { return ; } if ( ! $ this -> om -> contains ( $ object ) ) { throw new RuntimeException ( sprintf ( 'Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?' , \ get_class ( $ object ) ) ) ; } $ th... | Returns the ID value for an object . |
21,555 | public function register ( $ name , callable $ compiler , callable $ evaluator ) { if ( null !== $ this -> parser ) { throw new \ LogicException ( 'Registering functions after calling evaluate(), compile() or parse() is not supported.' ) ; } $ this -> functions [ $ name ] = [ 'compiler' => $ compiler , 'evaluator' => $... | Registers a function . |
21,556 | public function getAddressStrings ( ) : array { $ strings = [ ] ; foreach ( $ this -> addresses as $ address ) { $ str = $ address -> getEncodedAddress ( ) ; if ( $ address instanceof NamedAddress && $ name = $ address -> getName ( ) ) { $ str = $ this -> createPhrase ( $ this , $ name , $ this -> getCharset ( ) , empt... | Gets the full mailbox list of this Header as an array of valid RFC 2822 strings . |
21,557 | public function setInvalidMessage ( string $ invalidMessage = null , array $ invalidMessageParameters = [ ] ) : void { $ this -> invalidMessage = $ invalidMessage ; $ this -> invalidMessageParameters = $ invalidMessageParameters ; } | Sets the message that will be shown to the user . |
21,558 | public function setDefault ( $ option , $ value ) { if ( $ this -> locked ) { throw new AccessException ( 'Default values cannot be set from a lazy option or normalizer.' ) ; } if ( $ value instanceof \ Closure ) { $ reflClosure = new \ ReflectionFunction ( $ value ) ; $ params = $ reflClosure -> getParameters ( ) ; if... | Sets the default value of a given option . |
21,559 | public function setDefaults ( array $ defaults ) { foreach ( $ defaults as $ option => $ value ) { $ this -> setDefault ( $ option , $ value ) ; } return $ this ; } | Sets a list of default values . |
21,560 | public function setRequired ( $ optionNames ) { if ( $ this -> locked ) { throw new AccessException ( 'Options cannot be made required from a lazy option or normalizer.' ) ; } foreach ( ( array ) $ optionNames as $ option ) { $ this -> defined [ $ option ] = true ; $ this -> required [ $ option ] = true ; } return $ th... | Marks one or more options as required . |
21,561 | public function isMissing ( $ option ) { return isset ( $ this -> required [ $ option ] ) && ! \ array_key_exists ( $ option , $ this -> defaults ) ; } | Returns whether an option is missing a default value . |
21,562 | public function setDefined ( $ optionNames ) { if ( $ this -> locked ) { throw new AccessException ( 'Options cannot be defined from a lazy option or normalizer.' ) ; } foreach ( ( array ) $ optionNames as $ option ) { $ this -> defined [ $ option ] = true ; } return $ this ; } | Defines a valid option name . |
21,563 | public function setDeprecated ( string $ option , $ deprecationMessage = 'The option "%name%" is deprecated.' ) : self { if ( $ this -> locked ) { throw new AccessException ( 'Options cannot be deprecated from a lazy option or normalizer.' ) ; } if ( ! isset ( $ this -> defined [ $ option ] ) ) { throw new UndefinedOpt... | Deprecates an option allowed types or values . |
21,564 | public function setNormalizer ( $ option , \ Closure $ normalizer ) { if ( $ this -> locked ) { throw new AccessException ( 'Normalizers cannot be set from a lazy option or normalizer.' ) ; } if ( ! isset ( $ this -> defined [ $ option ] ) ) { throw new UndefinedOptionsException ( sprintf ( 'The option "%s" does not ex... | Sets the normalizer for an option . |
21,565 | public function addNormalizer ( string $ option , \ Closure $ normalizer , bool $ forcePrepend = false ) : self { if ( $ this -> locked ) { throw new AccessException ( 'Normalizers cannot be set from a lazy option or normalizer.' ) ; } if ( ! isset ( $ this -> defined [ $ option ] ) ) { throw new UndefinedOptionsExcept... | Adds a normalizer for an option . |
21,566 | public function setAllowedValues ( $ option , $ allowedValues ) { if ( $ this -> locked ) { throw new AccessException ( 'Allowed values cannot be set from a lazy option or normalizer.' ) ; } if ( ! isset ( $ this -> defined [ $ option ] ) ) { throw new UndefinedOptionsException ( sprintf ( 'The option "%s" does not exi... | Sets allowed values for an option . |
21,567 | public function addAllowedValues ( $ option , $ allowedValues ) { if ( $ this -> locked ) { throw new AccessException ( 'Allowed values cannot be added from a lazy option or normalizer.' ) ; } if ( ! isset ( $ this -> defined [ $ option ] ) ) { throw new UndefinedOptionsException ( sprintf ( 'The option "%s" does not e... | Adds allowed values for an option . |
21,568 | public function setAllowedTypes ( $ option , $ allowedTypes ) { if ( $ this -> locked ) { throw new AccessException ( 'Allowed types cannot be set from a lazy option or normalizer.' ) ; } if ( ! isset ( $ this -> defined [ $ option ] ) ) { throw new UndefinedOptionsException ( sprintf ( 'The option "%s" does not exist.... | Sets allowed types for an option . |
21,569 | public function addAllowedTypes ( $ option , $ allowedTypes ) { if ( $ this -> locked ) { throw new AccessException ( 'Allowed types cannot be added from a lazy option or normalizer.' ) ; } if ( ! isset ( $ this -> defined [ $ option ] ) ) { throw new UndefinedOptionsException ( sprintf ( 'The option "%s" does not exis... | Adds allowed types for an option . |
21,570 | public function remove ( $ optionNames ) { if ( $ this -> locked ) { throw new AccessException ( 'Options cannot be removed from a lazy option or normalizer.' ) ; } foreach ( ( array ) $ optionNames as $ option ) { unset ( $ this -> defined [ $ option ] , $ this -> defaults [ $ option ] , $ this -> required [ $ option ... | Removes the option with the given name . |
21,571 | public function clear ( ) { if ( $ this -> locked ) { throw new AccessException ( 'Options cannot be cleared from a lazy option or normalizer.' ) ; } $ this -> defined = [ ] ; $ this -> defaults = [ ] ; $ this -> nested = [ ] ; $ this -> required = [ ] ; $ this -> resolved = [ ] ; $ this -> lazy = [ ] ; $ this -> norma... | Removes all options . |
21,572 | public function resolve ( array $ options = [ ] ) { if ( $ this -> locked ) { throw new AccessException ( 'Options cannot be resolved from a lazy option or normalizer.' ) ; } $ clone = clone $ this ; $ diff = array_diff_key ( $ options , $ clone -> defined ) ; if ( \ count ( $ diff ) > 0 ) { ksort ( $ clone -> defined ... | Merges options with the default values stored in the container and validates them . |
21,573 | protected function write ( $ content , $ decorated = false ) { $ this -> output -> write ( $ content , false , $ decorated ? OutputInterface :: OUTPUT_NORMAL : OutputInterface :: OUTPUT_RAW ) ; } | Writes content to output . |
21,574 | protected function formatValue ( $ value ) { if ( \ is_object ( $ value ) ) { return sprintf ( 'object(%s)' , \ get_class ( $ value ) ) ; } if ( \ is_string ( $ value ) ) { return $ value ; } return preg_replace ( "/\n\s*/s" , '' , var_export ( $ value , true ) ) ; } | Formats a value as string . |
21,575 | protected function formatParameter ( $ value ) { if ( \ is_bool ( $ value ) || \ is_array ( $ value ) || ( null === $ value ) ) { $ jsonString = json_encode ( $ value ) ; if ( preg_match ( '/^(.{60})./us' , $ jsonString , $ matches ) ) { return $ matches [ 1 ] . '...' ; } return $ jsonString ; } return ( string ) $ val... | Formats a parameter . |
21,576 | public static function getClassDescription ( string $ class , string & $ resolvedClass = null ) : string { $ resolvedClass = $ class ; try { $ resource = new ClassExistenceResource ( $ class , false ) ; $ resource -> isFresh ( 0 ) ; $ r = new \ ReflectionClass ( $ class ) ; $ resolvedClass = $ r -> name ; if ( $ docCom... | Gets class description from a docblock . |
21,577 | final public function parent ( string $ parent ) { if ( ! $ this -> allowParent ) { throw new InvalidArgumentException ( sprintf ( 'A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".' , $ this -> id ) ) ; } if ( $ this -> definition instanceof ChildDefinitio... | Sets the Definition to inherit from . |
21,578 | protected function getFileLoaders ( $ paths ) { $ loaders = [ ] ; foreach ( $ paths as $ path ) { $ loaders [ ] = $ this -> getFileLoaderInstance ( $ path ) ; } return $ loaders ; } | Returns an array of file loaders for the given file paths . |
21,579 | public function addXmlContent ( $ content , $ charset = 'UTF-8' , $ options = LIBXML_NONET ) { if ( ! preg_match ( '/xmlns:/' , $ content ) ) { $ content = str_replace ( 'xmlns' , 'ns' , $ content ) ; } $ internalErrors = libxml_use_internal_errors ( true ) ; $ disableEntities = libxml_disable_entity_loader ( true ) ; ... | Adds an XML content to the list of nodes . |
21,580 | public function addNodeList ( \ DOMNodeList $ nodes ) { foreach ( $ nodes as $ node ) { if ( $ node instanceof \ DOMNode ) { $ this -> addNode ( $ node ) ; } } } | Adds a \ DOMNodeList to the list of nodes . |
21,581 | public function eq ( $ position ) { if ( isset ( $ this -> nodes [ $ position ] ) ) { return $ this -> createSubCrawler ( $ this -> nodes [ $ position ] ) ; } return $ this -> createSubCrawler ( null ) ; } | Returns a node given its position in the node list . |
21,582 | public function each ( \ Closure $ closure ) { $ data = [ ] ; foreach ( $ this -> nodes as $ i => $ node ) { $ data [ ] = $ closure ( $ this -> createSubCrawler ( $ node ) , $ i ) ; } return $ data ; } | Calls an anonymous function on each node of the list . |
21,583 | public function reduce ( \ Closure $ closure ) { $ nodes = [ ] ; foreach ( $ this -> nodes as $ i => $ node ) { if ( false !== $ closure ( $ this -> createSubCrawler ( $ node ) , $ i ) ) { $ nodes [ ] = $ node ; } } return $ this -> createSubCrawler ( $ nodes ) ; } | Reduces the list of nodes by calling an anonymous function . |
21,584 | public function siblings ( ) { if ( ! $ this -> nodes ) { throw new \ InvalidArgumentException ( 'The current node list is empty.' ) ; } return $ this -> createSubCrawler ( $ this -> sibling ( $ this -> getNode ( 0 ) -> parentNode -> firstChild ) ) ; } | Returns the siblings nodes of the current selection . |
21,585 | public function nextAll ( ) { if ( ! $ this -> nodes ) { throw new \ InvalidArgumentException ( 'The current node list is empty.' ) ; } return $ this -> createSubCrawler ( $ this -> sibling ( $ this -> getNode ( 0 ) ) ) ; } | Returns the next siblings nodes of the current selection . |
21,586 | public function previousAll ( ) { if ( ! $ this -> nodes ) { throw new \ InvalidArgumentException ( 'The current node list is empty.' ) ; } return $ this -> createSubCrawler ( $ this -> sibling ( $ this -> getNode ( 0 ) , 'previousSibling' ) ) ; } | Returns the previous sibling nodes of the current selection . |
21,587 | public function extract ( $ attributes ) { $ attributes = ( array ) $ attributes ; $ count = \ count ( $ attributes ) ; $ data = [ ] ; foreach ( $ this -> nodes as $ node ) { $ elements = [ ] ; foreach ( $ attributes as $ attribute ) { if ( '_text' === $ attribute ) { $ elements [ ] = $ node -> nodeValue ; } elseif ( '... | Extracts information from the list of nodes . |
21,588 | public function image ( ) { if ( ! \ count ( $ this ) ) { throw new \ InvalidArgumentException ( 'The current node list is empty.' ) ; } $ node = $ this -> getNode ( 0 ) ; if ( ! $ node instanceof \ DOMElement ) { throw new \ InvalidArgumentException ( sprintf ( 'The selected node should be instance of DOMElement, got ... | Returns an Image object for the first node in the list . |
21,589 | public function images ( ) { $ images = [ ] ; foreach ( $ this as $ node ) { if ( ! $ node instanceof \ DOMElement ) { throw new \ InvalidArgumentException ( sprintf ( 'The current node list should contain only DOMElement instances, "%s" found.' , \ get_class ( $ node ) ) ) ; } $ images [ ] = new Image ( $ node , $ thi... | Returns an array of Image objects for the nodes in the list . |
21,590 | public function form ( array $ values = null , $ method = null ) { if ( ! $ this -> nodes ) { throw new \ InvalidArgumentException ( 'The current node list is empty.' ) ; } $ node = $ this -> getNode ( 0 ) ; if ( ! $ node instanceof \ DOMElement ) { throw new \ InvalidArgumentException ( sprintf ( 'The selected node sh... | Returns a Form object for the first node in the list . |
21,591 | public static function xpathLiteral ( $ s ) { if ( false === strpos ( $ s , "'" ) ) { return sprintf ( "'%s'" , $ s ) ; } if ( false === strpos ( $ s , '"' ) ) { return sprintf ( '"%s"' , $ s ) ; } $ string = $ s ; $ parts = [ ] ; while ( true ) { if ( false !== $ pos = strpos ( $ string , "'" ) ) { $ parts [ ] = sprin... | Converts string for XPath expressions . |
21,592 | private function convertToHtmlEntities ( string $ htmlContent , string $ charset = 'UTF-8' ) : string { set_error_handler ( function ( ) { throw new \ Exception ( ) ; } ) ; try { return mb_convert_encoding ( $ htmlContent , 'HTML-ENTITIES' , $ charset ) ; } catch ( \ Exception $ e ) { try { $ htmlContent = iconv ( $ ch... | Converts charset to HTML - entities to ensure valid parsing . |
21,593 | private function createSubCrawler ( $ nodes ) { $ crawler = new static ( $ nodes , $ this -> uri , $ this -> baseHref ) ; $ crawler -> isHtml = $ this -> isHtml ; $ crawler -> document = $ this -> document ; $ crawler -> namespaces = $ this -> namespaces ; $ crawler -> html5Parser = $ this -> html5Parser ; return $ cra... | Creates a crawler for some subnodes . |
21,594 | public static function fromShellCommandline ( string $ command , string $ cwd = null , array $ env = null , $ input = null , ? float $ timeout = 60 ) { $ process = new static ( [ ] , $ cwd , $ env , $ input , $ timeout ) ; $ process -> commandline = $ command ; return $ process ; } | Creates a Process instance as a command - line to be run in a shell wrapper . |
21,595 | public function waitUntil ( callable $ callback ) : bool { $ this -> requireProcessIsStarted ( __FUNCTION__ ) ; $ this -> updateStatus ( false ) ; if ( ! $ this -> processPipes -> haveReadSupport ( ) ) { $ this -> stop ( 0 ) ; throw new \ LogicException ( 'Pass the callback to the "Process::start" method or call enable... | Waits until the callback returns true . |
21,596 | public function disableOutput ( ) { if ( $ this -> isRunning ( ) ) { throw new RuntimeException ( 'Disabling output while the process is running is not possible.' ) ; } if ( null !== $ this -> idleTimeout ) { throw new LogicException ( 'Output can not be disabled while an idle timeout is set.' ) ; } $ this -> outputDis... | Disables fetching output and error output from the underlying process . |
21,597 | public function getIncrementalOutput ( ) { $ this -> readPipesForOutput ( __FUNCTION__ ) ; $ latest = stream_get_contents ( $ this -> stdout , - 1 , $ this -> incrementalOutputOffset ) ; $ this -> incrementalOutputOffset = ftell ( $ this -> stdout ) ; if ( false === $ latest ) { return '' ; } return $ latest ; } | Returns the output incrementally . |
21,598 | public function getIncrementalErrorOutput ( ) { $ this -> readPipesForOutput ( __FUNCTION__ ) ; $ latest = stream_get_contents ( $ this -> stderr , - 1 , $ this -> incrementalErrorOutputOffset ) ; $ this -> incrementalErrorOutputOffset = ftell ( $ this -> stderr ) ; if ( false === $ latest ) { return '' ; } return $ la... | Returns the errorOutput incrementally . |
21,599 | public function getExitCodeText ( ) { if ( null === $ exitcode = $ this -> getExitCode ( ) ) { return ; } return isset ( self :: $ exitCodes [ $ exitcode ] ) ? self :: $ exitCodes [ $ exitcode ] : 'Unknown error' ; } | Returns a string representation for the exit code returned by the process . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.