idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
6,600 | protected static function getDefaultRoutes ( ) { if ( self :: $ _defaultRoutes === null ) { $ manager = self :: getAuthManager ( ) ; $ roles = $ manager -> defaultRoles ; if ( $ manager -> cache && ( $ routes = $ manager -> cache -> get ( $ roles ) ) !== false ) { self :: $ _defaultRoutes = $ routes ; } else { $ permis... | Get assigned routes by default roles |
6,601 | public static function getRoutesByUser ( $ userId ) { if ( ! isset ( self :: $ _userRoutes [ $ userId ] ) ) { $ manager = self :: getAuthManager ( ) ; if ( $ manager -> cache && ( $ routes = $ manager -> cache -> get ( [ __METHOD__ , $ userId ] ) ) !== false ) { self :: $ _userRoutes [ $ userId ] = $ routes ; } else { ... | Get assigned routes of user . |
6,602 | protected function setIo ( InputInterface $ input , OutputInterface $ output ) { $ this -> input = $ input ; $ this -> output = $ output ; return $ this ; } | Attach IO to command for easier access between methods . |
6,603 | protected function createGulpProcess ( $ task , array $ options = [ ] ) { $ config = $ this -> container [ 'config' ] ; return ProcessBuilder :: create ( array_flatten ( [ $ config [ 'gulp.bin' ] , $ task , $ options , '--source' , $ config [ 'source.directory' ] , '--dest' , $ config [ 'build.directory' ] , '--gulpfil... | Create a process builder for the given gulp task . |
6,604 | public static function collect ( ) { $ params = func_get_args ( ) ; $ scriptFeatures = array ( ) ; foreach ( $ params as $ object ) { if ( $ object instanceof ScriptFeature ) { $ scriptFeatures = static :: addScriptFeature ( $ scriptFeatures , $ object ) ; } else if ( $ object instanceof ScriptFeatureable ) { $ scriptF... | Collect the Script Features of the given objects |
6,605 | public static function addScriptFeature ( array $ scriptFeatures , $ newScriptFeatures ) { if ( ! $ newScriptFeatures ) { return $ scriptFeatures ; } if ( $ newScriptFeatures instanceof ScriptFeature ) { if ( ! in_array ( $ newScriptFeatures , $ scriptFeatures , true ) ) { array_push ( $ scriptFeatures , $ newScriptFea... | Add one or more Script Features to an Array of Features if they are not already contained |
6,606 | protected function loadGlobal ( $ group ) { if ( ! isset ( $ GLOBALS [ $ group ] ) ) { $ this -> throwError ( Message :: get ( Message :: CONFIG_GLOBAL_UNKNOWN , $ group ) , Message :: CONFIG_GLOBAL_UNKNOWN ) ; } $ this -> config -> addNode ( $ group , $ GLOBALS [ $ group ] ) ; return $ this ; } | Load super globals |
6,607 | protected function getGroupName ( $ id ) { return explode ( $ this -> config -> getDelimiter ( ) , ltrim ( $ id , $ this -> config -> getDelimiter ( ) ) ) [ 0 ] ; } | Get group name |
6,608 | private function isFilterable ( $ filter ) { if ( is_string ( $ filter ) && ! class_exists ( $ filter ) ) { throw new Exceptions \ InvalidFilterException ( "The [$filter] class does not exits." ) ; } if ( ! in_array ( Filterable :: class , class_implements ( $ filter ) ) ) { throw new Exceptions \ InvalidFilterExceptio... | Check if filter is filterable . |
6,609 | protected function advance ( ) { $ this -> cursor = $ this -> token -> getEnd ( ) ; return $ this -> token = $ this -> lexer -> readToken ( $ this -> cursor ) ; } | Moves the internal parser object to the next lexed token . |
6,610 | protected function skip ( $ type ) { if ( $ match = ( $ this -> token -> getType ( ) === $ type ) ) { $ this -> advance ( ) ; } return $ match ; } | If the next token is of the given kind return true after advancing the parser . Otherwise do not change the parser state and return false . |
6,611 | protected function expect ( $ type ) { if ( $ this -> token -> getType ( ) !== $ type ) { throw new \ Exception ( sprintf ( 'Expected %s, found %s' , Token :: typeToString ( $ type ) , ( string ) $ this -> token ) ) ; } $ token = $ this -> token ; $ this -> advance ( ) ; return $ token ; } | If the next token is of the given kind return that token after advancing the parser . Otherwise do not change the parser state and return false . |
6,612 | protected function expectKeyword ( $ value ) { if ( $ this -> token -> getType ( ) !== Token :: NAME_TYPE || $ this -> token -> getValue ( ) !== $ value ) { throw new \ Exception ( sprintf ( 'Expected %s, found %s' , $ value , $ this -> token -> getDescription ( ) ) ) ; } return $ this -> advance ( ) ; } | If the next token is a keyword with the given value return that token after advancing the parser . Otherwise do not change the parser state and return false . |
6,613 | protected function unexpected ( Token $ atToken = NULL ) { $ token = $ atToken ? : $ this -> token ; return new \ Exception ( sprintf ( 'Unexpected %s' , $ token -> getDescription ( ) ) ) ; } | Helper protected function for creating an error when an unexpected lexed token is encountered . |
6,614 | protected function many ( $ openKind , $ parseFn , $ closeKind ) { $ this -> expect ( $ openKind ) ; $ nodes = [ $ parseFn ( $ this ) ] ; while ( ! $ this -> skip ( $ closeKind ) ) { array_push ( $ nodes , $ parseFn ( $ this ) ) ; } return $ nodes ; } | Returns a non - empty list of parse nodes determined by the parseFn . |
6,615 | public function setFilters ( array $ filters ) { if ( empty ( $ this -> filters ) ) { $ this -> filters = $ this -> getDefaultFilters ( ) ; } $ this -> filters = array_merge ( $ this -> filters , $ filters ) ; return $ this ; } | Set filters . |
6,616 | public function sanitize ( array $ data , array $ rules = [ ] , array $ filters = [ ] ) { $ this -> setRules ( $ rules ) ; $ this -> setFilters ( $ filters ) ; foreach ( $ data as $ name => $ value ) { $ data [ $ name ] = $ this -> sanitizeAttribute ( $ name , $ value ) ; } return $ data ; } | Sanitize the given data . |
6,617 | protected function sanitizeAttribute ( $ attribute , $ value ) { foreach ( $ this -> rules -> get ( $ attribute ) as $ rule ) { $ value = $ this -> applyFilter ( $ rule [ 'name' ] , $ value , $ rule [ 'options' ] ) ; } return $ value ; } | Sanitize the given attribute |
6,618 | protected function applyFilter ( $ name , $ value , $ options = [ ] ) { $ this -> hasFilter ( $ name ) ; if ( empty ( $ value ) ) return $ value ; $ filter = $ this -> filters [ $ name ] ; if ( $ filter instanceof Closure ) { return call_user_func_array ( $ filter , compact ( 'value' , 'options' ) ) ; } $ filterable = ... | Apply the given filter by its name . |
6,619 | private function getDefaultFilters ( ) { return [ 'capitalize' => Filters \ CapitalizeFilter :: class , 'email' => Filters \ EmailFilter :: class , 'escape' => Filters \ EscapeFilter :: class , 'format_date' => Filters \ FormatDateFilter :: class , 'lowercase' => Filters \ LowercaseFilter :: class , 'slug' => Filters \... | Get default filters . |
6,620 | public static function getURL ( $ section , $ flags = 0x000000 , Array $ queryVars = array ( ) ) { if ( $ section === NULL ) { $ url = $ _SERVER [ 'PHP_SELF' ] ; if ( ! isset ( $ _SERVER [ 'PHP_SELF' ] ) ) { throw new \ Psc \ Exception ( 'SERVER[PHP_SELF] not set!' ) ; } } elseif ( $ section instanceof Routable ) { ret... | Konstruiert eine URL |
6,621 | public function create ( $ token , array $ properties = array ( ) , $ customer = null ) { $ parameters = array_merge ( [ 'paymentMethodNonce' => $ token , ] , $ properties ) ; $ response = BraintreeCustomer :: create ( $ parameters ) ; return $ response ; } | Subscribe to the plan for the first time . |
6,622 | public function addRadioButton ( CheckBox $ radioButton ) { if ( ! in_array ( $ radioButton , $ this -> radioButtons , true ) ) { array_push ( $ this -> radioButtons , $ radioButton ) ; } return $ this ; } | Add a new RadioButton |
6,623 | protected function prepareRadioButtonIdsConstant ( Script $ script ) { $ radioButtonIds = array ( ) ; foreach ( $ this -> radioButtons as $ radioButton ) { $ radioButtonIds [ $ radioButton -> getName ( ) ] = Builder :: getId ( $ radioButton -> getQuad ( ) ) ; } $ script -> addScriptConstant ( $ this -> getRadioButtonId... | Prepare the Constant containing the RadioButton Ids |
6,624 | protected function prepareOnRadioButtonClickFunction ( Script $ script ) { $ script -> addScriptFunction ( self :: FUNCTION_ON_RADIO_BUTTON_CLICK , "Void " . self :: FUNCTION_ON_RADIO_BUTTON_CLICK . "(CMlQuad _RadioButtonQuad, CMlEntry _RadioButtonGroupEntry, Text[Text] _RadioButtonIds) { // update group entry with ... | Build the RadioButton click handler function |
6,625 | protected function prepareRadioButtonClickScript ( Script $ script ) { $ script -> appendGenericScriptLabel ( ScriptLabel :: MOUSECLICK2 , "if (" . $ this -> getRadioButtonIdsConstantName ( ) . ".exists(Event.ControlId)) { declare RadioButtonQuad <=> (Event.Control as CMlQuad); declare RadioButtonGroupEntry <=> (Page.G... | Prepare the script for RadioButton clicks |
6,626 | protected function configureOutput ( ) { $ this -> output = new ConsoleOutput ( ) ; $ this -> output -> getFormatter ( ) -> setStyle ( 'path' , new OutputFormatterStyle ( 'green' , null , [ 'bold' ] ) ) ; $ this -> output -> getFormatter ( ) -> setStyle ( 'time' , new OutputFormatterStyle ( 'cyan' , null , [ 'bold' ] )... | Configure the console output with custom styles . |
6,627 | protected function loadExternalConfig ( ) { $ config = new Repository ( static :: getDefaultConfig ( ) ) ; $ filesystem = new Filesystem ( ) ; foreach ( $ this -> getConfigFiles ( $ filesystem ) as $ filename ) { $ this -> output -> writeln ( "<info>Reading config from <path>{$filename}</path></info>" ) ; if ( $ filesy... | Load the external config files specified by the command line option . |
6,628 | protected function getConfigFiles ( $ files , array $ defaults = [ 'steak.yml' , 'steak.php' ] ) { $ option = ( new ArgvInput ( ) ) -> getParameterOption ( [ '--config' , '-c' ] ) ; if ( ! $ option ) { foreach ( $ defaults as $ default ) { if ( $ files -> exists ( $ default ) ) { $ option = ( $ option ? ',' : '' ) . $ ... | Parse the command line option for config file to use . |
6,629 | public function registerCommand ( $ commandClass ) { $ command = $ this -> container -> make ( $ commandClass ) ; $ command -> setContainer ( $ this -> container ) ; return $ this -> symfony -> add ( $ command ) ; } | Register a single command . |
6,630 | public function setScriptInclude ( $ file , $ namespace = null ) { if ( $ file instanceof ScriptInclude ) { $ scriptInclude = $ file ; } else { $ scriptInclude = new ScriptInclude ( $ file , $ namespace ) ; } $ this -> includes [ $ scriptInclude -> getNamespace ( ) ] = $ scriptInclude ; return $ this ; } | Set a Script Include |
6,631 | public function addScriptConstant ( $ name , $ value = null ) { if ( $ name instanceof ScriptConstant ) { $ scriptConstant = $ name ; } else { $ scriptConstant = new ScriptConstant ( $ name , $ value ) ; } if ( ! in_array ( $ scriptConstant , $ this -> constants ) ) { array_push ( $ this -> constants , $ scriptConstant... | Add a Script Constant |
6,632 | public function addScriptFunction ( $ name , $ text = null ) { if ( $ name instanceof ScriptFunction ) { $ scriptFunction = $ name ; } else { $ scriptFunction = new ScriptFunction ( $ name , $ text ) ; } if ( ! in_array ( $ scriptFunction , $ this -> functions ) ) { array_push ( $ this -> functions , $ scriptFunction )... | Add a Script Function |
6,633 | public function addCustomScriptLabel ( $ name , $ text = null ) { if ( $ name instanceof ScriptLabel ) { $ scriptLabel = $ name ; } else { $ scriptLabel = new ScriptLabel ( $ name , $ text ) ; } if ( ! in_array ( $ scriptLabel , $ this -> customLabels ) ) { array_push ( $ this -> customLabels , $ scriptLabel ) ; } retu... | Add a custom Script text |
6,634 | public function appendGenericScriptLabel ( $ name , $ text = null , $ isolated = false ) { if ( $ name instanceof ScriptLabel ) { $ scriptLabel = $ name ; } else { $ scriptLabel = new ScriptLabel ( $ name , $ text , $ isolated ) ; } if ( ! in_array ( $ scriptLabel , $ this -> genericLabels ) ) { array_push ( $ this -> ... | Append a generic Script text for the next rendering |
6,635 | public function addFeature ( ScriptFeature $ feature ) { if ( ! in_array ( $ feature , $ this -> features , true ) ) { array_push ( $ this -> features , $ feature ) ; } return $ this ; } | Add a Script Feature |
6,636 | public function buildScriptText ( ) { $ scriptText = PHP_EOL ; $ scriptText .= $ this -> getHeaderComment ( ) ; $ scriptText .= $ this -> getIncludes ( ) ; $ scriptText .= $ this -> getConstants ( ) ; $ scriptText .= $ this -> getFunctions ( ) ; $ scriptText .= $ this -> getLabels ( ) ; $ scriptText .= $ this -> getMai... | Build the complete Script text |
6,637 | public function render ( \ DOMDocument $ domDocument ) { $ this -> loadFeatures ( $ this -> features ) ; $ scriptXml = $ domDocument -> createElement ( "script" ) ; $ scriptText = $ this -> buildScriptText ( ) ; $ scriptComment = $ domDocument -> createComment ( $ scriptText ) ; $ scriptXml -> appendChild ( $ scriptCom... | Render the Script |
6,638 | protected function getLabels ( ) { $ customLabelsText = implode ( PHP_EOL , $ this -> customLabels ) ; $ genericLabelsText = implode ( PHP_EOL , $ this -> genericLabels ) ; return $ customLabelsText . $ genericLabelsText ; } | Get the Labels text |
6,639 | protected function getMainFunction ( ) { $ mainFunction = 'Void FML_Dummy() {}main() { declare ' . self :: VAR_ScriptStart . ' = Now; +++' . ScriptLabel :: ONINIT . '+++ declare ' . self :: VAR_LoopCounter . ' = 0; declare ' . self :: VAR_LastTick . ' = 0; while (True) { yield; foreach (Event in PendingEvents) { sw... | Get the main function text |
6,640 | protected function setData ( & $ connect , $ data , $ content_type ) { if ( $ content_type == "application/json" ) { if ( gettype ( $ data ) == "string" ) { json_decode ( $ data , true ) ; } else { $ data = json_encode ( $ data ) ; } if ( function_exists ( 'json_last_error' ) ) { $ json_error = json_last_error ( ) ; if... | Sets the data request |
6,641 | protected function exec ( $ method , $ uri , $ data , $ content_type ) { $ connect = $ this -> getConnect ( $ uri , $ method , $ content_type ) ; if ( $ data ) { $ this -> setData ( $ connect , $ data , $ content_type ) ; } $ api_result = curl_exec ( $ connect ) ; $ api_http_code = curl_getinfo ( $ connect , CURLINFO_H... | Executes the request |
6,642 | public function status ( ) { if ( $ this -> status === null ) { $ stdClass = $ this -> decoded ( ) ; if ( ! $ stdClass instanceof stdClass ) return null ; $ this -> status = $ this -> resolveStatusFromStdClass ( $ stdClass ) ; } return $ this -> status ; } | returns the status model |
6,643 | private function getLocationByObject ( ValueObject $ object ) { $ contentInfo = $ this -> contentService -> loadContentInfo ( $ object -> data [ 'content_id' ] ) ; $ locations = $ this -> locationService -> loadLocations ( $ contentInfo ) ; foreach ( $ locations as $ loc ) { if ( $ loc -> parentLocationId === $ object ... | Get location by content_id and parent_location_id . |
6,644 | public function toggleVisibility ( Location $ location ) { if ( $ location -> hidden ) { return $ this -> unHide ( $ location ) ; } return $ this -> hide ( $ location ) ; } | Toggles location visibility . |
6,645 | public static function cleanDirectory ( string $ directory ) : bool { self :: removeDirectory ( $ directory ) ; return self :: createDirectory ( $ directory ) ; } | Empty the specified directory of all files and folders . |
6,646 | public static function isAbsolutePath ( $ path ) : bool { return strspn ( $ path , '/\\' , 0 , 1 ) || ( strlen ( $ path ) > 3 && ctype_alpha ( $ path [ 0 ] ) && ':' === $ path [ 1 ] && strspn ( $ path , '/\\' , 2 , 1 ) ) || null !== parse_url ( $ path , PHP_URL_SCHEME ) ; } | Returns whether the file path is an absolute path . |
6,647 | public static function path ( $ name , $ time = null ) { if ( is_null ( $ time ) ) { $ time = time ( ) ; } $ namespace = null ; if ( strpos ( $ name , '::' ) !== false ) { list ( $ namespace , $ name ) = explode ( '::' , $ name ) ; } $ name = explode ( '/' , $ name ) ; foreach ( $ name as $ key => $ value ) { $ name [ ... | Get a migration path by name |
6,648 | public static function migrate ( $ silent = false ) { $ migrations = $ silent ? static :: available ( ) : static :: unstaged ( ) ; foreach ( $ migrations as $ key => $ value ) { if ( empty ( $ value ) ) { continue ; } if ( \ ClanCats :: is_cli ( ) ) { \ CCCli :: info ( 'found new "' . $ key . '" migrations.' ) ; } fore... | Run all new migration |
6,649 | public static function rollback ( ) { $ available = static :: available ( ) ; foreach ( $ available as $ key => $ migrations ) { foreach ( $ migrations as $ time => $ migration ) { if ( $ time > static :: $ config -> get ( $ key . '.revision' , 0 ) ) { unset ( $ available [ $ key ] [ $ time ] ) ; } } } $ revisions = ar... | Revert the last migration |
6,650 | public static function hard_reset ( $ database = null ) { $ tables = DB :: fetch ( 'SHOW TABLES' , array ( ) , $ database , array ( 'assoc' ) ) ; foreach ( $ tables as $ table ) { DB :: run ( 'DROP TABLE IF EXISTS ' . reset ( $ table ) , array ( ) , $ database ) ; } } | The hard reset method deletes all tables from the database |
6,651 | public static function unstaged ( ) { $ available = static :: available ( ) ; foreach ( $ available as $ key => $ migrations ) { foreach ( $ migrations as $ time => $ migration ) { if ( $ time <= static :: $ config -> get ( $ key . '.revision' , 0 ) ) { unset ( $ available [ $ key ] [ $ time ] ) ; } } } return $ availa... | Returns the unstaged migrations based on the configuration |
6,652 | private function run_queries ( $ group ) { if ( ! $ handle = fopen ( $ this -> path , "r" ) ) { throw new Exception ( "Could not read migration: " . $ this -> path ) ; } $ mode = null ; $ query = '' ; while ( ! feof ( $ handle ) ) { $ buffer = trim ( fgets ( $ handle , 4096 ) ) ; $ this -> parse_mode ( $ mode , $ buffe... | Run all queries of specified group |
6,653 | private function parse_mode ( & $ mode , $ buffer ) { if ( substr ( trim ( $ buffer ) , 0 , 6 ) === '# - ) { $ mode = trim ( substr ( $ buffer , 6 ) ) ; } } | Try to parse the current mode |
6,654 | private function is_comment ( $ buffer ) { if ( is_string ( $ buffer ) && strlen ( $ buffer ) >= 1 ) { if ( $ buffer [ 0 ] == '#' ) { return true ; } if ( substr ( $ buffer , 0 , 2 ) == '--' ) { return true ; } } else { return true ; } return false ; } | Is this string an sql comment? |
6,655 | protected function autoLoad ( ) { if ( ! $ this -> disableAutoLoad ) { $ constructCode = $ this -> createConstructCode ( $ this -> jooseClass , $ this -> constructParams , FALSE ) ; if ( mb_strpos ( $ this -> html -> getTemplate ( ) , '%autoLoadJoose%' ) === FALSE ) { $ this -> html -> templateAppend ( "\n" . '%autoLoa... | Erstellt das Objekt direkt nachdem das HTML geladen wird per inline - Javascript |
6,656 | public static function get ( $ path , $ prefix = '' , $ suffix = '' ) { if ( substr ( $ path , 0 , 1 ) == '/' || substr ( $ path , 0 , 3 ) == "::/" ) { return $ path . $ suffix ; } if ( strpos ( $ path , '::' ) === false ) { return \ APPPATH . $ prefix . $ path . $ suffix ; } $ name = explode ( '::' , $ path ) ; if ( a... | generate an path an path can conatin an namespace for example core |
6,657 | public static function success ( $ percent , $ htmlOptions = array ( ) ) { ArrayHelper :: addValue ( 'class' , Enum :: COLOR_SUCCESS , $ htmlOptions ) ; return static :: bar ( $ percent , $ htmlOptions ) ; } | Generates success coloured progress bar |
6,658 | private function createCharsetTableVariables ( array $ config , $ encoding_type = 'utf8' ) { if ( isset ( $ config [ 'sphinxsearch' ] ) && file_exists ( __DIR__ . '/config/sphinx.charset.utf8.config.php' ) ) { $ charsetConfig = include __DIR__ . '/config/sphinx.charset.utf8.config.php' ; $ languages = $ charsetConfig [... | Read Sphinx Search charset tables and create variables to expose them |
6,659 | public function rewind ( ) { if ( ! $ this -> sorted ) { $ this -> entities = array_reverse ( $ this -> entities ) ; $ this -> sorted = true ; } parent :: rewind ( ) ; } | Make sure we have the items in the right order reverse order |
6,660 | public function toString ( ) { if ( null === $ this -> composedURI ) { $ this -> composedURI = '' ; if ( null !== $ this -> scheme ) { $ this -> composedURI .= $ this -> scheme ; $ this -> composedURI .= ':' ; } if ( null !== $ this -> host ) { $ this -> composedURI .= '//' ; if ( null !== $ this -> username ) { $ this... | Recomposes the components of this Uri as a string . |
6,661 | private function resolveRelativeReference ( ) { if ( null !== $ this -> scheme ) { $ this -> normalizeDotSegments ( ) ; } else { $ this -> scheme = $ this -> baseUri -> scheme ; if ( null !== $ this -> authority ) { $ this -> normalizeDotSegments ( ) ; } else { $ this -> authority = $ this -> baseUri -> authority ; $ t... | From RFC 3986 paragraph 4 . 2 |
6,662 | private function normalizeDotSegments ( ) { $ input = explode ( '/' , $ this -> path ) ; $ output = array ( ) ; while ( ! empty ( $ input ) ) { if ( '..' === $ input [ 0 ] ) { if ( 1 === count ( $ input ) ) { array_shift ( $ input ) ; if ( '' !== end ( $ output ) ) { array_pop ( $ output ) ; } array_push ( $ output , '... | From RFC 3986 paragraph 5 . 2 . 4 |
6,663 | private function mergeBasePath ( ) { if ( null !== $ this -> baseUri -> authority && '' === $ this -> baseUri -> path ) { $ this -> path = '/' . $ this -> path ; } else { if ( false !== $ lastSlashPos = strrpos ( $ this -> baseUri -> path , '/' ) ) { $ basePath = substr ( $ this -> baseUri -> path , 0 , $ lastSlashPos ... | From RFC 3986 paragraph 5 . 2 . 3 |
6,664 | private function parseUriReference ( ) { $ this -> parseScheme ( ) ; $ this -> parseAuthority ( ) ; $ this -> parsePath ( ) ; $ this -> parseQuery ( ) ; $ this -> parseFragment ( ) ; $ this -> doSchemeSpecificPostProcessing ( ) ; if ( strlen ( $ this -> remaining ) ) { throw new ErrorException ( "Still something left a... | From RFC 3986 paragraph 4 . 1 |
6,665 | protected function printBoolean ( OutputInterface $ output , $ success , $ fail , $ value , $ line = true ) { if ( $ value ) { $ message = '<info>' . $ success . '</info>' ; } else { $ message = '<error>' . $ fail . '</error>' ; } if ( false === $ line ) { return $ message ; } $ output -> writeln ( $ message ) ; } | prints a simple boolean . |
6,666 | protected function printMessage ( OutputInterface $ output , array $ response ) { $ this -> printBoolean ( $ output , $ response [ 'message' ] , $ response [ 'message' ] , true === $ response [ 'success' ] ) ; } | prints a simple message . |
6,667 | private function getColumnWidth ( array $ headings ) { $ width = 0 ; foreach ( $ headings as $ heading ) { $ width = strlen ( $ heading ) > $ width ? strlen ( $ heading ) : $ width ; } return $ width + 5 ; } | calculates the max width of a given set of string . |
6,668 | public function generate ( ) { $ this -> loadWebMasterTags ( ) ; $ title = $ this -> getTitle ( ) ; $ description = $ this -> getDescription ( ) ; $ keywords = $ this -> getKeywords ( ) ; $ metatags = $ this -> metatags ; $ html = [ ] ; if ( $ title ) : $ html [ ] = "<title>$title</title>" ; endif ; if ( ! empty ( $ de... | Generates meta tags |
6,669 | public function setTitle ( $ title , $ suffix = '' , $ has_suffix = true ) { $ title = strip_tags ( $ title ) ; $ suffix = strip_tags ( $ suffix ) ; $ this -> title_session = $ title ; $ this -> title = $ this -> parseTitle ( $ title , $ suffix , $ has_suffix ) ; return $ this ; } | Sets the title |
6,670 | public function setKeywords ( $ keywords ) { if ( ! is_array ( $ keywords ) ) : $ keywords = explode ( ', ' , $ this -> keywords ) ; endif ; $ keywords = array_map ( 'strip_tags' , $ keywords ) ; $ this -> keywords = $ keywords ; return $ this ; } | Sets the list of keywords you can send an array or string separated with commas also clears the previously set keywords |
6,671 | public function addKeyword ( $ keyword ) { if ( is_array ( $ keyword ) ) : $ this -> keywords = array_merge ( $ keyword , $ this -> keywords ) ; else : $ this -> keywords [ ] = strip_tags ( $ keyword ) ; endif ; return $ this ; } | Add a keyword |
6,672 | protected function parseTitle ( $ title , $ suffix , $ has_suffix ) { if ( ! $ has_suffix ) : return $ title ; elseif ( ! empty ( $ suffix ) ) : return $ title . $ this -> getTitleSeperator ( ) . $ suffix ; else : return $ this -> config -> get ( 'defaults.title' ) ? $ title . $ this -> getTitleSeperator ( ) . $ this -... | Get parsed title . |
6,673 | public function getDatatable ( DatatableViewInterface $ datatableView ) { $ type = $ datatableView -> getAjax ( ) -> getType ( ) ; $ entity = $ datatableView -> getEntity ( ) ; if ( 'GET' === strtoupper ( $ type ) ) { $ this -> parameterBag = $ this -> request -> query ; } if ( 'POST' === strtoupper ( $ type ) ) { $ th... | Get Datatable . |
6,674 | public function create ( $ name , $ extends = null , $ implements = null ) { $ this -> name = $ name ; $ this -> extends = $ extends ; if ( ! is_array ( $ implements ) && ! is_null ( $ implements ) ) { $ implements = array ( $ implements ) ; } $ this -> implements = $ implements ; } | Start new class builder |
6,675 | public function add ( ) { $ args = func_get_args ( ) ; $ component = array_shift ( $ args ) ; $ method = 'build_' . strtolower ( $ component ) ; if ( ! method_exists ( $ this , $ method ) ) { throw new CCException ( 'CCShipyard_Class invalid component builder "' . $ component . '".' ) ; } $ this -> output .= call_user_... | Add a component to the class |
6,676 | public function setValue ( $ search , $ replace ) { if ( substr ( $ search , 0 , 2 ) !== '${' && substr ( $ search , - 1 ) !== '}' ) { $ search = '${' . $ search . '}' ; } $ this -> _documentXML = str_replace ( $ search , $ replace , $ this -> _documentXML ) ; } | Set a Template value |
6,677 | public function render ( \ DOMDocument $ domDocument ) { $ style3dXml = $ domDocument -> createElement ( "style3d" ) ; $ this -> checkId ( ) ; if ( $ this -> styleId ) { $ style3dXml -> setAttribute ( "id" , $ this -> styleId ) ; } if ( $ this -> model ) { $ style3dXml -> setAttribute ( "model" , $ this -> model ) ; } ... | Render the Style3d |
6,678 | protected function setupSources ( ) { $ config = $ this -> container [ 'config' ] ; $ cwd = getcwd ( ) ; $ source = [ ] ; $ this -> output -> writeln ( "Working directory is <path>{$cwd}</path>" ) ; $ this -> title ( 'Sources' ) ; if ( $ this -> isGitRepo ( '.' ) ) { $ this -> output -> writeln ( "It looks your project... | Get the config values related to steak sources . |
6,679 | protected function setupBuild ( ) { $ config = $ this -> container [ 'config' ] ; $ build = [ ] ; $ this -> title ( 'Build' ) ; $ build [ 'directory' ] = $ this -> ask ( "Where should we put the generated site files?" , $ config [ 'build.directory' ] ) ; return $ build ; } | Get the config values related to the build process . |
6,680 | protected function setupDeploy ( ) { $ config = $ this -> container [ 'config' ] ; $ this -> title ( 'Deployment via Git' ) ; $ deploy = [ ] ; if ( $ this -> confirm ( 'Push the generated static site to a git repository?' ) ) { $ deploy [ 'git.url' ] = $ this -> ask ( "Specify a destination repository for the <path>ste... | Get the config values related to deployment . |
6,681 | protected function setupGulp ( ) { $ config = $ this -> container [ 'config' ] ; $ this -> title ( 'Gulp' ) ; $ gulp = [ ] ; $ this -> output -> writeln ( [ "steak uses the gulp taskrunner to:" , " 1. publish non-PHP files from your source directory to the build directory with <comment>steak:publish</comment>" , " 2.... | Get the config values related to gulp . |
6,682 | protected function setupServe ( array $ newConfig ) { $ newConfig = array_dot ( $ newConfig ) ; if ( array_get ( $ newConfig , 'deploy.git.branch' ) != 'gh-pages' ) { return [ ] ; } $ this -> title ( 'Local development server' ) ; $ this -> output -> writeln ( [ "When you publish to github pages, your site is available... | Get the config values related to the development server . |
6,683 | protected function confirm ( $ text , $ default = true ) { $ choices = $ default ? 'Yn' : 'yN' ; $ confirm = new ConfirmationQuestion ( "$text [$choices] " , $ default ) ; return $ this -> getHelper ( 'question' ) -> ask ( $ this -> input , $ this -> output , $ confirm ) ; } | Ask for user confirmation . |
6,684 | protected function select ( $ text , $ choices , $ default = null ) { $ question = new ChoiceQuestion ( $ text , $ choices , $ default ) ; return $ this -> getHelper ( 'question' ) -> ask ( $ this -> input , $ this -> output , $ question ) ; } | Ask user to choose from a list of options . |
6,685 | protected function getPushUrl ( $ dir , $ throws = false ) { try { $ remotes = $ this -> git -> workingCopy ( $ dir ) -> remote ( 'show' , 'origin' , '-n' ) -> getOutput ( ) ; if ( preg_match ( '!Push\s*URL:\s*([^\s#]+)!' , $ remotes , $ matches ) ) { return $ matches [ 1 ] ; } } catch ( GitException $ exception ) { if... | Get the origin s push URL . |
6,686 | protected function createYaml ( array $ config ) { $ nested = [ ] ; array_walk ( array_dot ( $ config ) , function ( $ value , $ key ) use ( & $ nested ) { array_set ( $ nested , $ key , $ value ) ; } ) ; return $ this -> yaml -> dump ( $ nested , 4 ) ; } | Create a YML string from a dotted array . |
6,687 | protected function dirExists ( $ dir ) { if ( $ this -> files -> exists ( $ dir ) ) { if ( ! $ this -> files -> isDirectory ( $ dir ) ) { throw new RuntimeException ( "The given directory [$dir] is not a directory." ) ; } return true ; } return false ; } | Check if a directory exists . |
6,688 | private function rewriteCountQuery ( string $ sql ) : string { if ( preg_match ( '/^\s*SELECT\s+\bDISTINCT\b/is' , $ sql ) || preg_match ( '/\s+GROUP\s+BY\s+/is' , $ sql ) ) { throw new CountQueryException ( $ sql ) ; } $ openParenthesis = '(?:\()' ; $ closeParenthesis = '(?:\))' ; $ subQueryInSelect = $ openParenthesi... | Return count query |
6,689 | public function set ( $ name , $ value ) { if ( ! $ this -> has ( $ name ) ) { $ this -> vars [ $ name ] = $ value ; } else { return false ; } } | Set var session |
6,690 | public function action_class ( $ params ) { $ options = \ CCDataObject :: assign ( $ params ) ; $ name = $ options -> get ( 0 , null ) ; while ( ! $ name ) { $ name = $ this -> read ( 'Please enter the class name: ' ) ; } if ( ! $ path = \ CCPath :: classes ( str_replace ( '_' , '/' , $ name ) , EXT ) ) { $ this -> err... | generate an class |
6,691 | public function action_model ( $ params ) { $ options = \ CCDataObject :: assign ( $ params ) ; $ name = $ options -> get ( 0 , null ) ; $ table = $ options -> get ( 1 , null ) ; while ( ! $ name ) { $ name = $ this -> read ( 'Please enter the class name: ' ) ; } while ( ! $ table ) { $ table = $ this -> read ( 'Please... | generate a model class |
6,692 | public function action_controller ( $ params ) { $ options = \ CCDataObject :: assign ( $ params ) ; $ name = $ options -> get ( 0 , null ) ; $ parent = $ options -> get ( 1 , null ) ; while ( ! $ name ) { $ name = $ this -> read ( 'Please enter the controller name: ' ) ; } if ( substr ( $ name , ( strlen ( 'Controller... | generate an controller |
6,693 | protected function getMethodArguments ( $ methodName ) { if ( ! empty ( $ this -> _magicMethodArgumentNames ) ) { return ArrayHelper :: getValue ( $ this -> _magicMethodArgumentNames , $ methodName , [ ] ) ; } try { $ reflectionClass = new \ ReflectionClass ( $ this ) ; $ comment = $ reflectionClass -> getDocComment ( ... | Get argument names and positions and data types from phpdoc class comment |
6,694 | public static function colorize ( $ string , $ fg = null , $ at = null , $ bg = null ) { if ( ! static :: isSupportedShell ( ) ) { return $ string ; } $ colored = '' ; if ( isset ( static :: $ _fg [ $ fg ] ) ) { $ colored .= "\033[" . static :: $ _fg [ $ fg ] . "m" ; } if ( isset ( static :: $ _bg [ $ bg ] ) ) { $ colo... | Colorizes the string using provided colors . |
6,695 | public static function info ( $ msg ) { $ msg = 'Info: ' . $ msg ; $ space = strlen ( $ msg ) + 4 ; $ out = static :: colorize ( str_pad ( ' ' , $ space ) , Color :: FG_WHITE , Color :: AT_BOLD , Color :: BG_BLUE ) . PHP_EOL ; $ out .= static :: colorize ( ' ' . $ msg . ' ' , Color :: FG_WHITE , Color :: AT_BOLD , Co... | Color style for info messages . |
6,696 | public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ pluginManagerClass = static :: PLUGIN_MANAGER_CLASS ; $ plugins = new $ pluginManagerClass ; $ plugins -> setServiceLocator ( $ serviceLocator ) ; $ configuration = $ serviceLocator -> get ( 'Config' ) ; if ( isset ( $ configuration [ 'di' ]... | Create and return the MVC controller plugin manager |
6,697 | public static function create ( $ modelAlias = null , $ criteria = null ) { if ( $ criteria instanceof UserRoleQuery ) { return $ criteria ; } $ query = new UserRoleQuery ( null , null , $ modelAlias ) ; if ( $ criteria instanceof Criteria ) { $ query -> mergeWith ( $ criteria ) ; } return $ query ; } | Returns a new UserRoleQuery object . |
6,698 | public function filterByRole ( $ role , $ comparison = null ) { if ( $ role instanceof Role ) { return $ this -> addUsingAlias ( UserRolePeer :: ROLE_ID , $ role -> getId ( ) , $ comparison ) ; } elseif ( $ role instanceof PropelObjectCollection ) { if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } retur... | Filter the query by a related Role object |
6,699 | public function useRoleQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinRole ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Role' , '\Slashworks\BackendBundle\Model\RoleQuery' ) ; } | Use the Role relation Role object |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.