idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
14,400 | public function AddGlobalVar ( \ Peg \ Lib \ Definitions \ Element \ GlobalVariable $ global_variable , $ header , $ namespace = "\\" ) { $ this -> AddHeader ( $ header ) ; $ this -> headers [ $ header ] -> AddGlobalVariable ( $ global_variable , $ namespace ) ; } | Adds a global variable to the symbols table . |
14,401 | public function AddFunction ( \ Peg \ Lib \ Definitions \ Element \ FunctionElement $ function , $ header , $ namespace = "\\" ) { $ this -> AddHeader ( $ header ) ; $ this -> headers [ $ header ] -> AddFunction ( $ function , $ namespace ) ; } | Adds a function to the symbols table . |
14,402 | public function AddClass ( \ Peg \ Lib \ Definitions \ Element \ ClassElement $ class , $ header , $ namespace = "\\" ) { $ this -> AddHeader ( $ header ) ; $ this -> headers [ $ header ] -> AddClass ( $ class , $ namespace ) ; } | Adds a class to the symbols table . |
14,403 | public function GetStandardType ( \ Peg \ Lib \ Definitions \ Element \ VariableType $ type ) { $ standard_type = "" ; switch ( $ type -> type ) { case "bool" : $ standard_type = StandardType :: BOOLEAN ; break ; case "unsigned int" : case "unsigned long" : case "long" : case "long int" : case "int" : case "size_t" : c... | Gets a standard type identifier for a variable type . |
14,404 | public function GetPHPStandardType ( \ Peg \ Lib \ Definitions \ Element \ VariableType $ type ) { $ standard_type = $ this -> GetStandardType ( $ type ) ; $ php_type = "" ; switch ( $ standard_type ) { case StandardType :: BOOLEAN : $ php_type .= "bool" ; break ; case StandardType :: INTEGER : $ php_type .= "int" ; br... | Gets the php standard type identifier for a variable type . |
14,405 | public function GetComponents ( $ type ) { $ type = trim ( str_replace ( "::" , "\\" , $ type ) ) ; $ type_elements = explode ( "\\" , $ type ) ; $ components = new Element \ TypeComponents ( ) ; if ( count ( $ type_elements ) > 1 ) { $ last_element = $ type_elements [ count ( $ type_elements ) - 1 ] ; unset ( $ type_e... | Get the components of a variable type as namespace and class by checking the whole symbols object for matches . |
14,406 | public function GetClassChilds ( $ class_name , $ namespace = "" ) { $ childs = array ( ) ; if ( ! $ namespace ) { $ components = $ this -> GetComponents ( $ class_name ) ; if ( $ components -> HasNamespace ( ) ) { $ namespace = $ components -> namespace ; $ class_name = $ components -> type ; } else { $ namespace = "\... | Gets a list of child classes that inherit from the given class . |
14,407 | public function HasNamespace ( $ namespace , $ header = "" ) { if ( $ header ) { if ( isset ( $ this -> headers [ $ header ] -> namespaces [ $ namespace ] ) ) { return $ this -> headers [ $ header ] -> namespaces [ $ namespace ] ; } } else { foreach ( $ this -> headers as $ header_object ) { if ( isset ( $ header_objec... | Check if the symbols object has a given namespace . |
14,408 | public function HasConstant ( $ name , $ header = "" , $ namespace = "" ) { if ( ! $ namespace ) { $ components = $ this -> GetComponents ( $ name ) ; if ( $ components -> HasNamespace ( ) ) { $ namespace = $ components -> namespace ; $ name = $ components -> type ; } } if ( $ header ) { if ( $ namespace ) { if ( isset... | Check if the symbols object has a constant . |
14,409 | public function HasEnumeration ( $ name , $ header = "" , $ namespace = "" ) { if ( ! $ namespace ) { $ components = $ this -> GetComponents ( $ name ) ; if ( $ components -> HasNamespace ( ) ) { $ namespace = $ components -> namespace ; $ name = $ components -> type ; } } if ( $ header ) { if ( $ namespace ) { if ( is... | Check if the symbols object has an enumeration . |
14,410 | public function HasTypeDef ( $ name , $ header = "" , $ namespace = "" ) { if ( ! $ namespace ) { $ components = $ this -> GetComponents ( $ name ) ; if ( $ components -> HasNamespace ( ) ) { $ namespace = $ components -> namespace ; $ name = $ components -> type ; } } if ( $ header ) { if ( $ namespace ) { if ( isset ... | Check if the symbols object has a typedef . |
14,411 | public function HasGlobalVariable ( $ name , $ header = "" , $ namespace = "" ) { if ( ! $ namespace ) { $ components = $ this -> GetComponents ( $ name ) ; if ( $ components -> HasNamespace ( ) ) { $ namespace = $ components -> namespace ; $ name = $ components -> type ; } } if ( $ header ) { if ( $ namespace ) { if (... | Check if the symbols object has a global variable . |
14,412 | public function HasFunction ( $ name , $ header = "" , $ namespace = "" ) { if ( ! $ namespace ) { $ components = $ this -> GetComponents ( $ name ) ; if ( $ components -> HasNamespace ( ) ) { $ namespace = $ components -> namespace ; $ name = $ components -> type ; } } if ( $ header ) { if ( $ namespace ) { if ( isset... | Check if the symbols object has a function . |
14,413 | public function HasClass ( $ name , $ header = "" , $ namespace = "" ) { if ( ! $ namespace ) { $ components = $ this -> GetComponents ( $ name ) ; if ( $ components -> HasNamespace ( ) ) { $ namespace = $ components -> namespace ; $ name = $ components -> type ; } } if ( $ header ) { if ( $ namespace ) { if ( isset ( ... | Check if the symbols object has a class . |
14,414 | public function RemoveNamespace ( $ name , $ header = "" ) { if ( $ header ) { unset ( $ this -> headers [ $ header ] -> namespaces [ $ name ] ) ; } else { foreach ( $ this -> headers as $ header_object ) { unset ( $ header_object -> namespaces [ $ name ] ) ; } } } | Removes a namespace from the symbols object . |
14,415 | public function RemoveConstant ( $ name , $ namespace = "" , $ header = "" ) { if ( $ header ) { if ( $ namespace ) { unset ( $ this -> headers [ $ header ] -> namespaces [ $ namespace ] -> constants [ $ name ] ) ; } else { foreach ( $ this -> headers [ $ header ] -> namespaces as $ namespace_object ) { unset ( $ names... | Removes a constant from the symbols object . |
14,416 | public function RemoveEnumeration ( $ name , $ namespace = "" , $ header = "" ) { if ( $ header ) { if ( $ namespace ) { unset ( $ this -> headers [ $ header ] -> namespaces [ $ namespace ] -> enumerations [ $ name ] ) ; } else { foreach ( $ this -> headers [ $ header ] -> namespaces as $ namespace_object ) { unset ( $... | Removes an enumeration from the symbols object . |
14,417 | public function RemoveTypeDef ( $ name , $ namespace = "" , $ header = "" ) { if ( $ header ) { if ( $ namespace ) { unset ( $ this -> headers [ $ header ] -> namespaces [ $ namespace ] -> type_definitions [ $ name ] ) ; } else { foreach ( $ this -> headers [ $ header ] -> namespaces as $ namespace_object ) { unset ( $... | Removes a typedef from the symbols object . |
14,418 | public function RemoveGlobalVariable ( $ name , $ namespace = "" , $ header = "" ) { if ( $ header ) { if ( $ namespace ) { unset ( $ this -> headers [ $ header ] -> namespaces [ $ namespace ] -> global_variables [ $ name ] ) ; } else { foreach ( $ this -> headers [ $ header ] -> namespaces as $ namespace_object ) { un... | Removes a global variable from the symbols object . |
14,419 | public function RemoveFunction ( $ name , $ namespace = "" , $ header = "" ) { if ( $ header ) { if ( $ namespace ) { unset ( $ this -> headers [ $ header ] -> namespaces [ $ namespace ] -> functions [ $ name ] ) ; } else { foreach ( $ this -> headers [ $ header ] -> namespaces as $ namespace_object ) { unset ( $ names... | Removes a function from the symbols object . |
14,420 | public function RemoveClass ( $ name , $ namespace = "" , $ header = "" ) { if ( $ header ) { if ( $ namespace ) { unset ( $ this -> headers [ $ header ] -> namespaces [ $ namespace ] -> classes [ $ name ] ) ; } else { foreach ( $ this -> headers [ $ header ] -> namespaces as $ namespace_object ) { unset ( $ namespace_... | Removes a class from the symbols object . |
14,421 | public static function get_top_level_parent_id ( $ post = null ) { if ( \ is_search ( ) || \ is_404 ( ) ) { return null ; } switch ( $ post ) { case null : global $ post ; case \ is_int ( $ post ) : $ post = \ get_post ( $ post ) ; case \ is_object ( $ post ) : $ ancestors = $ post -> ancestors ; break ; case \ is_arra... | Get value of top level hierarchical post ID . |
14,422 | public static function get_page_depth ( $ page = null ) { if ( $ page === null ) { global $ wp_query ; $ object = $ wp_query -> get_queried_object ( ) ; } else { $ object = \ get_post ( $ page ) ; } $ parent_id = $ object -> post_parent ; $ depth = 0 ; while ( $ parent_id > 0 ) { $ page = \ get_post ( $ parent_id ) ; $... | Get current page depth . |
14,423 | public function isQueued ( string $ alias ) : bool { $ query = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.alias = :alias' ) -> andWhere ( 'c.ended is NULL' ) -> setParameter ( 'alias' , $ alias ) -> getQuery ( ) ; try { $ result = $ query -> setMaxResults ( 1 ) -> getOneOrNullResult ( ) ; if ( $ result ) { retu... | Identify of cron command is queued . |
14,424 | public function addQueued ( string $ alias ) : bool { $ query = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.alias = :alias' ) -> setParameter ( 'alias' , $ alias ) -> getQuery ( ) ; try { $ edgarCron = $ query -> setMaxResults ( 1 ) -> getOneOrNullResult ( ) ; } catch ( NonUniqueResultException $ e ) { $ edgarCr... | Add cron to queued . |
14,425 | public function run ( EdgarCron $ edgarCron ) : bool { try { $ now = new \ DateTime ( 'now' ) ; $ edgarCron -> setStarted ( $ now ) ; $ this -> getEntityManager ( ) -> persist ( $ edgarCron ) ; $ this -> getEntityManager ( ) -> flush ( ) ; } catch ( ORMException $ e ) { return false ; } return true ; } | Run cron command . |
14,426 | public function findComponent ( string $ type , string $ key ) { $ componentType = $ this -> typeRegistry -> getType ( $ type ) ; return $ componentType -> getComponent ( $ key ) ; } | Finds a specific component view with a given type and key . |
14,427 | public function toSQL ( WhereTree $ data = null ) { if ( $ data === null ) { $ data = $ this -> data ; } $ res = '' ; foreach ( $ data -> getChilds ( ) as $ v ) { if ( $ v -> getChilds ( ) ) { $ res .= '(' . $ this -> toSQL ( $ v ) . ')' ; } elseif ( $ v -> getValue ( ) instanceof SQLExpressionParser ) { $ res .= $ v -... | Converts object to SQL - expression |
14,428 | public function addDependency ( $ dep ) { if ( is_array ( $ dep ) ) { $ this -> dependencies = array_merge ( $ this -> dependencies , $ dep ) ; } else { $ this -> dependencies [ ] = $ dep ; } } | Add external project dependency |
14,429 | public function addCheck ( string $ name , $ check ) { if ( array_key_exists ( $ name , $ this -> checks ) ) { throw new \ Exception ( 'Health check with name ' . $ name . ' already registered' ) ; } if ( ! is_callable ( $ check ) && ! class_exists ( $ check ) ) { throw new \ Exception ( 'Health check must be callable ... | Add health check |
14,430 | public function run ( array $ args = [ ] ) : string { $ result = [ 'name' => $ this -> name , 'status' => 'ok' , 'components' => [ ] , 'dependencies' => $ this -> dependencies ] ; foreach ( $ this -> checks as $ service => $ check ) { $ checkArgs = isset ( $ args [ $ service ] ) ? $ args [ $ service ] : [ ] ; if ( is_s... | Run health checks and get result as string . |
14,431 | public function cache_widget ( $ args , $ content ) { wp_cache_set ( $ this -> getModel ( ) -> getIdentifier ( ) , [ $ args [ 'widget_id' ] => $ content ] , 'widget' ) ; return $ content ; } | Cache the widget . |
14,432 | public function form ( $ instance ) { $ fields = $ this -> getModel ( ) -> getFields ( ) ; if ( empty ( $ fields ) ) { return ; } $ new_title = [ 'special' => [ 'id' => 'title' , 'title' => Translate :: t ( 'widget.fields.title' ) , ] , ] ; if ( class_exists ( '\\GetOlympus\\Field\\Text' ) ) { $ new_title = \ GetOlympu... | Displays the form for this widget on the Widgets page of the WP Admin area . |
14,433 | public function get_cached_widget ( $ args ) { $ cache = wp_cache_get ( $ this -> getModel ( ) -> getIdentifier ( ) , 'widget' ) ; if ( ! is_array ( $ cache ) ) { $ cache = [ ] ; } if ( isset ( $ cache [ $ args [ 'widget_id' ] ] ) ) { echo $ cache [ $ args [ 'widget_id' ] ] ; return true ; } return false ; } | Get cached widget . |
14,434 | public function update ( $ new_instance , $ old_instance ) { $ instance = $ old_instance ; foreach ( $ new_instance as $ k => $ i ) { $ instance [ $ k ] = isset ( $ new_instance [ $ k ] ) ? strip_tags ( $ new_instance [ $ k ] ) : false ; } $ this -> flush_widget_cache ( ) ; $ alloptions = wp_cache_get ( 'alloptions' , ... | Deals with the settings when they are saved by the admin . Here is where any validation should be dealt with . |
14,435 | public function widget_start ( $ args , $ instance , $ title ) { echo $ args [ 'before_widget' ] ; if ( $ title && $ this -> getModel ( ) -> getDisplayTitle ( ) ) { echo $ args [ 'before_title' ] . $ title . $ args [ 'after_title' ] ; } } | HTML at the start of a widget . |
14,436 | public function widget ( $ args , $ instance ) { global $ wpdb ; $ cache = wp_cache_get ( $ this -> getModel ( ) -> getIdentifier ( ) , 'widget' ) ; if ( ! is_array ( $ cache ) ) { $ cache = [ ] ; } if ( ! isset ( $ args [ 'widget_id' ] ) ) { $ args [ 'widget_id' ] = null ; } if ( isset ( $ cache [ $ args [ 'widget_id'... | Outputs the HTML for this widget . |
14,437 | public function seek ( $ position ) { $ index = $ this -> getIndexData ( ) ; $ maxPosition = count ( $ index ) - 1 ; if ( $ position > $ maxPosition ) { $ position = $ maxPosition ; } fseek ( $ this -> file , $ index [ $ position ] ) ; $ this -> pointer = $ position ; } | Seek a position of an item |
14,438 | public function current ( ) { if ( $ this -> string === null ) { $ this -> string = fgets ( $ this -> file ) ; } $ string = rtrim ( $ this -> string , "\n\r" ) ; if ( $ this -> delimiter === null ) { return $ string ; } $ dataRaw = explode ( $ this -> delimiter , $ string ) ; $ data = [ ] ; if ( $ this -> partsNames ==... | Get the current position s item |
14,439 | public function valid ( ) { if ( $ this -> string === null ) { $ this -> string = fgets ( $ this -> file ) ; } return $ this -> string === false ? false : true ; } | Is the position valid ? |
14,440 | public function getIndexData ( ) { if ( $ this -> index === null ) { $ currentPointer = ftell ( $ this -> file ) ; fseek ( $ this -> file , 0 ) ; $ count = 0 ; $ this -> index = [ ] ; while ( fgets ( $ this -> file ) !== false ) { $ this -> index [ ++ $ count ] = ftell ( $ this -> file ) ; } fseek ( $ this -> file , $ ... | Get the index data about items positions |
14,441 | public function adminBarSetting ( $ args ) { if ( empty ( $ args ) ) { return ; } add_action ( 'wp_before_admin_bar_render' , function ( ) use ( $ args ) { global $ wp_admin_bar ; foreach ( $ args as $ item ) { $ wp_admin_bar -> remove_menu ( $ item ) ; } } ) ; } | Remove some items from WP admin bar . |
14,442 | public function adminFooterSetting ( $ description ) { $ desc = is_array ( $ description ) ? $ description [ 0 ] : $ description ; add_filter ( 'admin_footer_text' , function ( ) use ( $ desc ) { echo '<span id="footer-thankyou">' . $ desc . '</span>' ; } ) ; } | Update WP footer copyright . |
14,443 | public function adminMenuOrderSetting ( $ args ) { if ( empty ( $ args ) ) { return ; } add_filter ( 'custom_menu_order' , '__return_true' ) ; add_filter ( 'menu_order' , function ( $ menu_ord ) use ( $ args ) { return ! $ menu_ord ? [ ] : $ args ; } ) ; } | Reorder WP admin main menu . |
14,444 | public function adminMetaBoxesSetting ( $ args ) { if ( empty ( $ args ) ) { return ; } add_action ( 'wp_dashboard_setup' , function ( ) use ( $ args ) { foreach ( $ args as $ widget ) { if ( ! is_array ( $ widget ) ) { continue ; } $ count = count ( $ widget ) ; if ( 3 > $ count ) { continue ; } if ( 3 === $ count ) {... | Remove some admin widgets . |
14,445 | public function commentsFieldsOrderSetting ( $ fields ) { add_filter ( 'comment_form_fields' , function ( $ comment_fields ) use ( $ fields ) { $ new_fields = [ ] ; foreach ( $ fields as $ field ) { if ( ! isset ( $ comment_fields [ $ field ] ) ) { continue ; } $ new_fields [ $ field ] = $ comment_fields [ $ field ] ; ... | Comment fields in wanted order . |
14,446 | public function jpegQualitySetting ( $ quality ) { $ q = is_bool ( $ quality ) && $ quality ? 72 : ( integer ) $ quality ; $ q = 0 < $ q && $ q <= 100 ? $ q : 72 ; add_filter ( 'jpeg_quality' , function ( ) use ( $ q ) { return $ q ; } ) ; } | Update JPEG quality of generated images . |
14,447 | public function actionIndex ( ) { $ partners = PartnerRequest :: find ( ) -> all ( ) ; $ searchModel = new SearchPartnerRequest ( ) ; $ dataProvider = $ searchModel -> search ( Yii :: $ app -> request -> queryParams ) ; return $ this -> render ( 'index' , [ 'partners' => $ partners , 'searchModel' => $ searchModel , 'd... | Lists all PartnerRequest models . |
14,448 | public function composeJson ( array $ data = [ ] , int $ status = 200 , array $ config = [ ] ) : SymfonyResponse { return Response :: make ( $ this -> createJsonResponse ( $ data , $ config ) ( ) , $ status , [ 'Content-Type' => 'application/json' , ] ) ; } | Compose JSON . |
14,449 | public function streamJson ( array $ data = [ ] , $ status = 200 , array $ config = [ ] ) : SymfonyResponse { return Response :: stream ( $ this -> createJsonResponse ( $ data , $ config ) , $ status , [ 'Content-Type' => 'application/json' , ] ) ; } | Stream JSON . |
14,450 | protected function createJsonResponse ( array $ data , array $ config ) { if ( ! \ is_null ( $ uses = $ config [ 'uses' ] ?? null ) ) { $ data = $ data [ $ uses ] ?? [ ] ; } if ( $ data instanceof Arrayable ) { $ data = $ data -> toArray ( ) ; } $ data = \ array_map ( [ $ this , 'transformToArray' ] , $ data ) ; return... | Convert content to JSON . |
14,451 | public function getMultipleByTags ( array $ tags ) { $ result = [ ] ; $ len = strlen ( $ this -> prefix ) ; foreach ( $ tags as $ tag ) { foreach ( $ this -> object -> getByTag ( $ this -> prefix . $ tag ) as $ key => $ value ) { if ( strncmp ( $ key , $ this -> prefix , $ len ) === 0 ) { $ result [ substr ( $ key , $ ... | Returns the cached keys and values associated to the given tags . |
14,452 | public static function checkValueTypes ( array $ types , $ value ) { foreach ( $ types as $ type ) { $ type = strtolower ( $ type ) ; if ( array_key_exists ( $ type , self :: $ hints ) && call_user_func ( self :: $ hints [ $ type ] , $ value ) ) return true ; if ( is_object ( $ value ) && @ is_a ( $ value , $ type ) ) ... | Checks a value to the allowed types |
14,453 | static function definition ( ) { static $ def = null ; if ( $ def === null ) { $ def = parent :: definition ( ) ; $ def [ 'class_name' ] = 'ezsrRatingObjectTreeNode' ; $ def [ 'fields' ] [ 'rating' ] = array ( 'name' => 'Rating' , 'datatype' => 'integer' , 'default' => 0 , 'required' => false ) ; $ def [ 'fields' ] [ '... | definition of ezsrRatingObjectTreeNode extends eZContentObjectTreeNode definition |
14,454 | static function makeObjectsArray ( $ array , $ with_contentobject = true ) { $ retNodes = array ( ) ; if ( ! is_array ( $ array ) ) return $ retNodes ; foreach ( $ array as $ node ) { unset ( $ object ) ; if ( $ node [ 'node_id' ] == 1 ) { if ( ! isset ( $ node [ 'name' ] ) || ! $ node [ 'name' ] ) $ node [ 'name' ] = ... | handling in eZPersistentObject |
14,455 | public function init ( ) { $ slug = Helpers :: urlize ( $ this -> getModel ( ) -> getSlug ( ) ) ; $ this -> getModel ( ) -> setSlug ( $ slug ) ; if ( in_array ( $ slug , $ this -> forbidden_slugs ) ) { throw new TermException ( Translate :: t ( 'term.errors.slug_is_forbidden' ) ) ; } $ posttype = $ this -> getModel ( )... | Build TermModel and initialize hook . |
14,456 | private static function findAllAncestry ( $ categoryId , $ parentCategoriesArray = [ ] ) { $ category = Category :: findOne ( $ categoryId ) ; if ( ! empty ( $ category ) ) { $ parentCategoryId = $ category -> parent_id ; } else throw new NotFoundHttpException ( ) ; if ( ! empty ( $ parentCategoryId ) ) { $ parentCateg... | Gets all category s ancestry . |
14,457 | protected function createLocalResourceFileSettings ( Theme $ theme , string $ type , string $ filename ) : ResourceSettings { return new Settings ( [ 'key' => $ this -> crc ( sprintf ( '%s%s%s' , $ theme -> getKey ( ) , $ type , $ filename ) ) , 'filename' => $ filename , 'url' => $ this -> getThemeBaseUrl ( $ theme ) ... | Create and return settings for resource . |
14,458 | public function canEdit ( GroupableInterface $ groupable , TokenInterface $ token ) : bool { $ user = $ token -> getUser ( ) ; foreach ( $ groupable -> getGroups ( ) as $ group ) { if ( $ this -> decision_manager -> decide ( $ token , [ 'GROUP_ROLE_EDITOR' ] , $ group ) ) { return true ; } } return false ; } | Grants edit access to group editors for groupable entities . |
14,459 | public function canView ( GroupableInterface $ groupable , TokenInterface $ token ) : bool { $ user = $ token -> getUser ( ) ; if ( $ groupable instanceof ExpirableInterface && $ groupable -> isExpired ( ) ) { $ required_role = 'GROUP_ROLE_EDITOR' ; } elseif ( $ groupable instanceof ActiveInterface && ! $ groupable -> ... | Grants view access to group members for groupable entities . |
14,460 | public function build ( ContainerBuilder $ container ) : void { parent :: build ( $ container ) ; $ container -> addCompilerPass ( new AddMenuVotersPass ( ) ) ; $ container -> addCompilerPass ( new ReplaceMenuMatcherPass ( ) ) ; $ container -> addCompilerPass ( new ConfigureAmazonMetaPass ( ) ) ; } | Add the menu matcher compiler . |
14,461 | protected function readConfig ( ) { if ( ! $ this -> configLocator ) { throw new \ RuntimeException ( 'No FileLocator for config file.' ) ; } $ env = ( $ this -> container -> hasParameter ( 'kernel.env' ) ) ? $ this -> container -> getParameter ( 'kernel.env' ) : 'prod' ; $ coreConfig = 'core.yml' ; $ appConfig = 'app_... | readConfig Read the configuration files and get service factories . |
14,462 | public function create ( $ name , array $ arguments = array ( ) ) { if ( ! isset ( $ this -> reflections [ $ name ] ) ) $ this -> reflections [ $ name ] = new \ ReflectionClass ( $ this -> registry [ $ name ] ) ; $ reflection = $ this -> reflections [ $ name ] ; return $ reflection -> newInstanceArgs ( $ arguments ) ; ... | General method to create classes from the registered list . |
14,463 | public function createRoute ( Group $ group , $ name , array $ parameters ) { return $ this -> create ( 'route' , array ( $ group , $ name , $ parameters ) ) ; } | Create route object |
14,464 | public function createGroup ( array $ routes = array ( ) , Route $ route = null ) { return $ this -> create ( 'group' , array ( $ this , $ route , $ routes ) ) ; } | Create routing group object |
14,465 | public function resolveGroup ( $ pattern , $ route = null ) { foreach ( $ this -> groupHandlers as $ handler ) { if ( ! $ handler -> validate ( $ pattern , $ route ) ) continue ; return $ handler -> resolve ( $ this , $ pattern , $ route ) ; } foreach ( $ this -> defaultGroupHandlers as $ handler ) { if ( ! $ handler -... | Create routing group by given path For now assume the passed pattern as path |
14,466 | public function createFinding ( Route $ route = null , array $ parameters = null , ServerRequestInterface $ request = null ) { return $ this -> create ( 'finding' , array ( $ route , $ parameters , $ request ) ) ; } | Create route finding |
14,467 | public function CreatePart ( $ pw ) { PhpWsdl :: Debug ( 'Create WSDL definition for parameter part ' . $ this -> Name ) ; $ res = '<wsdl:part name="' . $ this -> Name . '" type="' ; $ res .= PhpWsdl :: TranslateType ( $ this -> Type ) . '"' ; if ( $ pw -> IncludeDocs && ! $ pw -> Optimize && ! is_null ( $ this -> Docs... | Create the part WSDL |
14,468 | public function CreateParamHtml ( $ data ) { PhpWsdl :: Debug ( 'CreateParamHtml for ' . $ data [ 'param' ] -> Name ) ; $ res = & $ data [ 'res' ] ; $ p = & $ data [ 'param' ] ; if ( is_null ( $ p -> Docs ) ) return ; if ( in_array ( $ p -> Type , PhpWsdl :: $ BasicTypes ) ) { $ res [ ] = '<li class="pre"><span class="... | Create parameter HTML documentation |
14,469 | public function CreateReturnHtml ( $ data ) { PhpWsdl :: Debug ( 'CreateReturnHtml for ' . $ data [ 'method' ] -> Return -> Name ) ; $ res = & $ data [ 'res' ] ; $ m = & $ data [ 'method' ] ; $ res [ ] = '<p>Return value <span class="pre">' ; $ o = sizeof ( $ res ) - 1 ; $ type = $ m -> Return -> Type ; if ( in_array (... | Create return value HTML documentation |
14,470 | public static function InterpretParam ( $ data ) { if ( $ data [ 'method' ] == '' ) return true ; $ info = explode ( ' ' , $ data [ 'keyword' ] [ 1 ] , 3 ) ; if ( sizeof ( $ info ) < 2 ) return true ; $ name = substr ( $ info [ 1 ] , 1 ) ; if ( substr ( $ name , strlen ( $ name ) - 1 , 1 ) == ';' ) $ name = substr ( $ ... | Interpret a parameter keyword |
14,471 | public static function InterpretReturn ( $ data ) { if ( $ data [ 'method' ] == '' ) return true ; $ info = explode ( ' ' , $ data [ 'keyword' ] [ 1 ] , 2 ) ; if ( sizeof ( $ info ) < 1 ) return true ; PhpWsdl :: Debug ( 'Interpret return' ) ; if ( $ data [ 'server' ] -> ParseDocs ) if ( sizeof ( $ info ) > 1 ) $ data ... | Interpret a return value |
14,472 | public static function processSingleColumn ( $ column_name , $ column_options , $ data , $ options = [ ] ) { $ result = [ ] ; if ( ! empty ( $ options [ 'process_domains' ] ) ) { $ temp = [ $ column_name => $ column_options ] ; $ temp = \ Object \ Data \ Common :: processDomainsAndTypes ( $ temp ) ; $ column_options = ... | Process single column |
14,473 | public function setAuth ( $ user , $ pass ) { $ this -> user = ( string ) $ user ; $ this -> pass = ( string ) $ pass ; return $ this -> hasAuth ( ) ; } | Set auth data for API . |
14,474 | public function execute ( Command $ command ) { if ( ! $ command -> isValid ( ) ) { throw new Exception ( 'Invalid API command supplied' ) ; } $ result = $ this -> curl ( ) -> post ( $ this -> getUrl ( $ command ) , $ command -> getData ( ) ) ; $ type = $ this -> getResponseType ( ) ; return new Response ( $ result -> ... | Execute API command . |
14,475 | private function getResponseType ( ) { if ( false === strpos ( $ this -> url , '.' ) ) { return "" ; } list ( $ path , $ type ) = explode ( '.' , basename ( $ this -> url ) , 2 ) ; return $ type ; } | Return expected response type based on URL . |
14,476 | private function curl ( ) { if ( ! ( $ this -> curl instanceof cURL ) ) { $ this -> curl = new cURL ( ) ; } if ( $ this -> hasAuth ( ) ) { $ this -> curl -> setCredentials ( $ this -> user , $ this -> pass ) ; } if ( $ this -> cookie && is_writeable ( dirname ( $ this -> cookie ) ) ) { $ this -> curl -> setCookieStorag... | Get browser for making API requests - create an instance - assign auth data if we have it . |
14,477 | protected function getUrl ( Command $ command ) { return $ this -> url . ( stripos ( $ this -> url , '?' ) !== false ? '&' : '?' ) . http_build_query ( [ self :: COMMAND => $ command -> getName ( ) ] ) ; } | Get API URL for given command . |
14,478 | public function create ( ) : bool { $ dbObject = Database :: getInstance ( ) ; $ attributes = $ this -> sanitizedAttributes ( ) ; $ sqlQuery = "INSERT INTO " . static :: $ tableName . " (" ; $ sqlQuery .= join ( ", " , array_keys ( $ attributes ) ) ; $ sqlQuery .= ") VALUES ('" ; $ sqlQuery .= join ( "', '" , array_val... | Create new record in the database . |
14,479 | public function update ( ) : bool { $ dbObject = Database :: getInstance ( ) ; $ sqlQuery = "UPDATE " . static :: $ tableName . " SET " . $ this -> generateQueryForUPdate ( ) ; $ sqlQuery .= " WHERE id = " . $ dbObject -> escapeValue ( $ this -> id ) ; $ result = $ dbObject -> query ( $ sqlQuery ) ; return ( $ result )... | Update new record in the database . |
14,480 | public function deleteRow ( int $ id ) : bool { $ this -> id = $ id ; return $ this -> delete ( ) ? TRUE : FALSE ; } | Deletes a row from the database . |
14,481 | public function delete ( ) : bool { $ dbObject = Database :: getInstance ( ) ; $ sqlQuery = "DELETE FROM " . static :: $ tableName . " WHERE id=" ; $ sqlQuery .= $ dbObject -> escapeValue ( $ this -> id ) . " LIMIT 1" ; $ dbObject -> query ( $ sqlQuery ) ; static :: $ affectedRows = $ dbObject -> affectedRows ( ) ; ret... | Delete a record from the database |
14,482 | public static function deleteWhere ( string $ column , array $ operatorValue , string $ joinOperator = "AND" ) : bool { $ joinOperator = static :: validateOperator ( $ joinOperator , "AND" ) ; $ expression = static :: generateValue ( $ column , $ operatorValue , $ joinOperator ) ; $ sqlQuery = "DELETE FROM " . static :... | Delete a record from the database where a given column is equal to the given value |
14,483 | public static function findById ( int $ id , string $ operator = "=" , int $ limit = 1 ) { $ id = Database :: getInstance ( ) -> escapeValue ( $ id ) ; $ operator = static :: validateOperator ( $ operator , '=' ) ; return static :: limitFindBySql ( "SELECT * FROM " . static :: $ tableName . " WHERE id {$operator} {$id}... | Finds a row or more rows by the id column and returns found row as an object otherwise FALSE |
14,484 | public static function findSome ( int $ limit = 0 , string $ order = "DESC" ) { $ order = static :: validateOrder ( $ order ) ; return static :: limitFindBySql ( "SELECT * FROM " . static :: $ tableName . " ORDER BY id {$order}" , $ limit ) ; } | Find some of the database rows by limiting it . |
14,485 | public static function findColumn ( string $ column , int $ limit = 0 , string $ order = "DESC" ) { $ order = static :: validateOrder ( $ order ) ; $ dbObject = Database :: getInstance ( ) ; $ column = $ dbObject -> escapeValue ( $ column ) ; return static :: limitFindBySql ( "SELECT {$column} FROM " . static :: $ tabl... | Find by column from the database |
14,486 | public static function findColumns ( array $ columns , int $ limit = 0 , string $ order = "DESC" ) { $ order = static :: validateOrder ( $ order ) ; $ dbObject = Database :: getInstance ( ) ; $ columns = joinArray ( $ dbObject -> escapeValues ( $ columns ) , ', ' ) ; return static :: limitFindBySql ( "SELECT {$columns}... | Find by columns from the database |
14,487 | public static function findByColumn ( string $ column , array $ operatorValue , string $ joinOperator = "AND" , int $ limit = 1 ) { $ joinOperator = static :: validateOperator ( $ joinOperator , "AND" ) ; $ expression = static :: generateValue ( $ column , $ operatorValue , $ joinOperator ) ; $ sqlQuery = "SELECT * FRO... | Find where a given column is equal to a given value and return the first occurence as the first element in the array . |
14,488 | public static function search ( string $ column , string $ searchQ , int $ limit = 0 , string $ order = "DESC" ) { $ order = static :: validateOrder ( $ order ) ; return static :: limitFindBySql ( "SELECT * FROM " . static :: $ tableName . " WHERE {$column} LIKE '%$searchQ%' ORDER BY id {$order}" , $ limit ) ; } | Search the database |
14,489 | public static function countAll ( ) : int { $ dbObject = Database :: getInstance ( ) ; $ sqlQuery = "SELECT COUNT(*) FROM " . static :: $ tableName ; $ resultSet = $ dbObject -> query ( $ sqlQuery ) ; $ row = Database :: fetchAssoc ( $ resultSet ) ; return ( int ) array_shift ( $ row ) ; } | Count all database entries |
14,490 | public static function countWhere ( string $ column , array $ operatorValue , string $ joinOperator = "AND" ) : int { $ joinOperator = static :: validateOperator ( $ joinOperator , "AND" ) ; $ expression = static :: generateValue ( $ column , $ operatorValue , $ joinOperator ) ; $ sqlQuery = "SELECT COUNT(*) as count F... | Count where a given column is equal to a given value |
14,491 | public function index ( FormData $ formData , $ properties ) { $ id = $ this -> persistenceManager -> getIdentifierByObject ( $ formData ) ; $ formValues = json_decode ( $ formData -> getFormValues ( ) , true ) ; $ formValues [ '_date' ] = $ formData -> getDate ( ) ; $ data = $ this -> parseData ( $ formValues , $ prop... | Index the submitted form data to elastic . |
14,492 | public function Start ( $ path ) { if ( ! is_dir ( $ path ) ) return ; $ path = rtrim ( $ path , "/\\" ) . "/" ; $ elements = scandir ( $ path ) ; foreach ( $ elements as $ file_name ) { if ( is_file ( $ path . $ file_name ) ) { $ file_parts = explode ( "." , $ file_name , 2 ) ; if ( count ( $ file_parts ) < 2 ) contin... | Scans a given path for valid plugin files and load them if possible . This method should be called after everything else in the application has been properly initialized . |
14,493 | function setSetting ( $ setting ) { if ( ! is_string ( $ setting ) && ! is_array ( $ setting ) && ! $ setting instanceof \ Traversable ) throw new \ InvalidArgumentException ( sprintf ( 'Config must be array, Traversable or string as service represent these both; given: (%s).' , \ Poirot \ Std \ flatten ( $ setting ) )... | Set Sapi Config |
14,494 | public function pickUpTranslation ( Project $ project , array $ languages , array $ domains , bool $ revision ) : ? Translation { $ repositories = $ project -> getRepositories ( $ domains , $ languages ) ; $ translations = array_reduce ( $ repositories , function ( Repository $ repository ) use ( $ revision ) { $ trans... | Given a Project a set of languages and a set of domains return a random non filled yet Translation object . |
14,495 | public function setWrapIntoCollection ( $ flag = true , $ model = null , $ primary = null ) { $ this -> _wrapIntoCollection = ( bool ) $ flag ; if ( $ model !== null ) { $ this -> _modelClass = ( string ) $ model ; } if ( $ primary !== null ) { $ this -> _primary = ( string ) $ primary ; } } | Wrap items into the collection |
14,496 | protected function loadGlobalViewVariables ( Config $ config ) { $ app = app ( ) ; $ share = [ ] ; foreach ( $ config -> get ( 'globalviewvars' ) as $ name => $ abstract ) { $ share [ $ name ] = $ app -> make ( $ abstract ) ; } $ this -> share ( $ share ) ; if ( method_exists ( $ this , 'loadExtraGlobalViewVariables' )... | Load global variables available in all views |
14,497 | protected function renderStatePage ( array $ data , bool $ error = false , ? string $ view = null ) : View { return $ error ? $ this -> renderErrorPage ( $ data , $ view ) : $ this -> renderSuccessPage ( $ data , $ view ) ; } | Render error or success page |
14,498 | protected function renderSuccessPage ( array $ data , ? string $ view = null ) : View { return $ this -> view -> make ( $ view ?? 'state.success' ) -> with ( $ data ) ; } | Render success page |
14,499 | public static function get_current_url ( $ remove_query = false ) { global $ wp ; if ( $ remove_query === true ) { return \ trailingslashit ( \ home_url ( $ wp -> request ) ) ; } return \ home_url ( \ add_query_arg ( null , null ) ) ; } | Gets the current full URL of the page with query string host and scheme . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.