idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
52,000 | public function set ( $ string ) { $ this -> clear ( ) ; fwrite ( $ this -> stream , $ string ) ; rewind ( $ this -> stream ) ; } | Sets the string to read from . |
52,001 | public function append ( $ string ) { $ pos = ftell ( $ this -> stream ) ; fseek ( $ this -> stream , 0 , SEEK_END ) ; fwrite ( $ this -> stream , $ string ) ; fseek ( $ this -> stream , $ pos ) ; } | Appends a string to the stream . |
52,002 | public static function forCommandName ( $ name , $ code = 0 , Exception $ cause = null ) { return new static ( sprintf ( 'The command "%s" does not exist.' , $ name ) , $ code , $ cause ) ; } | Creates an exception for the given command name . |
52,003 | public function setMinNbColumns ( $ minNbColumns ) { $ this -> minNbColumns = $ minNbColumns ; $ this -> maxNbColumns = max ( $ this -> maxNbColumns , $ minNbColumns ) ; return $ this ; } | Sets the minimum number of columns in the grid . |
52,004 | public function setMaxNbColumns ( $ maxNbColumns ) { $ this -> minNbColumns = min ( $ this -> minNbColumns , $ maxNbColumns ) ; $ this -> maxNbColumns = $ maxNbColumns ; return $ this ; } | Sets the maximum number of columns in the grid . |
52,005 | public function addAlias ( $ alias ) { Assert :: string ( $ alias , 'The command alias must be a string. Got: %s' ) ; Assert :: notEmpty ( $ alias , 'The command alias must not be empty.' ) ; Assert :: regex ( $ alias , '~^[a-zA-Z0-9\-]+$~' , 'The command alias should contain letters, digits and hyphens only. Got: %s' ... | Adds an alias name . |
52,006 | public function setDescription ( $ description ) { if ( null !== $ description ) { Assert :: string ( $ description , 'The command description must be a string or null. Got: %s' ) ; Assert :: notEmpty ( $ description , 'The command description must not be empty.' ) ; } $ this -> description = $ description ; return $ t... | Sets the description of the command . |
52,007 | public function setProcessTitle ( $ processTitle ) { if ( null !== $ processTitle ) { Assert :: string ( $ processTitle , 'The command process title must be a string or null. Got: %s' ) ; Assert :: notEmpty ( $ processTitle , 'The command process title must not be empty.' ) ; } $ this -> processTitle = $ processTitle ;... | Sets the title of the command process . |
52,008 | public function beginSubCommand ( $ name ) { $ config = new SubCommandConfig ( $ name , $ this ) ; $ this -> subCommandConfigs [ ] = $ config ; return $ config ; } | Starts a configuration block for a sub - command . |
52,009 | public function beginOptionCommand ( $ name , $ shortName = null ) { $ config = new OptionCommandConfig ( $ name , $ shortName , $ this ) ; $ this -> subCommandConfigs [ ] = $ config ; return $ config ; } | Starts a configuration block for an option command . |
52,010 | public function addSubCommandConfig ( SubCommandConfig $ config ) { $ this -> subCommandConfigs [ ] = $ config ; $ config -> setParentConfig ( $ this ) ; return $ this ; } | Adds configuration for a sub - command . |
52,011 | public function getSubCommandConfig ( $ name ) { foreach ( $ this -> subCommandConfigs as $ commandConfig ) { if ( $ name === $ commandConfig -> getName ( ) ) { return $ commandConfig ; } } throw NoSuchCommandException :: forCommandName ( $ name ) ; } | Returns the sub - command configuration for a given name . |
52,012 | public function hasSubCommandConfig ( $ name ) { foreach ( $ this -> subCommandConfigs as $ commandConfig ) { if ( $ name === $ commandConfig -> getName ( ) ) { return true ; } } return false ; } | Returns whether the command has a sub - command with a given name . |
52,013 | public function setParentConfig ( CommandConfig $ parentConfig ) { $ this -> parentConfig = $ parentConfig ; if ( $ parentConfig -> getApplicationConfig ( ) ) { $ this -> setApplicationConfig ( $ parentConfig -> getApplicationConfig ( ) ) ; } } | Sets the parent command configuration . |
52,014 | private function createArgs ( ArgsFormat $ format , RawArgs $ rawArgs ) { $ args = new Args ( $ format , $ rawArgs ) ; foreach ( $ this -> arguments as $ name => $ value ) { if ( $ format -> hasArgument ( $ name ) ) { $ args -> setArgument ( $ name , $ value ) ; } } foreach ( $ this -> options as $ name => $ value ) { ... | Creates the arguments from the current class state . |
52,015 | public static function drawTopBorder ( IO $ io , BorderStyle $ style , array $ columnLengths , $ indentation = 0 ) { self :: drawBorder ( $ io , $ columnLengths , $ indentation , $ style -> getLineHTChar ( ) , $ style -> getCornerTLChar ( ) , $ style -> getCrossingTChar ( ) , $ style -> getCornerTRChar ( ) , $ style ->... | Draws a top border . |
52,016 | public static function drawMiddleBorder ( IO $ io , BorderStyle $ style , array $ columnLengths , $ indentation = 0 ) { self :: drawBorder ( $ io , $ columnLengths , $ indentation , $ style -> getLineHCChar ( ) , $ style -> getCrossingLChar ( ) , $ style -> getCrossingCChar ( ) , $ style -> getCrossingRChar ( ) , $ sty... | Draws a middle border . |
52,017 | public static function drawBottomBorder ( IO $ io , BorderStyle $ style , array $ columnLengths , $ indentation = 0 ) { self :: drawBorder ( $ io , $ columnLengths , $ indentation , $ style -> getLineHBChar ( ) , $ style -> getCornerBLChar ( ) , $ style -> getCrossingBChar ( ) , $ style -> getCornerBRChar ( ) , $ style... | Draws a bottom border . |
52,018 | public static function drawRow ( IO $ io , BorderStyle $ style , array $ row , array $ columnLengths , array $ alignments , $ cellFormat , Style $ cellStyle = null , $ paddingChar , $ indentation = 0 ) { $ totalLines = 0 ; foreach ( $ row as $ col => $ cell ) { $ row [ $ col ] = explode ( "\n" , $ cell ) ; $ totalLines... | Draws a bordered row of cells . |
52,019 | public function readLine ( $ default = null , $ length = null ) { if ( ! $ this -> interactive ) { return $ default ; } return $ this -> stream -> readLine ( $ length ) ; } | Reads a line from the input stream . |
52,020 | public function parseTokens ( $ string ) { $ this -> string = $ string ; $ this -> cursor = 0 ; $ this -> current = isset ( $ this -> string [ 0 ] ) ? $ this -> string [ 0 ] : null ; $ this -> next = isset ( $ this -> string [ 1 ] ) ? $ this -> string [ 1 ] : null ; $ previousLocale = setlocale ( LC_CTYPE , 0 ) ; setlo... | Parses the tokens from the given string . |
52,021 | private function next ( ) { if ( ! $ this -> valid ( ) ) { return ; } ++ $ this -> cursor ; $ this -> current = $ this -> next ; $ this -> next = isset ( $ this -> string [ $ this -> cursor + 1 ] ) ? $ this -> string [ $ this -> cursor + 1 ] : null ; } | Advances the cursor to the next position . |
52,022 | private function doParseTokens ( ) { $ tokens = array ( ) ; while ( $ this -> valid ( ) ) { while ( ctype_space ( $ this -> current ) ) { $ this -> next ( ) ; } if ( $ this -> valid ( ) ) { $ tokens [ ] = $ this -> parseToken ( ) ; } } return $ tokens ; } | Parses an array of tokens . |
52,023 | private function parseToken ( ) { $ token = '' ; while ( $ this -> valid ( ) ) { if ( ctype_space ( $ this -> current ) ) { $ this -> next ( ) ; break ; } if ( '\\' === $ this -> current ) { $ token .= $ this -> parseEscapeSequence ( ) ; } elseif ( "'" === $ this -> current || '"' === $ this -> current ) { $ token .= $... | Parses a single token . |
52,024 | private function parseQuotedString ( ) { $ string = '' ; $ delimiter = $ this -> current ; $ this -> next ( ) ; while ( $ this -> valid ( ) ) { if ( $ delimiter === $ this -> current ) { $ this -> next ( ) ; break ; } if ( '\\' === $ this -> current ) { $ string .= $ this -> parseEscapeSequence ( ) ; } elseif ( '"' ===... | Parses a quoted string . |
52,025 | private function parseEscapeSequence ( ) { $ sequence = "'" === $ this -> next || '"' === $ this -> next ? $ this -> next : '\\' . $ this -> next ; $ this -> next ( ) ; $ this -> next ( ) ; return $ sequence ; } | Parses an escape sequence started by a backslash . |
52,026 | public function setHeaderRow ( array $ row ) { if ( null === $ this -> nbColumns ) { $ this -> nbColumns = count ( $ row ) ; } elseif ( count ( $ row ) !== $ this -> nbColumns ) { throw new LogicException ( sprintf ( 'Expected the header row to contain %s cells, but got %s.' , $ this -> nbColumns , count ( $ row ) ) ) ... | Sets the header cells of the table . |
52,027 | public function setRow ( $ index , array $ row ) { if ( null === $ this -> nbColumns ) { $ this -> nbColumns = count ( $ row ) ; } elseif ( count ( $ row ) !== $ this -> nbColumns ) { throw new LogicException ( sprintf ( 'Expected the row to contain %s cells, but got %s.' , $ this -> nbColumns , count ( $ row ) ) ) ; }... | Sets a specific row in the table . |
52,028 | public function render ( IO $ io , $ indentation = 0 ) { $ layout = new BlockLayout ( ) ; $ this -> renderHelp ( $ layout ) ; $ layout -> render ( $ io , $ indentation ) ; } | Renders the usage . |
52,029 | protected function renderArguments ( BlockLayout $ layout , array $ arguments ) { $ layout -> add ( new Paragraph ( '<b>ARGUMENTS</b>' ) ) ; $ layout -> beginBlock ( ) ; foreach ( $ arguments as $ argument ) { $ this -> renderArgument ( $ layout , $ argument ) ; } $ layout -> endBlock ( ) ; $ layout -> add ( new EmptyL... | Renders a list of arguments . |
52,030 | protected function renderOptions ( BlockLayout $ layout , array $ options ) { $ layout -> add ( new Paragraph ( '<b>OPTIONS</b>' ) ) ; $ layout -> beginBlock ( ) ; foreach ( $ options as $ option ) { $ this -> renderOption ( $ layout , $ option ) ; } $ layout -> endBlock ( ) ; $ layout -> add ( new EmptyLine ( ) ) ; } | Renders a list of options . |
52,031 | protected function renderOption ( BlockLayout $ layout , Option $ option ) { $ description = $ option -> getDescription ( ) ; $ defaultValue = $ option -> getDefaultValue ( ) ; if ( $ option -> isLongNamePreferred ( ) ) { $ preferredName = '--' . $ option -> getLongName ( ) ; $ alternativeName = $ option -> getShortNam... | Renders an option . |
52,032 | protected function renderSynopsis ( BlockLayout $ layout , ArgsFormat $ argsFormat , $ appName , $ prefix = '' , $ lastOptional = false ) { $ nameParts = array ( ) ; $ argumentParts = array ( ) ; $ nameParts [ ] = '<u>' . ( $ appName ? : 'console' ) . '</u>' ; foreach ( $ argsFormat -> getCommandNames ( ) as $ commandN... | Renders the synopsis of a console command . |
52,033 | protected function formatValue ( $ value ) { if ( PHP_VERSION_ID < 50400 ) { return str_replace ( '\/' , '/' , json_encode ( $ value ) ) ; } return json_encode ( $ value , JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ; } | Formats the default value of an argument or an option . |
52,034 | public function getOptions ( $ includeDefaults = true ) { $ options = $ this -> options ; if ( $ includeDefaults ) { foreach ( $ this -> format -> getOptions ( ) as $ option ) { $ name = $ option -> getLongName ( ) ; if ( ! array_key_exists ( $ name , $ options ) ) { $ options [ $ name ] = $ option -> acceptsValue ( ) ... | Returns all options . |
52,035 | public function addOptions ( array $ options ) { foreach ( $ options as $ name => $ value ) { $ this -> setOption ( $ name , $ value ) ; } return $ this ; } | Sets the values of multiple options . |
52,036 | public function getArgument ( $ name ) { $ argument = $ this -> format -> getArgument ( $ name ) ; if ( array_key_exists ( $ argument -> getName ( ) , $ this -> arguments ) ) { return $ this -> arguments [ $ argument -> getName ( ) ] ; } return $ argument -> getDefaultValue ( ) ; } | Returns the value of an argument . |
52,037 | public function getArguments ( $ includeDefaults = true ) { $ arguments = array ( ) ; foreach ( $ this -> format -> getArguments ( ) as $ argument ) { $ name = $ argument -> getName ( ) ; if ( array_key_exists ( $ name , $ this -> arguments ) ) { $ arguments [ $ name ] = $ this -> arguments [ $ name ] ; } elseif ( $ in... | Returns the values of all arguments . |
52,038 | public function setArgument ( $ name , $ value ) { $ argument = $ this -> format -> getArgument ( $ name ) ; if ( $ argument -> isMultiValued ( ) ) { $ value = ( array ) $ value ; foreach ( $ value as $ k => $ v ) { $ value [ $ k ] = $ argument -> parseValue ( $ v ) ; } } else { $ value = $ argument -> parseValue ( $ v... | Sets the value of an argument . |
52,039 | public function addArguments ( array $ arguments ) { foreach ( $ arguments as $ name => $ value ) { $ this -> setArgument ( $ name , $ value ) ; } return $ this ; } | Sets the values of multiple arguments . |
52,040 | public static function find ( $ commandName , CommandCollection $ commands ) { $ threshold = 1e3 ; $ distancesByName = array ( ) ; $ actualNames = $ commands -> getNames ( true ) ; foreach ( $ actualNames as $ actualName ) { $ distance = levenshtein ( $ commandName , $ actualName ) ; $ isSimilar = $ distance <= ( strle... | Searches a command collection for similar names . |
52,041 | public function setLessBinary ( $ lessBinary ) { if ( null !== $ lessBinary ) { Assert :: string ( $ lessBinary , 'The less binary must be a string or null. Got: %s' ) ; Assert :: notEmpty ( $ lessBinary , 'The less binary must not be empty.' ) ; } $ this -> lessBinary = $ lessBinary ; } | Sets the less binary used to display the AsciiDoc page . |
52,042 | public function close ( ) { $ this -> input -> close ( ) ; $ this -> output -> close ( ) ; $ this -> errorOutput -> close ( ) ; } | Closes the input and the outputs . |
52,043 | public function setVerbosity ( $ verbosity ) { $ this -> output -> setVerbosity ( $ verbosity ) ; $ this -> errorOutput -> setVerbosity ( $ verbosity ) ; } | Sets the verbosity of the output . |
52,044 | public function setQuiet ( $ quiet ) { $ this -> output -> setQuiet ( $ quiet ) ; $ this -> errorOutput -> setQuiet ( $ quiet ) ; } | Sets whether all output should be suppressed . |
52,045 | public function setName ( $ name ) { if ( null !== $ name ) { Assert :: string ( $ name , 'The application name must be a string. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The application name must not be empty.' ) ; Assert :: regex ( $ name , '~^[a-zA-Z0-9\-]+$~' , 'The application name must contain letters, numbers... | Sets the name of the application . |
52,046 | public function setDisplayName ( $ displayName ) { if ( null !== $ displayName ) { Assert :: string ( $ displayName , 'The display name must be a string. Got: %s' ) ; Assert :: notEmpty ( $ displayName , 'The display name must not be empty.' ) ; } $ this -> displayName = $ displayName ; return $ this ; } | Sets the application name as it is displayed in the help . |
52,047 | public function setVersion ( $ version ) { if ( null !== $ version ) { Assert :: string ( $ version , 'The application version must be a string. Got: %s' ) ; Assert :: notEmpty ( $ version , 'The application version must not be empty.' ) ; } $ this -> version = $ version ; return $ this ; } | Sets the version of the application . |
52,048 | public function setHelp ( $ help ) { if ( null !== $ help ) { Assert :: string ( $ help , 'The help text must be a string. Got: %s' ) ; Assert :: notEmpty ( $ help , 'The help text must not be empty.' ) ; } $ this -> help = $ help ; return $ this ; } | Sets the help text of the application . |
52,049 | public function addEventListener ( $ eventName , $ listener , $ priority = 0 ) { if ( ! $ this -> dispatcher ) { $ this -> dispatcher = new EventDispatcher ( ) ; } $ this -> dispatcher -> addListener ( $ eventName , $ listener , $ priority ) ; return $ this ; } | Adds a listener for the given event name . |
52,050 | public function addEventSubscriber ( EventSubscriberInterface $ subscriber ) { if ( ! $ this -> dispatcher ) { $ this -> dispatcher = new EventDispatcher ( ) ; } $ this -> dispatcher -> addSubscriber ( $ subscriber ) ; return $ this ; } | Adds an event subscriber to the dispatcher . |
52,051 | public function removeEventListener ( $ eventName , $ listener ) { if ( ! $ this -> dispatcher ) { $ this -> dispatcher = new EventDispatcher ( ) ; } $ this -> dispatcher -> removeListener ( $ eventName , $ listener ) ; return $ this ; } | Removes an event listener for the given event name . |
52,052 | public function removeEventSubscriber ( EventSubscriberInterface $ subscriber ) { if ( ! $ this -> dispatcher ) { $ this -> dispatcher = new EventDispatcher ( ) ; } $ this -> dispatcher -> removeSubscriber ( $ subscriber ) ; return $ this ; } | Removes an event subscriber from the dispatcher . |
52,053 | public function addStyle ( Style $ style ) { if ( ! $ this -> styleSet ) { $ this -> styleSet = new DefaultStyleSet ( ) ; } $ this -> styleSet -> add ( $ style ) ; return $ this ; } | Adds a style to the style set . |
52,054 | public function addStyles ( array $ styles ) { if ( ! $ this -> styleSet ) { $ this -> styleSet = new DefaultStyleSet ( ) ; } $ this -> styleSet -> merge ( $ styles ) ; return $ this ; } | Adds multiple styles to the style set . |
52,055 | public function beginCommand ( $ name ) { $ commandConfig = new CommandConfig ( $ name , $ this ) ; $ this -> commandConfigs [ ] = $ commandConfig ; return $ commandConfig ; } | Starts a configuration block for a command . |
52,056 | public function getCommandConfig ( $ name ) { foreach ( $ this -> commandConfigs as $ commandConfig ) { if ( $ name === $ commandConfig -> getName ( ) ) { return $ commandConfig ; } } throw NoSuchCommandException :: forCommandName ( $ name ) ; } | Returns the command configuration for a given name . |
52,057 | public function hasCommandConfig ( $ name ) { foreach ( $ this -> commandConfigs as $ commandConfig ) { if ( $ name === $ commandConfig -> getName ( ) ) { return true ; } } return false ; } | Returns whether the application has a command with a given name . |
52,058 | public function writeLine ( $ string , $ flags = null ) { if ( $ this -> mayWrite ( $ flags ) ) { $ string = rtrim ( $ string , PHP_EOL ) ; $ formatted = $ this -> formatOutput ? $ this -> format ( $ string ) : $ this -> removeFormat ( $ string ) ; $ this -> stream -> write ( $ formatted . PHP_EOL ) ; } } | Writes a line of text to the output stream . |
52,059 | public function writeRaw ( $ string , $ flags = null ) { if ( $ this -> mayWrite ( $ flags ) ) { $ this -> stream -> write ( $ string ) ; } } | Writes a string to the output stream without formatting . |
52,060 | public function writeLineRaw ( $ string , $ flags = null ) { if ( $ this -> mayWrite ( $ flags ) ) { $ this -> stream -> write ( rtrim ( $ string , PHP_EOL ) . PHP_EOL ) ; } } | Writes a line of text to the output stream without formatting . |
52,061 | public function setStream ( OutputStream $ stream ) { $ this -> stream = $ stream ; $ this -> formatOutput = $ stream -> supportsAnsi ( ) || ! ( $ this -> formatter instanceof AnsiFormatter ) ; } | Sets the underlying stream . |
52,062 | public function setVerbosity ( $ verbosity ) { Assert :: oneOf ( $ verbosity , array ( IO :: NORMAL , IO :: VERBOSE , IO :: VERY_VERBOSE , IO :: DEBUG ) , 'The verbosity must be one of IO::NORMAL, IO::VERBOSE, IO::VERY_VERBOSE and IO::DEBUG.' ) ; $ this -> verbosity = ( int ) $ verbosity ; } | Sets the verbosity level of the output . |
52,063 | protected function mayWrite ( $ flags ) { if ( $ this -> quiet ) { return false ; } if ( $ flags & IO :: VERBOSE ) { return $ this -> verbosity >= IO :: VERBOSE ; } if ( $ flags & IO :: VERY_VERBOSE ) { return $ this -> verbosity >= IO :: VERY_VERBOSE ; } if ( $ flags & IO :: DEBUG ) { return $ this -> verbosity >= IO ... | Returns whether an output may be written for the given flags . |
52,064 | public function setCommandOptions ( array $ commandOptions ) { $ this -> commandOptions = array ( ) ; $ this -> commandOptionsByShortName = array ( ) ; $ this -> addCommandOptions ( $ commandOptions ) ; return $ this ; } | Sets the command options of the built format . |
52,065 | public function addCommandOption ( CommandOption $ commandOption ) { $ longName = $ commandOption -> getLongName ( ) ; $ shortName = $ commandOption -> getShortName ( ) ; $ longAliases = $ commandOption -> getLongAliases ( ) ; $ shortAliases = $ commandOption -> getShortAliases ( ) ; if ( $ this -> hasOption ( $ longNa... | Adds a command option to the builder . |
52,066 | public function setArguments ( array $ arguments ) { $ this -> arguments = array ( ) ; $ this -> hasOptionalArg = false ; $ this -> hasMultiValuedArg = false ; $ this -> addArguments ( $ arguments ) ; return $ this ; } | Sets the arguments of the built format . |
52,067 | public function addArgument ( Argument $ argument ) { $ name = $ argument -> getName ( ) ; if ( $ this -> hasArgument ( $ name ) ) { throw CannotAddArgumentException :: existsAlready ( $ name ) ; } if ( $ this -> hasMultiValuedArgument ( ) ) { throw CannotAddArgumentException :: cannotAddAfterMultiValued ( ) ; } if ( $... | Adds an argument at the end of the argument list . |
52,068 | public function getArgument ( $ name , $ includeBase = true ) { if ( ! is_int ( $ name ) ) { Assert :: string ( $ name , 'The argument name must be a string or integer. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The argument name must not be empty.' ) ; } Assert :: boolean ( $ includeBase , 'The parameter $includeBase... | Returns an argument by its name or position . |
52,069 | public function setOptions ( array $ options ) { $ this -> options = array ( ) ; $ this -> optionsByShortName = array ( ) ; $ this -> addOptions ( $ options ) ; return $ this ; } | Sets the options of the built format . |
52,070 | public function addOption ( Option $ option ) { $ longName = $ option -> getLongName ( ) ; $ shortName = $ option -> getShortName ( ) ; if ( $ this -> hasOption ( $ longName ) || $ this -> hasCommandOption ( $ longName ) ) { throw CannotAddOptionException :: existsAlready ( $ longName ) ; } if ( $ shortName && ( $ this... | Adds an option at the end of the options list . |
52,071 | public function getHandler ( ) { if ( ! $ this -> handler ) { return $ this -> getDefaultHandler ( ) ; } if ( is_callable ( $ this -> handler ) ) { $ this -> handler = call_user_func ( $ this -> handler ) ; } return $ this -> handler ; } | Returns the command handler to execute when a command is run . |
52,072 | public function setHandler ( $ handler ) { if ( ! is_object ( $ handler ) && ! is_callable ( $ handler ) ) { throw new InvalidArgumentException ( sprintf ( 'Expected an object or a callable. Got: %s' , is_object ( $ handler ) ? get_class ( $ handler ) : gettype ( $ handler ) ) ) ; } $ this -> handler = $ handler ; retu... | Sets the command handler to execute when a command is run . |
52,073 | public function setHandlerMethod ( $ handlerMethod ) { Assert :: string ( $ handlerMethod , 'The handler method must be a string. Got: %s' ) ; Assert :: notEmpty ( $ handlerMethod , 'The handler method must not be empty.' ) ; $ this -> handlerMethod = $ handlerMethod ; return $ this ; } | Sets the method of the command handler that should be executed when the configured command is run . |
52,074 | protected function renderName ( BlockLayout $ layout , Application $ application ) { $ layout -> add ( new NameVersion ( $ application -> getConfig ( ) ) ) ; $ layout -> add ( new EmptyLine ( ) ) ; } | Renders the application name . |
52,075 | protected function renderCommand ( BlockLayout $ layout , Command $ command ) { $ description = $ command -> getConfig ( ) -> getDescription ( ) ; $ name = '<c1>' . $ command -> getName ( ) . '</c1>' ; $ layout -> add ( new LabeledParagraph ( $ name , $ description ) ) ; } | Renders a command in the Commands section . |
52,076 | protected function renderDescription ( BlockLayout $ layout , $ help ) { $ layout -> add ( new Paragraph ( '<b>DESCRIPTION</b>' ) ) -> beginBlock ( ) -> add ( new Paragraph ( $ help ) ) -> endBlock ( ) -> add ( new EmptyLine ( ) ) ; } | Renders the Description section . |
52,077 | public function parseArgs ( RawArgs $ args , $ lenient = null ) { if ( null === $ lenient ) { $ lenient = $ this -> config -> isLenientArgsParsingEnabled ( ) ; } return $ this -> config -> getArgsParser ( ) -> parseArgs ( $ args , $ this -> argsFormat , $ lenient ) ; } | Parses the raw console arguments and returns the parsed arguments . |
52,078 | public function run ( RawArgs $ args , IO $ io ) { return $ this -> handle ( $ this -> parseArgs ( $ args ) , $ io ) ; } | Executes the command for the given unparsed arguments . |
52,079 | public function handle ( Args $ args , IO $ io ) { $ processTitle = $ this -> config -> getProcessTitle ( ) ; $ this -> warnIfProcessTitleNotSupported ( $ processTitle , $ io ) ; if ( $ processTitle && ProcessTitle :: isSupported ( ) ) { ProcessTitle :: setProcessTitle ( $ processTitle ) ; try { $ statusCode = $ this -... | Executes the command for the given parsed arguments . |
52,080 | private function getBaseFormat ( ) { if ( $ this -> parentCommand ) { return $ this -> parentCommand -> getArgsFormat ( ) ; } if ( $ this -> application ) { return $ this -> application -> getGlobalArgsFormat ( ) ; } return null ; } | Returns the inherited arguments format of the command . |
52,081 | private function addSubCommand ( SubCommandConfig $ config ) { if ( ! $ config -> isEnabled ( ) ) { return ; } $ this -> validateSubCommandName ( $ config ) ; $ command = new self ( $ config , $ this -> application , $ this ) ; $ this -> subCommands -> add ( $ command ) ; if ( $ config -> isDefault ( ) ) { $ this -> de... | Adds a sub - command . |
52,082 | public function add ( LabeledParagraph $ paragraph , $ indentation = 0 ) { if ( $ paragraph -> isAligned ( ) ) { $ this -> paragraphs [ ] = $ paragraph ; $ this -> indentations [ ] = $ indentation ; } } | Adds a labeled paragraph to the alignment . |
52,083 | public function align ( Formatter $ formatter , $ indentation = 0 ) { $ this -> textOffset = 0 ; foreach ( $ this -> paragraphs as $ i => $ item ) { $ label = $ formatter -> removeFormat ( $ item -> getLabel ( ) ) ; $ textOffset = $ this -> indentations [ $ i ] + strlen ( $ label ) + $ item -> getPadding ( ) ; $ this -... | Calculates the text offset based on all labels in the alignment . |
52,084 | protected function renderSubCommand ( BlockLayout $ layout , Command $ command ) { $ config = $ command -> getConfig ( ) ; $ description = $ config -> getDescription ( ) ; $ help = $ config -> getHelp ( ) ; $ arguments = $ command -> getArgsFormat ( ) -> getArguments ( false ) ; $ options = $ command -> getArgsFormat (... | Renders a sub - command in the Commands section . |
52,085 | protected function renderSubCommandDescription ( BlockLayout $ layout , $ description ) { $ layout -> add ( new Paragraph ( $ description ) ) ; $ layout -> add ( new EmptyLine ( ) ) ; } | Renders the description of a sub - command . |
52,086 | protected function renderSubCommandHelp ( BlockLayout $ layout , $ help ) { $ layout -> add ( new Paragraph ( $ help ) ) ; $ layout -> add ( new EmptyLine ( ) ) ; } | Renders the help text of a sub - command . |
52,087 | protected function renderSubCommandArguments ( BlockLayout $ layout , array $ arguments ) { foreach ( $ arguments as $ argument ) { $ this -> renderArgument ( $ layout , $ argument ) ; } $ layout -> add ( new EmptyLine ( ) ) ; } | Renders the argument descriptions of a sub - command . |
52,088 | protected function renderSubCommandOptions ( BlockLayout $ layout , array $ options ) { foreach ( $ options as $ option ) { $ this -> renderOption ( $ layout , $ option ) ; } $ layout -> add ( new EmptyLine ( ) ) ; } | Renders the option descriptions of a sub - command . |
52,089 | private static function getFactory ( string $ type ) { if ( ! empty ( self :: $ factories [ $ type ] ) ) { return self :: $ factories [ $ type ] ; } if ( ! empty ( self :: $ factory ) ) { return self :: $ factories [ $ type ] = self :: $ factory ; } foreach ( self :: $ strategies as $ className ) { if ( is_array ( $ cl... | Create the PSR - 17 factories or throw an exception |
52,090 | public static function setStrategies ( array $ strategies = null ) { self :: $ factory = null ; self :: $ factories = [ ] ; self :: $ strategies = $ strategies ; } | Change the strategies |
52,091 | public static function createResponse ( int $ code = 200 , string $ reasonPhrase = '' ) : ResponseInterface { return self :: getResponseFactory ( ) -> createResponse ( $ code , $ reasonPhrase ) ; } | Creates a Response instance . |
52,092 | public static function createServerRequest ( string $ method , $ uri , array $ serverParams = [ ] ) : ServerRequestInterface { return self :: getServerRequestFactory ( ) -> createServerRequest ( $ method , $ uri , $ serverParams ) ; } | Creates a ServerRequest instance . |
52,093 | public function add ( Style $ style ) { if ( ! $ style -> getTag ( ) ) { throw new LogicException ( 'The tag of a style added to the style set must be set.' ) ; } $ this -> styles [ $ style -> getTag ( ) ] = $ style ; } | Adds a style . |
52,094 | public function get ( $ tag ) { if ( ! isset ( $ this -> styles [ $ tag ] ) ) { throw new OutOfBoundsException ( sprintf ( 'The style tag "%s" does not exist.' , $ tag ) ) ; } return $ this -> styles [ $ tag ] ; } | Returns the style with the given tag . |
52,095 | public function match ( $ string ) { return $ this -> string === $ string || in_array ( $ string , $ this -> aliases , true ) ; } | Returns whether a string matches the command name or one of its aliases . |
52,096 | public static function run ( array $ stack , ServerRequestInterface $ request = null ) : ResponseInterface { if ( $ request === null ) { $ request = Factory :: createServerRequest ( 'GET' , '/' ) ; } return ( new static ( $ stack ) ) -> dispatch ( $ request ) ; } | Static helper to create and dispatch a request . |
52,097 | public function dispatch ( ServerRequestInterface $ request ) : ResponseInterface { $ resolved = $ this -> resolve ( 0 ) ; return $ resolved -> handle ( $ request ) ; } | Dispatches the middleware stack and returns the resulting ResponseInterface . |
52,098 | public function launchProcess ( $ command , array $ arguments = array ( ) , $ killable = true ) { $ this -> installSignalHandlers ( $ killable ) ; $ exitCode = $ this -> run ( $ command , $ arguments ) ; $ this -> restoreSignalHandlers ( $ killable ) ; return $ exitCode ; } | Launches a process in the foreground . |
52,099 | private function adaptOption ( Option $ option ) { $ mode = null ; if ( $ option -> isMultiValued ( ) ) { $ mode |= InputOption :: VALUE_IS_ARRAY ; } if ( $ option -> isValueOptional ( ) ) { $ mode |= InputOption :: VALUE_OPTIONAL ; } if ( $ option -> isValueRequired ( ) ) { $ mode |= InputOption :: VALUE_REQUIRED ; } ... | Creates an input option for the given option . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.