idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
51,900 | public function copyAssets ( ) { $ base = $ source = $ this -> basePath . "resources" . $ this -> ds . "assets_setup" . $ this -> ds ; $ source = [ $ base . "webpack.mix.js" , $ base . "package.json" , $ base . "package-lock.json" , ] ; $ this -> copyFilesFromSource ( $ source , base_path ( ) , false ) ; } | Copy the asset files Copy all css js images asset files |
51,901 | private function copyConfig ( ) { $ this -> filesystem -> copy ( $ this -> basePath . "config/config.php" , config_path ( 'titan.php' ) ) ; $ this -> line ( "Config Copied: " . config_path ( 'titan.php' ) ) ; } | Copy the config file |
51,902 | public function copyEventsAndNotifications ( ) { $ this -> copyFilesFromSource ( $ this -> appPath . 'Events' , app_path ( 'Events' ) ) ; $ this -> copyFilesFromSource ( $ this -> appPath . 'Listeners' , app_path ( 'Listeners' ) ) ; $ this -> copyFilesFromSource ( $ this -> appPath . 'Mail' , app_path ( 'Mail' ) ) ; $ ... | Copy the events files Copy all events listeners and notifications |
51,903 | private function copyHelpers ( ) { $ this -> copyFilesFromSource ( $ this -> appPath . 'Helpers' , app_path ( 'Helpers' ) ) ; $ source = $ this -> appPath . "Providers{$this->ds}HelperServiceProvider.php" ; $ this -> copyFilesFromSource ( $ source , app_path ( 'Providers' ) ) ; $ this -> line ( "Remember to add 'App\Pr... | Cope the helpers files |
51,904 | private function copyRoutesAndProvider ( ) { $ this -> copyFilesFromSource ( $ this -> basePath . "routes" , base_path ( "routes" ) ) ; $ source = $ this -> appPath . "Providers{$this->ds}RouteServiceProvider.php" ; $ this -> copyFilesFromSource ( $ source , app_path ( 'Providers' ) , "namespace Bpocallaghan\Titan" , "... | Copy the route service provider The provider will point to routes in the vendor directory |
51,905 | private function copyNewsletter ( ) { $ source = "{$this->appPath}Models{$this->ds}NewsletterSubscriber.php" ; $ this -> copyFilesFromSource ( $ source , app_path ( "Models" ) , 'namespace_views' ) ; $ destination = app_path ( "Http{$this->ds}Controllers{$this->ds}Admin{$this->ds}Newsletter" ) ; $ source = "{$this->app... | Copy all newsletter related files to application |
51,906 | private function copyAuthFiles ( ) { $ source = "{$this->appPath}Models{$this->ds}UserInvite.php" ; $ this -> copyFilesFromSource ( $ source , app_path ( "Models" ) , 'namespace_views' ) ; $ this -> copyFilesFromSource ( $ this -> appPath . "Controllers{$this->ds}Auth" , app_path ( "Http{$this->ds}Controllers{$this->ds... | Copy all auth related files to application |
51,907 | private function overrideExistingFiles ( Collection $ files , $ source , $ destination ) { $ answer = true ; $ filesFound = [ ] ; $ files -> map ( function ( SplFileInfo $ file ) use ( $ source , $ destination , & $ filesFound ) { $ subDirectories = '' ; $ fileDestination = $ destination . $ file -> getFilename ( ) ; i... | See if any files exist Ask to override or not |
51,908 | public function uploadBanner ( $ file , $ path = '' , $ size = [ 'o' => [ 1900 , 500 ] , 'tn' => [ 450 , 212 ] ] ) { $ name = token ( ) ; $ extension = $ file -> guessClientExtension ( ) ; $ filename = $ name . '.' . $ extension ; $ filenameThumb = $ name . '-tn.' . $ extension ; $ imageTmp = Image :: make ( $ file -> ... | Upload the banner image create a thumb as well |
51,909 | public function moveFile ( $ file , $ path = '' ) { $ name = token ( ) ; $ extension = $ file -> guessClientExtension ( ) ; $ filename = $ name . '.' . $ extension ; $ imageTmp = Image :: make ( $ file -> getRealPath ( ) ) ; if ( ! $ imageTmp ) { return notify ( ) -> error ( 'Oops' , 'Something went wrong' , 'warning s... | Move the tmp file to desired location |
51,910 | private function findChildrenPages ( Page $ page ) { $ pages = Page :: where ( 'parent_id' , $ page -> id ) -> orderBy ( 'header_order' ) -> get ( ) ; return $ pages ; } | Get the children pages |
51,911 | public function scopeNPerGroup ( $ query , $ group , $ n = 10 ) { $ table = ( $ this -> getTable ( ) ) ; $ query -> from ( DB :: raw ( "(SELECT @rank:=0, @group:=0) as vars, {$table}" ) ) ; if ( ! $ query -> getQuery ( ) -> columns ) { $ query -> select ( "{$table}.*" ) ; } $ groupAlias = 'group_' . md5 ( time ( ) ) ; ... | query scope nPerGroup |
51,912 | public function update ( $ user ) { $ user = User :: find ( $ user ) ; if ( ! $ user ) { return redirect_to_resource ( ) ; } $ attributes = request ( ) -> validate ( [ 'firstname' => 'required' , 'lastname' => 'required' , 'cellphone' => 'required' , 'telephone' => 'nullable' , 'born_at' => 'nullable' , 'etokens' => 'n... | Update the specified client in storage . |
51,913 | private function getPaginator ( ) { $ perPage = 40 ; $ page = input ( 'page' , 1 ) ; $ itemsObj = $ this -> fetchEntries ( ) ; $ items = $ itemsObj [ 'items' ] ; $ total = $ itemsObj [ 'total' ] ; $ baseUrl = config ( 'app.url' ) . "/admin/accounts/clients" ; $ paginator = new LengthAwarePaginator ( $ items -> forPage ... | Fetch the client paginator |
51,914 | private function fetchEntries ( ) { $ items = User :: whereRole ( Role :: $ USER ) -> orderBy ( 'firstname' ) -> get ( ) ; $ total = $ items -> count ( ) ; if ( session ( 'filtered' ) ) { $ client = session ( 'filter_fullname' , '' ) ; if ( strlen ( $ client ) >= 2 ) { $ items = $ items -> filter ( function ( $ item ) ... | Fetch the users |
51,915 | public static function getPopularPages ( ) { $ ids = Page :: where ( 'slug' , '/' ) -> orWhere ( 'url' , '=' , '' ) -> orWhere ( 'url' , 'LIKE' , '/auth%' ) -> orWhere ( 'url' , 'LIKE' , '/account%' ) -> get ( ) -> pluck ( 'id' , 'id' ) -> values ( ) -> toArray ( ) ; $ items = Page :: where ( 'is_hidden' , 0 ) -> where... | Get the popular pages |
51,916 | public function scopeWhereRole ( $ query , $ role ) { return $ query -> whereHas ( 'roles' , function ( $ query ) use ( $ role ) { return $ query -> where ( 'keyword' , $ role ) ; } ) ; } | Query Scope Get all the users that has the role |
51,917 | public function attachRole ( $ roleSlug ) { $ role = Role :: where ( 'keyword' , $ roleSlug ) -> first ( ) ; $ this -> roles ( ) -> attach ( [ $ role -> id ] ) ; return $ this -> roles ; } | Attach a Role to the user from the role slug |
51,918 | public function syncRoles ( $ roles , $ detach = false ) { foreach ( $ roles as $ k => $ slug ) { $ role = Role :: where ( 'keyword' , $ slug ) -> first ( ) ; $ this -> roles ( ) -> syncWithoutDetaching ( [ $ role -> id ] ) ; } return $ this -> roles ; } | Sync the roles |
51,919 | public function detachRole ( $ roleSlug ) { $ role = Role :: where ( 'keyword' , $ roleSlug ) -> first ( ) ; $ this -> roles ( ) -> detach ( [ $ role -> id ] ) ; return $ this -> roles ; } | Remove a role from the user |
51,920 | public function store ( Request $ request ) { $ this -> validate ( $ request , Tag :: $ rules , Tag :: $ messages ) ; $ row = $ this -> createEntry ( Tag :: class , $ request -> only ( 'name' ) ) ; return redirect_to_resource ( ) ; } | Store a newly created tag in storage . |
51,921 | public function update ( Tag $ tag , Request $ request ) { $ this -> validate ( $ request , Tag :: $ rules , Tag :: $ messages ) ; $ this -> updateEntry ( $ tag , $ request -> only ( 'name' ) ) ; return redirect_to_resource ( ) ; } | Update the specified tag in storage . |
51,922 | public function destroy ( Tag $ tag , Request $ request ) { $ this -> deleteEntry ( $ tag , $ request ) ; return redirect_to_resource ( ) ; } | Remove the specified tag from storage . |
51,923 | public function index ( ) { save_resource_url ( ) ; $ items = User :: with ( 'roles' ) -> whereRole ( Role :: $ BASE_ADMIN ) -> get ( ) ; return $ this -> view ( 'titan::accounts.administrators.index' , compact ( 'items' ) ) ; } | Show all the administrators |
51,924 | public function edit ( User $ administrator ) { $ roles = Role :: getAllLists ( ) ; return $ this -> view ( 'titan::accounts.administrators.create_edit' , compact ( 'roles' ) ) -> with ( 'item' , $ administrator ) ; } | Show the form for editing the specified faq . |
51,925 | public function update ( User $ administrator , Request $ request ) { $ this -> validate ( $ request , [ 'firstname' => 'required' , 'lastname' => 'required' , 'roles' => 'required|array' , ] ) ; $ this -> updateEntry ( $ administrator , $ request -> only ( [ 'firstname' , 'lastname' , 'cellphone' , 'telephone' , 'born... | Update the specified faq in storage . |
51,926 | public function destroy ( User $ administrator , Request $ request ) { if ( $ administrator -> id <= 3 ) { notify ( ) -> warning ( 'Whoops' , 'You can not delete this user.' ) ; } else { $ this -> deleteEntry ( $ administrator , $ request ) ; } return redirect_to_resource ( ) ; } | Remove the specified faq from storage . |
51,927 | private function findActivePageTiers ( ) { $ name = 'About Us' ; $ items = collect ( ) ; if ( $ this -> page -> parent_id > 0 ) { $ rows = Page :: where ( 'parent_id' , $ this -> page -> parent_id ) -> orderBy ( 'header_order' ) -> get ( ) ; if ( $ items -> count ( ) > 1 ) { $ items = $ rows ; $ name = $ this -> page -... | Get the active page tiers and the parent |
51,928 | public function store ( ) { $ attributes = request ( ) -> validate ( DocumentCategory :: $ rules , DocumentCategory :: $ messages ) ; $ category = $ this -> createEntry ( DocumentCategory :: class , $ attributes ) ; return redirect_to_resource ( ) ; } | Store a newly created document_category in storage . |
51,929 | public function update ( DocumentCategory $ category ) { $ attributes = request ( ) -> validate ( DocumentCategory :: $ rules , DocumentCategory :: $ messages ) ; $ category = $ this -> updateEntry ( $ category , $ attributes ) ; return redirect_to_resource ( ) ; } | Update the specified document_category in storage . |
51,930 | public function index ( ) { save_resource_url ( ) ; $ items = PhotoAlbum :: with ( 'photos' ) -> get ( ) ; return $ this -> view ( 'titan::photos.albums.index' ) -> with ( 'items' , $ items ) ; } | Display a listing of photo_album . |
51,931 | public function store ( Request $ request ) { $ attributes = request ( ) -> validate ( PhotoAlbum :: $ rules , PhotoAlbum :: $ messages ) ; $ album = $ this -> createEntry ( PhotoAlbum :: class , $ attributes ) ; return redirect_to_resource ( ) ; } | Store a newly created photo_album in storage . |
51,932 | public function update ( PhotoAlbum $ album , Request $ request ) { $ attributes = request ( ) -> validate ( PhotoAlbum :: $ rules , PhotoAlbum :: $ messages ) ; $ album = $ this -> updateEntry ( $ album , $ attributes ) ; return redirect_to_resource ( ) ; } | Update the specified photo_album in storage . |
51,933 | public function destroy ( PhotoAlbum $ album , Request $ request ) { $ this -> deleteEntry ( $ album , $ request ) ; return redirect_to_resource ( ) ; } | Remove the specified photo_album from storage . |
51,934 | protected function getKey ( $ key , $ labelValues , $ prefix = '' ) { if ( is_array ( $ labelValues ) ) { $ labelHash = $ this -> getLabelHash ( $ labelValues ) ; } else { $ labelHash = $ labelValues ; } return $ this -> getPrefix ( ) . '|' . $ prefix . '|' . $ key . '|' . $ labelHash ; } | Make the base retrieval key for some set of labels and a specific metric key |
51,935 | public static function create ( string $ name = 'G' , bool $ directional = true ) : self { $ graph = new self ( ) ; $ graph -> setName ( $ name ) -> setType ( $ directional ? 'digraph' : 'graph' ) ; return $ graph ; } | Factory method to instantiate a Graph so that you can use fluent coding to chain everything . |
51,936 | public function setPath ( string $ path ) : self { $ realpath = realpath ( $ path ) ; if ( $ path && $ path === $ realpath ) { $ this -> path = $ path . DIRECTORY_SEPARATOR ; } return $ this ; } | Sets the path for the execution . Only needed if it is not in the PATH env . |
51,937 | public function addGraph ( self $ graph ) : self { $ graph -> setType ( 'subgraph' ) ; $ this -> graphs [ $ graph -> getName ( ) ] = $ graph ; return $ this ; } | Adds a subgraph to this graph ; automatically changes the type to subgraph . |
51,938 | public function findNode ( string $ name ) { if ( isset ( $ this -> nodes [ $ name ] ) ) { return $ this -> nodes [ $ name ] ; } foreach ( $ this -> graphs as $ graph ) { $ node = $ graph -> findNode ( $ name ) ; if ( $ node ) { return $ node ; } } return null ; } | Finds a node in this graph or any of its subgraphs . |
51,939 | public function export ( string $ type , string $ filename ) : self { $ type = escapeshellarg ( $ type ) ; $ filename = escapeshellarg ( $ filename ) ; $ tmpfile = ( string ) tempnam ( sys_get_temp_dir ( ) , 'gvz' ) ; file_put_contents ( $ tmpfile , ( string ) $ this ) ; $ tmpfileArg = escapeshellarg ( $ tmpfile ) ; $ ... | Exports this graph to a generated image . |
51,940 | public static function getInstance ( ) { $ self = get_called_class ( ) ; if ( ! isset ( self :: $ instances [ $ self ] ) ) { self :: $ instances [ $ self ] = new $ self ; } return self :: $ instances [ $ self ] ; } | Returns instance if instance does not exist then creates new one and returns it |
51,941 | private function getError ( $ code , $ id = null , $ data = null ) { return [ 'jsonrpc' => '2.0' , 'id' => $ id , 'error' => [ 'code' => $ code , 'message' => isset ( $ this -> errorMessages [ $ code ] ) ? $ this -> errorMessages [ $ code ] : $ this -> errorMessages [ self :: INTERNALERROR ] , 'data' => $ data , ] , ] ... | Get Error Response |
51,942 | private function getDocDescription ( $ comment ) { $ result = null ; if ( preg_match ( '/\*\s+([^@]*)\s+/s' , $ comment , $ matches ) ) { $ result = str_replace ( '*' , "\n" , trim ( trim ( $ matches [ 1 ] , '*' ) ) ) ; } return $ result ; } | Get Doc Comment |
51,943 | private function resetVars ( ) { $ this -> response = $ this -> calls = [ ] ; $ this -> hasCalls = $ this -> isBatchCall = false ; } | Reset Local Class Vars after Execute |
51,944 | public static function create ( string $ name , string $ label = null ) : self { return new self ( $ name , $ label ) ; } | Factory method used to assist with fluent interface handling . |
51,945 | public function check ( Receipt $ receipt ) { try { return $ this -> send ( $ receipt , true ) ; } catch ( ServerException $ e ) { return false ; } } | Checking the accuracy of data sent |
51,946 | private function processWarnings ( $ warnings ) { $ msgs = [ 1 => 'DIC poplatnika v datove zprave se neshoduje s DIC v certifikatu' , 2 => 'Chybny format DIC poverujiciho poplatnika' , 3 => 'Chybna hodnota PKP' , 4 => 'Datum a cas prijeti trzby je novejsi nez datum a cas prijeti zpravy' , 5 => 'Datum a cas prijeti trzb... | Convert warning codes from response to array with messages . |
51,947 | public function Output2Base64 ( $ AvatarSize = 0 ) { if ( ! $ AvatarSize ) { $ AvatarSize = $ this -> AvatarSize ; } ob_start ( ) ; imagepng ( $ this -> Resize ( $ AvatarSize ) ) ; $ content = ob_get_contents ( ) ; ob_end_clean ( ) ; return 'data:image/png;base64,' . base64_encode ( $ content ) ; } | Output Base64 encoded image data |
51,948 | public function dispatchUntil ( ActionEvent $ event , callable $ callback ) : void { foreach ( $ this -> getListeners ( $ event ) as $ listenerHandler ) { $ listener = $ listenerHandler -> getActionEventListener ( ) ; $ listener ( $ event ) ; if ( $ event -> propagationIsStopped ( ) ) { return ; } if ( $ callback ( $ e... | Trigger an event until the given callback returns a boolean true |
51,949 | public function setName ( $ name ) { if ( null !== $ name ) { Assert :: string ( $ name , 'The command name must be a string or null. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The command name must not be empty.' ) ; Assert :: greaterThan ( strlen ( $ name ) , 1 , sprintf ( 'The command name should contain at least t... | Sets the name of the command . |
51,950 | public function setShortName ( $ shortName ) { if ( null !== $ shortName ) { Assert :: string ( $ shortName , 'The short command name must be a string or null. Got: %s' ) ; Assert :: notEmpty ( $ shortName , 'The short command name must not be empty.' ) ; Assert :: regex ( $ shortName , '~^[a-zA-Z]$~' , 'The short comm... | Sets the short option name of the command . |
51,951 | public function register ( $ name , $ handler ) { Assert :: string ( $ name , 'The handler name must be a string. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The handler name must not be empty.' ) ; if ( ! is_object ( $ handler ) ) { Assert :: isCallable ( $ handler , 'The handler must be a callable or an object. Got: ... | Registers a command handler for the given name . |
51,952 | public function unregister ( $ name ) { unset ( $ this -> handlers [ $ name ] ) ; if ( $ name === $ this -> selectedHandler ) { reset ( $ this -> handlers ) ; $ this -> selectedHandler = key ( $ this -> handlers ) ; } } | Unregisters the command handler for the given name . |
51,953 | public function selectHandler ( $ handler ) { if ( ! is_callable ( $ handler ) ) { Assert :: string ( $ handler , 'The selected handler must be a callable or a string. Got: %s' ) ; if ( ! isset ( $ this -> handlers [ $ handler ] ) ) { throw new InvalidArgumentException ( sprintf ( 'The handler "%s" does not exist.' , $... | Selects the executed handler . |
51,954 | public static function forArgumentName ( $ name , $ code = 0 , Exception $ cause = null ) { return new static ( sprintf ( 'The argument "%s" does not exist.' , $ name ) , $ code , $ cause ) ; } | Creates an exception for the given argument name . |
51,955 | public static function forPosition ( $ position , $ code = 0 , Exception $ cause = null ) { return new static ( sprintf ( 'The argument at position %s does not exist.' , $ position ) , $ code , $ cause ) ; } | Creates an exception for the given argument position . |
51,956 | public function bg ( $ color ) { Assert :: nullOrOneOf ( $ color , self :: $ colors , 'The color must be null or one of the Style::* color constants. Got: "%s"' ) ; $ this -> bgColor = $ color ; return $ this ; } | Sets the background color . |
51,957 | public static function asciiBorder ( ) { if ( ! self :: $ asciiBorder ) { self :: $ asciiBorder = new static ( ) ; self :: $ asciiBorder -> headerCellFormat = ' %s ' ; self :: $ asciiBorder -> cellFormat = ' %s ' ; self :: $ asciiBorder -> borderStyle = BorderStyle :: ascii ( ) ; } return clone self :: $ asciiBorder ; ... | A style that uses ASCII characters for drawing borders . |
51,958 | public static function solidBorder ( ) { if ( ! self :: $ solidBorder ) { self :: $ solidBorder = new static ( ) ; self :: $ solidBorder -> headerCellFormat = ' %s ' ; self :: $ solidBorder -> cellFormat = ' %s ' ; self :: $ solidBorder -> borderStyle = BorderStyle :: solid ( ) ; } return clone self :: $ solidBorder ; ... | A style that uses Unicode characters for drawing solid borders . |
51,959 | public function getColumnAlignments ( $ nbColumns ) { return array_slice ( array_replace ( array_fill ( 0 , $ nbColumns , $ this -> defaultColumnAlignment ) , $ this -> columnAlignments ) , 0 , $ nbColumns ) ; } | Returns the alignments of the table columns . |
51,960 | public function getColumnAlignment ( $ column ) { return isset ( $ this -> columnAlignments [ $ column ] ) ? $ this -> columnAlignments [ $ column ] : $ this -> defaultColumnAlignment ; } | Returns the alignment of a given column . |
51,961 | public function setColumnAlignments ( array $ alignments ) { $ this -> columnAlignments = array ( ) ; foreach ( $ alignments as $ column => $ alignment ) { $ this -> setColumnAlignment ( $ column , $ alignment ) ; } return $ this ; } | Sets the alignments of the table columns . |
51,962 | public function setColumnAlignment ( $ column , $ alignment ) { Assert :: oneOf ( $ alignment , Alignment :: all ( ) , 'The column alignment must be one of the Alignment constants. Got: %s' ) ; $ this -> columnAlignments [ $ column ] = $ alignment ; return $ this ; } | Sets the alignment of a given column . |
51,963 | public function setDefaultColumnAlignment ( $ alignment ) { Assert :: oneOf ( $ alignment , Alignment :: all ( ) , 'The default column alignment must be one of the Alignment constants. Got: %s' ) ; $ this -> defaultColumnAlignment = $ alignment ; return $ this ; } | Returns the default column alignment . |
51,964 | public static function ascii ( ) { if ( ! self :: $ ascii ) { self :: $ ascii = new static ( ) ; self :: $ ascii -> lineVLChar = '|' ; self :: $ ascii -> lineVCChar = '|' ; self :: $ ascii -> lineVRChar = '|' ; self :: $ ascii -> lineHTChar = '-' ; self :: $ ascii -> lineHCChar = '-' ; self :: $ ascii -> lineHBChar = '... | A style that uses ASCII characters only . |
51,965 | public function render ( IO $ io , $ indentation = 0 ) { if ( $ this -> config -> getDisplayName ( ) && $ this -> config -> getVersion ( ) ) { $ paragraph = new Paragraph ( "{$this->config->getDisplayName()} version <c1>{$this->config->getVersion()}</c1>" ) ; } elseif ( $ this -> config -> getDisplayName ( ) ) { $ para... | Renders the name and version . |
51,966 | public static function forOptionName ( $ name , $ code = 0 , Exception $ cause = null ) { return new static ( sprintf ( 'The option "%s%s" does not exist.' , strlen ( $ name ) > 1 ? '--' : '-' , $ name ) , $ code , $ cause ) ; } | Creates an exception for the given option name . |
51,967 | public function add ( Command $ command ) { $ name = $ command -> getName ( ) ; $ this -> commands [ $ name ] = $ command ; if ( $ shortName = $ command -> getShortName ( ) ) { $ this -> shortNameIndex [ $ shortName ] = $ name ; } foreach ( $ command -> getAliases ( ) as $ alias ) { $ this -> aliasIndex [ $ alias ] = $... | Adds a command to the collection . |
51,968 | public function get ( $ name ) { if ( isset ( $ this -> commands [ $ name ] ) ) { return $ this -> commands [ $ name ] ; } if ( isset ( $ this -> shortNameIndex [ $ name ] ) ) { return $ this -> commands [ $ this -> shortNameIndex [ $ name ] ] ; } if ( isset ( $ this -> aliasIndex [ $ name ] ) ) { return $ this -> comm... | Returns a command by its name . |
51,969 | public function remove ( $ name ) { if ( isset ( $ this -> aliasIndex [ $ name ] ) ) { $ this -> remove ( $ this -> aliasIndex [ $ name ] ) ; return ; } if ( isset ( $ this -> shortNameIndex [ $ name ] ) ) { $ this -> remove ( $ this -> shortNameIndex [ $ name ] ) ; return ; } unset ( $ this -> commands [ $ name ] ) ; ... | Removes the command with the given name from the collection . |
51,970 | public function contains ( $ name ) { return isset ( $ this -> commands [ $ name ] ) || isset ( $ this -> shortNameIndex [ $ name ] ) || isset ( $ this -> aliasIndex [ $ name ] ) ; } | Returns whether the collection contains a command with the given name . |
51,971 | public function getNames ( $ includeAliases = false ) { $ names = array_keys ( $ this -> commands ) ; if ( $ includeAliases ) { $ names = array_merge ( $ names , array_keys ( $ this -> aliasIndex ) ) ; } sort ( $ names ) ; return $ names ; } | Returns the names of all commands in the collection . |
51,972 | public function parseValue ( $ value ) { $ nullable = ( $ this -> flags & self :: NULLABLE ) ; if ( $ this -> flags & self :: BOOLEAN ) { return StringUtil :: parseBoolean ( $ value , $ nullable ) ; } if ( $ this -> flags & self :: INTEGER ) { return StringUtil :: parseInteger ( $ value , $ nullable ) ; } if ( $ this -... | Parses an option value . |
51,973 | public static function isSupported ( ) { if ( null === self :: $ supported ) { self :: $ supported = function_exists ( 'cli_set_process_title' ) || function_exists ( 'setproctitle' ) ; } return self :: $ supported ; } | Returns whether process titles can be set . |
51,974 | public static function resetProcessTitle ( ) { $ processTitle = self :: $ processTitles ? array_pop ( self :: $ processTitles ) : null ; self :: changeProcessTitleTo ( $ processTitle ) ; } | Resets the title of the PHP process to the previous value . |
51,975 | public function add ( Component $ element ) { $ this -> elements [ ] = $ element ; $ this -> indentations [ ] = $ this -> currentIndentation ; if ( $ element instanceof LabeledParagraph ) { $ this -> alignment -> add ( $ element , $ this -> currentIndentation ) ; $ element -> setAlignment ( $ this -> alignment ) ; } re... | Adds a renderable element to the layout . |
51,976 | public function render ( IO $ io , $ indentation = 0 ) { $ this -> alignment -> align ( $ io , $ indentation ) ; foreach ( $ this -> elements as $ i => $ element ) { $ element -> render ( $ io , $ this -> indentations [ $ i ] + $ indentation ) ; } $ this -> elements = array ( ) ; } | Renders all elements in the layout . |
51,977 | public function render ( IO $ io , $ indentation = 0 ) { if ( ! $ io -> isVerbose ( ) ) { $ io -> errorLine ( 'fatal: ' . $ this -> exception -> getMessage ( ) ) ; return ; } $ exception = $ this -> exception ; $ this -> renderException ( $ io , $ exception ) ; if ( $ io -> isVeryVerbose ( ) ) { while ( $ exception = $... | Renders the exception trace . |
51,978 | public function getCommandNames ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; $ commandNames = $ this -> commandNames ; if ( $ includeBase && $ this -> baseFormat ) { $ commandNames = array_merge ( $ this -> baseFormat -> getCommandNames ( ) ,... | Returns the command names . |
51,979 | public function hasCommandNames ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; if ( count ( $ this -> commandNames ) > 0 ) { return true ; } if ( $ includeBase && $ this -> baseFormat ) { return $ this -> baseFormat -> hasCommandNames ( ) ; } r... | Returns whether the format contains any command names . |
51,980 | public function getCommandOption ( $ name , $ includeBase = true ) { Assert :: string ( $ name , 'The option name must be a string or an integer. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The option name must not be empty.' ) ; Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s... | Returns a command option by its long or short name . |
51,981 | public function getCommandOptions ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; $ commandOptions = array_values ( $ this -> commandOptions ) ; if ( $ includeBase && $ this -> baseFormat ) { $ commandOptions = array_merge ( $ this -> baseFormat... | Returns all command options of the format . |
51,982 | public function hasCommandOption ( $ name , $ includeBase = true ) { Assert :: string ( $ name , 'The option name must be a string or an integer. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The option name must not be empty.' ) ; Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s... | Returns whether the format contains a specific command option . |
51,983 | public function hasCommandOptions ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; if ( count ( $ this -> commandOptions ) > 0 ) { return true ; } if ( $ includeBase && $ this -> baseFormat ) { return $ this -> baseFormat -> hasCommandOptions ( )... | Returns whether the format contains command options . |
51,984 | public function getArguments ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; $ arguments = $ this -> arguments ; if ( $ includeBase && $ this -> baseFormat ) { $ arguments = array_replace ( $ this -> baseFormat -> getArguments ( ) , $ arguments ... | Returns all arguments of the format . |
51,985 | public function hasArgument ( $ name , $ includeBase = true ) { if ( ! is_int ( $ name ) ) { Assert :: string ( $ name , 'The argument name must be a string or an integer. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The argument name must not be empty.' ) ; } Assert :: boolean ( $ includeBase , 'The parameter $includeB... | Returns whether the format contains a specific argument . |
51,986 | public function hasMultiValuedArgument ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; if ( $ this -> hasMultiValuedArg ) { return true ; } if ( $ includeBase && $ this -> baseFormat ) { return $ this -> baseFormat -> hasMultiValuedArgument ( ) ... | Returns whether the format contains a multi - valued argument . |
51,987 | public function hasOptionalArgument ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; if ( $ this -> hasOptionalArg ) { return true ; } if ( $ includeBase && $ this -> baseFormat ) { return $ this -> baseFormat -> hasOptionalArgument ( ) ; } retur... | Returns whether the format contains an optional argument . |
51,988 | public function hasRequiredArgument ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; if ( ! $ this -> hasOptionalArg && count ( $ this -> arguments ) > 0 ) { return true ; } if ( $ includeBase && $ this -> baseFormat ) { return $ this -> baseForm... | Returns whether the format contains a required argument . |
51,989 | public function hasArguments ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; if ( count ( $ this -> arguments ) > 0 ) { return true ; } if ( $ includeBase && $ this -> baseFormat ) { return $ this -> baseFormat -> hasArguments ( ) ; } return fal... | Returns whether the format contains any argument . |
51,990 | public function getNumberOfArguments ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; if ( $ this -> hasMultiValuedArg ) { return PHP_INT_MAX ; } return count ( $ this -> getArguments ( $ includeBase ) ) ; } | Returns the number of arguments . |
51,991 | public function getNumberOfRequiredArguments ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; $ arguments = $ this -> getArguments ( $ includeBase ) ; $ count = 0 ; foreach ( $ arguments as $ argument ) { if ( ! $ argument -> isRequired ( ) ) { c... | Returns the number of required arguments . |
51,992 | public function getOption ( $ name , $ includeBase = true ) { Assert :: string ( $ name , 'The option name must be a string or an integer. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The option name must not be empty.' ) ; Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; i... | Returns an option by its long or short name . |
51,993 | public function getOptions ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; $ options = $ this -> options ; if ( $ includeBase && $ this -> baseFormat ) { $ options = array_replace ( $ options , $ this -> baseFormat -> getOptions ( ) ) ; } return... | Returns all options of the format . |
51,994 | public function hasOption ( $ name , $ includeBase = true ) { Assert :: string ( $ name , 'The option name must be a string or an integer. Got: %s' ) ; Assert :: notEmpty ( $ name , 'The option name must not be empty.' ) ; Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; i... | Returns whether the format contains a specific option . |
51,995 | public function hasOptions ( $ includeBase = true ) { Assert :: boolean ( $ includeBase , 'The parameter $includeBase must be a boolean. Got: %s' ) ; if ( count ( $ this -> options ) > 0 ) { return true ; } if ( $ includeBase && $ this -> baseFormat ) { return $ this -> baseFormat -> hasOptions ( ) ; } return false ; } | Returns whether the format contains options . |
51,996 | private function createBuilderForElements ( array $ elements , ArgsFormat $ baseFormat = null ) { $ builder = new ArgsFormatBuilder ( $ baseFormat ) ; foreach ( $ elements as $ element ) { if ( $ element instanceof CommandName ) { $ builder -> addCommandName ( $ element ) ; } elseif ( $ element instanceof CommandOption... | Creates a format builder for a set of arguments and options . |
51,997 | public function setCellAlignment ( $ alignment ) { Assert :: oneOf ( $ alignment , Alignment :: all ( ) , 'The cell alignment must be one of the Alignment constants. Got: %s' ) ; $ this -> cellAlignment = $ alignment ; return $ this ; } | Sets the cell alignment . |
51,998 | public function getEstimatedNbColumns ( $ maxTotalWidth ) { $ i = 0 ; $ rowWidth = 0 ; while ( isset ( $ this -> cells [ $ i ] ) ) { $ rowWidth += StringUtil :: getLength ( $ this -> cells [ $ i ] ) ; if ( $ rowWidth > $ maxTotalWidth ) { return $ i ; } ++ $ i ; } return $ i ; } | Returns an estimated number of columns for the given maximum width . |
51,999 | public function fit ( $ maxTotalWidth , $ nbColumns , Formatter $ formatter ) { $ this -> resetState ( $ maxTotalWidth , $ nbColumns ) ; $ this -> initRows ( $ formatter ) ; if ( $ this -> totalWidth <= $ maxTotalWidth ) { return ; } $ this -> wrapColumns ( $ formatter ) ; } | Fits the added cells into the given maximum total width with the given number of columns . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.