idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
24,600
public function registerNodeTypes ( SessionInterface $ session ) { $ cnd = sprintf ( '<%s=\'https://github.com/symfony-cmf/content-type\'>' , $ this -> encoder -> getPrefix ( ) , $ this -> encoder -> getUri ( ) ) ; $ nodeTypeManager = $ session -> getWorkspace ( ) -> getNodeTypeManager ( ) ; $ nodeTypeManager -> registerNodeTypesCnd ( $ cnd , true ) ; }
Register the content - type node types with the given PHPCR session .
24,601
public static function flatten ( $ data , $ flat = array ( ) , $ prefix = '' ) { foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ flat = self :: flatten ( $ value , $ flat , $ prefix . $ key . self :: $ FLATTEN_SEPARATOR ) ; } else { $ flat [ $ prefix . $ key ] = $ value ; } } return $ flat ; }
Flattens input data
24,602
public function buildResponse ( GetResponseForControllerResultEvent $ event ) { $ request = $ event -> getRequest ( ) ; if ( ! $ request -> attributes -> has ( RouteKeys :: ACTION ) || $ request -> attributes -> get ( RouteKeys :: ACTION ) !== 'capabilities' ) { return ; } $ routes = $ event -> getControllerResult ( ) ; $ response = new Response ; $ links = $ response -> headers -> get ( 'Link' , null , false ) ; foreach ( $ routes as $ name => $ route ) { $ definition = $ route -> getDefault ( RouteKeys :: DEFINITION ) ; list ( $ collection , $ resource ) = explode ( '::' , $ definition ) ; $ definition = $ this -> registry -> getCollection ( $ collection ) -> getResource ( $ resource ) ; $ links [ ] = sprintf ( '<%s>; rel="endpoint"; name="%s_%s"' , $ this -> urlGenerator -> generate ( $ name ) , $ definition -> getCollection ( ) , $ definition ) ; } $ response -> headers -> add ( [ 'Link' => $ links ] ) ; $ event -> setResponse ( $ response ) ; }
Build the response to expose all routes of the API
24,603
public function setType ( string $ type ) : self { if ( ! isset ( $ this -> types [ $ type ] ) ) { Checkers :: notice ( 'Unknown response type [' . $ type . ']' ) ; } else { $ this -> type = $ type ; } return $ this ; }
Content - Type
24,604
public function setDisposition ( string $ dispositionType , $ filename = null , $ name = null ) { if ( ! in_array ( $ dispositionType , $ this -> dispositions ) ) { Checkers :: notice ( 'Unknown response type [' . $ type . ']' ) ; } else { $ this -> disposition [ 'type' ] = $ dispositionType ; } if ( $ filename !== null ) { $ this -> disposition [ 'filename' ] = ( string ) $ filename ; } if ( $ name !== null ) { $ this -> disposition [ 'name' ] = ( string ) $ name ; } return $ this ; }
Content - Disposition
24,605
public function connect ( $ host = false , $ user = false , $ password = false , $ database = false , $ newLink = false ) { $ this -> connection = mysqli_connect ( $ host , $ user , $ password , $ newLink ) ; if ( $ this -> connection ) { if ( $ this -> selectDatabase ( $ database ) ) { $ this -> query ( "SET CHARACTER SET utf8" ) ; $ this -> query ( "SET NAMES utf8" ) ; return $ this -> connection ; } else { $ message = 'Cannot select database ' . $ database ; } } else { $ message = mysqli_error ( $ this -> connection ) ; } if ( ! $ this -> connection ) { trigger_error ( $ message , E_USER_WARNING ) ; } }
Connects to MySQL server
24,606
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ repository = $ this -> getContainer ( ) -> get ( 'ezpublish.api.repository' ) ; $ questionHelper = $ this -> getHelper ( 'question' ) ; $ question = new Question ( 'Content type group name: ' ) ; $ question -> setValidator ( array ( 'Smile\EzToolsBundle\Command\ContentTypeGroup\Validators' , 'validateContentTypeGroupName' ) ) ; $ contentTypeGroupName = false ; while ( ! $ contentTypeGroupName ) { $ contentTypeGroupName = $ questionHelper -> ask ( $ input , $ output , $ question ) ; if ( ! $ contentTypeGroupName || empty ( $ contentTypeGroupName ) ) { $ output -> writeln ( "<error>Content type group name should only contains numbers, letters or space</error>" ) ; } } $ configResolver = $ this -> getContainer ( ) -> get ( 'ezpublish.config.resolver' ) ; $ adminID = $ configResolver -> getParameter ( 'adminid' , 'smile_ez_tools' ) ; $ contentTypeGroupService = new ContentTypeGroup ( $ repository ) ; $ contentTypeGroupService -> setAdminID ( $ adminID ) ; try { $ contentTypeGroupService -> add ( $ contentTypeGroupName ) ; $ output -> writeln ( "<info>Content type group created '$contentTypeGroupName'<info>" ) ; } catch ( UnauthorizedException $ e ) { $ output -> writeln ( "<error>" . $ e -> getMessage ( ) . "</error>" ) ; } catch ( ForbiddenException $ e ) { $ output -> writeln ( "<error>" . $ e -> getMessage ( ) . "</error>" ) ; } }
Execute ContentTypeGroup generate command
24,607
public function updateBillingInfo ( $ code = null , $ data = [ ] ) { $ payload = [ ] ; if ( ! $ code ) { $ code = $ this -> data -> code ; } if ( ! empty ( $ data ) ) { $ payload [ 'credit_card' ] = $ data ; } elseif ( isset ( $ this -> data -> billing_info ) ) { $ payload = $ this -> data -> billing_info ; } $ this -> client -> put ( '/{code}/billing_infos' , [ $ code ] , $ payload ) ; return $ this ; }
Update Billing info
24,608
public function setBirthdate ( $ birthdate ) { $ date = DateTime :: createFromFormat ( 'Y-m-d' , $ birthdate ) ; $ this -> data -> birthdate_day = $ date -> format ( 'd' ) ; $ this -> data -> birthdate_month = $ date -> format ( 'm' ) ; $ this -> data -> birthdate_year = $ date -> format ( 'Y' ) ; return $ this ; }
Set customer birthday
24,609
public function setBillingInfo ( $ holderName , $ number , $ expirationMonth , $ expirationYear ) { $ this -> client -> addQueryString ( 'new_vault' , true ) ; $ this -> data -> billing_info = new stdClass ; $ creditCard = $ this -> data -> billing_info -> credit_card = new stdClass ; $ creditCard -> holder_name = $ holderName ; $ creditCard -> number = $ number ; $ creditCard -> expiration_month = $ expirationMonth ; $ creditCard -> expiration_year = $ expirationYear ; return $ this ; }
Set customer billing info
24,610
public function get ( $ key ) { if ( isset ( $ this -> claims [ 'data' ] [ $ key ] ) ) { return $ this -> claims [ 'data' ] [ $ key ] ; } else { return null ; } }
Get token private claim
24,611
public function setPeriod ( \ DateTime $ start = null , \ DateTime $ end = null ) { $ this -> claims [ 'nbf' ] = $ start -> getTimestamp ( ) ; $ this -> claims [ 'exp' ] = $ end -> getTimestamp ( ) ; return $ this ; }
Sets token expiration period
24,612
public static function add ( $ connection , $ setAsDefault = false ) { $ connectionName = $ connection -> getName ( ) ; self :: $ connectionList [ $ connectionName ] = $ connection ; if ( $ setAsDefault === true ) { self :: setDefault ( $ connectionName ) ; } }
Add a connection to collection
24,613
public static function get ( $ connectionName ) { if ( self :: exists ( $ connectionName ) === true ) { return self :: $ connectionList [ $ connectionName ] ; } else { throw new Exception ( 'Datasource "' . $ connectionName . '" isn\'t defined in DatasourceCollection' ) ; return false ; } }
Get connection by his name
24,614
public static function getDefault ( ) { if ( self :: existsDefault ( ) ) { $ defaultConnectionName = self :: $ defaultConnectionName ; return self :: $ connectionList [ $ defaultConnectionName ] ; } else { throw new Exception ( 'Datasource "' . $ defaultConnectionName . '" isn\'t defined in DatasourceCollection' ) ; return false ; } }
Get default connection
24,615
public static function setDefault ( $ connectionName , $ force = true ) { if ( $ force === false && self :: existsDefault ( ) === true ) { throw new Exception ( 'A default Datasource is already defined.' ) ; return false ; } else { self :: $ defaultConnectionName = $ connectionName ; return true ; } }
Set default connection
24,616
public function findAssociationCategoryByID ( $ id ) { $ categories = $ this -> findAssociationCategories ( ) -> getCategories ( ) ; $ categories -> rewind ( ) ; while ( $ categories -> valid ( ) ) { $ category = $ categories -> current ( ) ; if ( $ category -> getID ( ) == $ id ) { return $ category ; } $ categories -> next ( ) ; } }
return a association category
24,617
public function findAssociationCategories ( ) { $ xmlQuery = $ this -> metaApiService -> getAssociationCategories ( ) ; $ categories = new Categories ( ) ; $ mapper = new \ RGU \ Dvoconnector \ Mapper \ AssociationCategories ( $ xmlQuery ) ; $ mapper -> mapToAbstractEntity ( $ categories ) ; return $ categories ; }
return all association categories
24,618
public function findAssociationRepertoireByID ( $ id ) { $ repertoires = $ this -> findAssociationRepertoires ( ) -> getRepertoires ( ) ; $ repertoires -> rewind ( ) ; while ( $ repertoires -> valid ( ) ) { $ repertoire = $ repertoires -> current ( ) ; if ( $ repertoire -> getID ( ) == $ id ) { return $ repertoire ; } $ repertoires -> next ( ) ; } }
return a association repertoire
24,619
public function findAssociationRepertoires ( ) { $ xmlQuery = $ this -> metaApiService -> getAssociationRepertoires ( ) ; $ repertoires = new Repertoires ( ) ; $ mapper = new \ RGU \ Dvoconnector \ Mapper \ AssociationRepertoires ( $ xmlQuery ) ; $ mapper -> mapToAbstractEntity ( $ repertoires ) ; return $ repertoires ; }
return all association repertoires
24,620
public function findAssociationPerformancelevelByID ( $ id ) { $ performancelevels = $ this -> findAssociationPerformancelevels ( ) -> getPerformancelevels ( ) ; $ performancelevels -> rewind ( ) ; while ( $ performancelevels -> valid ( ) ) { $ performancelevel = $ performancelevels -> current ( ) ; if ( $ performancelevel -> getID ( ) == $ id ) { return $ performancelevel ; } $ performancelevels -> next ( ) ; } }
return a association performancelevel
24,621
public function findAssociationPerformancelevels ( ) { $ xmlQuery = $ this -> metaApiService -> getAssociationPerformancelevels ( ) ; $ performancelevels = new Performancelevels ( ) ; $ mapper = new \ RGU \ Dvoconnector \ Mapper \ AssociationPerformancelevels ( $ xmlQuery ) ; $ mapper -> mapToAbstractEntity ( $ performancelevels ) ; return $ performancelevels ; }
return all association performancelevels
24,622
public function findEventTypeByID ( $ id ) { $ eventTypes = $ this -> findEventTypes ( ) -> getTypes ( ) ; $ eventTypes -> rewind ( ) ; while ( $ eventTypes -> valid ( ) ) { $ eventType = $ eventTypes -> current ( ) ; if ( $ eventType -> getID ( ) == $ id ) { return $ eventType ; } $ eventTypes -> next ( ) ; } }
return a event type
24,623
public function findEventTypes ( ) { $ xmlQuery = $ this -> metaApiService -> getEventTypes ( ) ; $ types = new Types ( ) ; $ mapper = new \ RGU \ Dvoconnector \ Mapper \ EventTypes ( $ xmlQuery ) ; $ mapper -> mapToAbstractEntity ( $ types ) ; return $ types ; }
return all event types
24,624
protected function defaultConfigStrategy ( $ path , $ key ) { $ config = $ this -> app -> make ( 'config' ) -> get ( $ key , [ ] ) ; $ this -> app -> make ( 'config' ) -> set ( $ key , array_replace_recursive ( require $ path , $ config ) ) ; }
The default config merge function instead of using the laravel mergeConfigRom it .
24,625
protected function tryRegisterProviders ( $ on ) { if ( $ on === $ this -> registerProvidersOn && $ this -> registerProvidersMethod === self :: METHOD_REGISTER ) { foreach ( $ this -> providers as $ provider ) { $ this -> app -> register ( $ provider ) ; } foreach ( $ this -> deferredProviders as $ provider ) { $ this -> app -> registerDeferredProvider ( $ provider ) ; } } elseif ( $ this -> registerProvidersMethod === self :: METHOD_RESOLVE ) { foreach ( $ this -> providers as $ provider ) { $ resolved = $ this -> app -> resolveProviderClass ( $ registered [ ] = $ provider ) ; if ( $ on === self :: ON_REGISTER ) { $ resolved -> register ( ) ; } elseif ( $ on === self :: ON_BOOT ) { $ this -> app -> call ( [ $ provider , 'boot' ] ) ; } } } }
tryRegisterProviders method .
24,626
protected function routeMiddleware ( $ key , $ middleware = null , $ force = false ) { if ( $ this -> app -> runningInConsole ( ) && $ force === false ) { return $ this -> getRouter ( ) ; } if ( is_array ( $ key ) ) { foreach ( $ key as $ k => $ m ) { $ this -> routeMiddleware ( $ k , $ m ) ; } return $ this -> getRouter ( ) ; } else { $ this -> getRouter ( ) -> middleware ( $ key , $ middleware ) ; } }
Add a route middleware . Will not be added when running in console .
24,627
protected function getResolvedPaths ( ) { if ( null === $ this -> resolvedPaths ) { $ this -> resolveDirectories ( ) ; $ paths = [ ] ; collect ( array_keys ( get_class_vars ( get_class ( $ this ) ) ) ) -> filter ( function ( $ propertyName ) { return ends_with ( $ propertyName , 'Path' ) ; } ) -> each ( function ( $ propertyName ) use ( & $ paths ) { $ paths [ $ propertyName ] = $ this -> { $ propertyName } ; } ) ; $ this -> resolvedPaths = collect ( $ paths ) -> transform ( function ( $ path ) use ( $ paths ) { return Util :: template ( $ path , $ paths ) ; } ) -> transform ( function ( $ path , $ propertyName ) { return ends_with ( $ propertyName , 'DestinationPath' ) ? base_path ( $ path ) : path_join ( $ this -> rootDir , $ path ) ; } ) -> toArray ( ) ; } return $ this -> resolvedPaths ; }
resolvePaths method .
24,628
protected function findCommandsFiles ( $ directory ) { $ glob = glob ( $ directory . '/*' ) ; if ( $ glob === false ) { return [ ] ; } return array_filter ( $ glob , function ( $ file ) { return filetype ( $ file ) == 'file' ; } ) ; }
findCommandsFiles method .
24,629
public function isHandling ( $ level ) { $ min = $ this -> minimumLevel ; $ max = $ this -> maximumLevel ; $ lev = Logger :: $ levels [ $ level ] ; return ( $ min >= $ lev && $ lev >= $ max ) ; }
Checks if the log level is handled with this adaptor
24,630
public function setLevel ( $ min = null , $ max = null ) { if ( ! $ min || ! Logger :: isLogLevel ( $ min ) ) { $ min = LogLevel :: DEBUG ; } if ( ! $ max || ! Logger :: isLogLevel ( $ max ) ) { $ max = LogLevel :: EMERGENCY ; } $ this -> minimumLevel = Logger :: $ levels [ $ min ] ; $ this -> maximumLevel = Logger :: $ levels [ $ max ] ; }
Sets the minimum log level handled by this adaptor
24,631
public function findRelation ( $ entity , $ relationName , $ orderColumn = null , $ orderType = null ) { $ this -> load ( ) ; $ mapper = MapperBuilder :: buildFromClassName ( $ this -> mapping , get_class ( $ entity ) ) ; $ relation = $ mapper -> getRelation ( $ relationName ) ; $ relationMapper = MapperBuilder :: buildFromName ( $ this -> mapping , $ relation -> getEntity ( ) ) ; $ selectQuery = "SELECT tmain.* FROM `" . $ relationMapper -> getTable ( ) . "` tmain " ; $ joinQuery = QueryBuilder :: buildJoinRelationQuery ( $ relation , "tmain" , "j1" ) ; $ whereQuery = "WHERE j1." . $ relation -> getLocalColumn ( ) . " = '" . $ entity -> getId ( ) . "'" ; $ orderQuery = "" ; if ( ! is_null ( $ orderColumn ) ) { $ orderQuery .= "ORDER BY $orderColumn " ; if ( ! is_null ( $ orderType ) ) { $ orderQuery .= "$orderType" ; } else { $ orderQuery .= "ASC" ; } } $ query = $ selectQuery . $ joinQuery . $ whereQuery . $ orderQuery ; $ queryResult = $ this -> getDataSource ( ) -> query ( $ query ) ; if ( $ queryResult ) { $ collection = new Collection ( $ relationMapper -> getClass ( ) , $ queryResult , $ relationMapper ) ; } else { $ collection = new Collection ( $ relationMapper -> getClass ( ) , array ( ) , $ relationMapper ) ; } return $ collection ; }
Find by table relation .
24,632
public function findByGenericFilter ( $ name , $ filter = null , $ page = 1 , $ orderColumn = null , $ orderType = null ) { $ this -> load ( ) ; $ mapper = MapperBuilder :: buildFromName ( $ this -> mapping , $ name ) ; $ selectQuery = "" ; $ whereQuery = "" ; $ orderQuery = "" ; $ selectQuery .= "SELECT * FROM `" . $ mapper -> getTable ( ) . "` " ; $ filterList = array ( ) ; if ( ! is_null ( $ filter ) ) { $ filterList = explode ( " " , $ filter ) ; } if ( ! is_null ( $ filter ) ) { $ whereQuery .= " WHERE 1=2 " ; foreach ( $ filterList as $ searchedWord ) { foreach ( $ mapper -> getFilter ( "generic" ) -> getColumns ( ) as $ filteredColumn ) { $ whereQuery .= " OR $filteredColumn LIKE '%" . $ searchedWord . "%'" ; } } } else { $ whereQuery .= " WHERE 1 " ; } if ( ! is_null ( $ orderColumn ) ) { $ orderQuery .= "ORDER BY $orderColumn " ; if ( ! is_null ( $ orderType ) ) { $ orderQuery .= "$orderType" ; } else { $ orderQuery .= "ASC" ; } } $ from = ( $ page - 1 ) * $ mapper -> getFilter ( "generic" ) -> getItemsPerPage ( ) ; $ pageQuery = " LIMIT $from , " . $ mapper -> getFilter ( "generic" ) -> getItemsPerPage ( ) ; $ query = $ selectQuery . $ whereQuery . $ orderQuery . $ pageQuery ; $ result = $ this -> getDataSource ( ) -> query ( $ query ) ; if ( $ result ) { $ collection = new Collection ( $ mapper -> getClass ( ) , $ result , $ mapper ) ; } else { $ collection = new Collection ( $ mapper -> getClass ( ) , array ( ) , $ mapper ) ; } $ selectCountQuery = "SELECT count(*) as total FROM `" . $ mapper -> getTable ( ) . "` " ; $ query = $ selectCountQuery . $ whereQuery ; $ result = $ this -> getDataSource ( ) -> query ( $ query ) ; $ itemCount = $ result [ 0 ] [ "total" ] ; $ pager = new Pager ( $ collection , $ itemCount , $ mapper -> getFilter ( "generic" ) -> getItemsPerPage ( ) , $ page ) ; return $ pager ; }
Finds entitys by its generic filter defined in the configured mapping .
24,633
private function getTableNamePrefix ( $ className ) { $ name = ltrim ( $ className , '\\' ) ; foreach ( $ this -> namingMap as $ prefix => $ namespace ) { if ( strpos ( $ name , $ namespace ) === 0 ) { return $ prefix . '_' ; } } return '' ; }
Get prefix for table from naming map .
24,634
public function getFunctionBody ( ) { global $ page , $ paged ; wp_title ( '|' , true , 'right' ) ; bloginfo ( 'name' ) ; $ site_description = get_bloginfo ( 'description' , 'display' ) ; if ( $ site_description && ( is_home ( ) || is_front_page ( ) ) ) { echo " | " , $ site_description ; } if ( $ paged >= 2 || $ page >= 2 ) { echo ' | ' , sprintf ( __ ( 'Page %s' , 'twentyeleven' ) , max ( $ paged , $ page ) ) ; } }
The function that is executed when called in a template
24,635
public static function instance ( $ name = null ) { if ( $ name !== null ) { if ( ! array_key_exists ( $ name , static :: $ _instances ) ) { return false ; } return static :: $ _instances [ $ name ] ; } if ( static :: $ _instance === null ) { static :: $ _instance = static :: forge ( ) ; } return static :: $ _instance ; }
retrieve an existing pagination instance
24,636
public function render ( $ raw = false ) { if ( $ this -> config [ 'total_pages' ] == 1 ) { return $ raw ? array ( ) : '' ; } $ this -> raw_results = array ( ) ; $ html = str_replace ( '{pagination}' , $ this -> first ( ) . $ this -> previous ( ) . $ this -> pages_render ( ) . $ this -> next ( ) . $ this -> last ( ) , $ this -> template [ 'wrapper' ] ) ; return $ raw ? $ this -> raw_results : $ html ; }
Creates the pagination markup
24,637
public function pages_render ( ) { if ( $ this -> config [ 'total_pages' ] == 1 ) { return '' ; } $ html = '' ; $ start = $ this -> config [ 'calculated_page' ] - floor ( $ this -> config [ 'num_links' ] * $ this -> config [ 'link_offset' ] ) ; $ end = $ this -> config [ 'calculated_page' ] + floor ( $ this -> config [ 'num_links' ] * ( 1 - $ this -> config [ 'link_offset' ] ) ) ; if ( $ start < 1 ) { $ end -= $ start - 1 ; $ start = 1 ; } if ( $ end < $ this -> config [ 'calculated_page' ] ) { $ start ++ ; $ end ++ ; } if ( $ end > $ this -> config [ 'total_pages' ] ) { $ start = max ( 1 , $ start - $ end + $ this -> config [ 'total_pages' ] ) ; $ end = $ this -> config [ 'total_pages' ] ; } for ( $ i = intval ( $ start ) ; $ i <= intval ( $ end ) ; $ i ++ ) { if ( $ this -> config [ 'calculated_page' ] == $ i ) { $ html .= str_replace ( '{link}' , str_replace ( array ( '{uri}' , '{page}' ) , array ( '#' , $ i ) , $ this -> template [ 'active-link' ] ) , $ this -> template [ 'active' ] ) ; $ this -> raw_results [ ] = array ( 'uri' => '#' , 'title' => $ i , 'type' => 'active' ) ; } else { $ html .= str_replace ( '{link}' , str_replace ( array ( '{uri}' , '{page}' ) , array ( $ this -> _make_link ( $ i ) , $ i ) , $ this -> template [ 'regular-link' ] ) , $ this -> template [ 'regular' ] ) ; $ this -> raw_results [ ] = array ( 'uri' => $ this -> _make_link ( $ i ) , 'title' => $ i , 'type' => 'regular' ) ; } } return $ html ; }
generate the HTML for the page links only
24,638
public function previous ( $ marker = null ) { $ html = '' ; $ marker === null and $ marker = $ this -> template [ 'previous-marker' ] ; if ( $ this -> config [ 'total_pages' ] > 1 ) { if ( $ this -> config [ 'calculated_page' ] == 1 ) { $ html = str_replace ( '{link}' , str_replace ( array ( '{uri}' , '{page}' ) , array ( '#' , $ marker ) , $ this -> template [ 'previous-inactive-link' ] ) , $ this -> template [ 'previous-inactive' ] ) ; $ this -> raw_results [ 'previous' ] = array ( 'uri' => '#' , 'title' => $ marker , 'type' => 'previous-inactive' ) ; } else { $ previous_page = $ this -> config [ 'calculated_page' ] - 1 ; $ previous_page = ( $ previous_page == 1 ) ? '' : $ previous_page ; $ html = str_replace ( '{link}' , str_replace ( array ( '{uri}' , '{page}' ) , array ( $ this -> _make_link ( $ previous_page ) , $ marker ) , $ this -> template [ 'previous-link' ] ) , $ this -> template [ 'previous' ] ) ; $ this -> raw_results [ 'previous' ] = array ( 'uri' => $ this -> _make_link ( $ previous_page ) , 'title' => $ marker , 'type' => 'previous' ) ; } } return $ html ; }
Pagination Previous link
24,639
public function next ( $ marker = null ) { $ html = '' ; $ marker === null and $ marker = $ this -> template [ 'next-marker' ] ; if ( $ this -> config [ 'total_pages' ] > 1 ) { if ( $ this -> config [ 'calculated_page' ] == $ this -> config [ 'total_pages' ] ) { $ html = str_replace ( '{link}' , str_replace ( array ( '{uri}' , '{page}' ) , array ( '#' , $ marker ) , $ this -> template [ 'next-inactive-link' ] ) , $ this -> template [ 'next-inactive' ] ) ; $ this -> raw_results [ 'next' ] = array ( 'uri' => '#' , 'title' => $ marker , 'type' => 'next-inactive' ) ; } else { $ next_page = $ this -> config [ 'calculated_page' ] + 1 ; $ html = str_replace ( '{link}' , str_replace ( array ( '{uri}' , '{page}' ) , array ( $ this -> _make_link ( $ next_page ) , $ marker ) , $ this -> template [ 'next-link' ] ) , $ this -> template [ 'next' ] ) ; $ this -> raw_results [ 'next' ] = array ( 'uri' => $ this -> _make_link ( $ next_page ) , 'title' => $ marker , 'type' => 'next' ) ; } } return $ html ; }
Pagination Next link
24,640
public function last ( $ marker = null ) { $ html = '' ; $ marker === null and $ marker = $ this -> template [ 'last-marker' ] ; if ( $ this -> config [ 'show_last' ] ) { if ( $ this -> config [ 'total_pages' ] > 1 and $ this -> config [ 'calculated_page' ] != $ this -> config [ 'total_pages' ] ) { $ html = str_replace ( '{link}' , str_replace ( array ( '{uri}' , '{page}' ) , array ( $ this -> _make_link ( $ this -> config [ 'total_pages' ] ) , $ marker ) , $ this -> template [ 'last-link' ] ) , $ this -> template [ 'last' ] ) ; $ this -> raw_results [ 'last' ] = array ( 'uri' => $ this -> _make_link ( $ this -> config [ 'total_pages' ] ) , 'title' => $ marker , 'type' => 'last' ) ; } else { $ html = str_replace ( '{link}' , str_replace ( array ( '{uri}' , '{page}' ) , array ( '#' , $ marker ) , $ this -> template [ 'last-inactive-link' ] ) , $ this -> template [ 'last-inactive' ] ) ; $ this -> raw_results [ 'last' ] = array ( 'uri' => '#' , 'title' => $ marker , 'type' => 'last-inactive' ) ; } } return $ html ; }
Pagination Last link
24,641
protected function _recalculate ( ) { $ this -> config [ 'total_pages' ] = ( int ) ceil ( $ this -> config [ 'total_items' ] / $ this -> config [ 'per_page' ] ) ? : 1 ; if ( $ this -> config [ 'current_page' ] ) { $ this -> config [ 'calculated_page' ] = $ this -> config [ 'current_page' ] ; } else { if ( is_string ( $ this -> config [ 'uri_segment' ] ) ) { $ this -> config [ 'calculated_page' ] = \ Input :: get ( $ this -> config [ 'uri_segment' ] , 1 ) ; } else { $ this -> config [ 'calculated_page' ] = ( int ) \ Request :: main ( ) -> uri -> get_segment ( $ this -> config [ 'uri_segment' ] ) ; } } if ( $ this -> config [ 'calculated_page' ] > $ this -> config [ 'total_pages' ] ) { $ this -> config [ 'calculated_page' ] = $ this -> config [ 'total_pages' ] ; } elseif ( $ this -> config [ 'calculated_page' ] < 1 ) { $ this -> config [ 'calculated_page' ] = 1 ; } $ this -> config [ 'offset' ] = ( $ this -> config [ 'calculated_page' ] - 1 ) * $ this -> config [ 'per_page' ] ; }
Prepares vars for creating links
24,642
protected function _validate ( $ name , $ value ) { switch ( $ name ) { case 'offset' : case 'total_items' : if ( $ value != intval ( $ value ) ) { $ value = 0 ; } $ value = max ( 0 , $ value ) ; break ; case 'uri_segment' : if ( is_numeric ( $ value ) ) { if ( $ value != intval ( $ value ) ) { $ value = 1 ; } $ value = max ( 1 , $ value ) ; } break ; case 'current_page' : case 'per_page' : case 'limit' : case 'total_pages' : case 'num_links' : if ( $ value != intval ( $ value ) ) { $ value = 1 ; } $ value = max ( 1 , $ value ) ; break ; case 'show_first' : case 'show_last' : if ( ! is_bool ( $ value ) ) { $ value = ( bool ) $ value ; } break ; case 'link_offset' : if ( $ value > 1 ) { $ value = $ value / 100 ; } $ value = max ( 0.01 , min ( $ value , 0.99 ) ) ; break ; } return $ value ; }
Validate the input configuration
24,643
public function send ( PockpackQueue $ queue = null ) { if ( is_null ( $ queue ) ) { throw new NoPockpackQueueException ( ) ; } $ params = array ( 'actions' => json_encode ( $ queue -> getActions ( ) ) , 'consumer_key' => $ this -> consumer_key , 'access_token' => $ this -> access_token ) ; $ request = $ this -> getClient ( ) -> get ( '/v3/send' ) ; $ request -> getQuery ( ) -> merge ( $ params ) ; $ response = $ request -> send ( ) ; $ queue -> clear ( ) ; return json_decode ( $ response -> getBody ( ) ) ; }
Responsible for sending the request to the pocket API
24,644
public function retrieve ( $ options = array ( ) , $ isArray = false ) { $ params = array ( 'consumer_key' => $ this -> consumer_key , 'access_token' => $ this -> access_token ) ; $ params = array_merge ( $ params , $ options ) ; $ request = $ this -> getClient ( ) -> post ( '/v3/get' ) ; $ request -> getParams ( ) -> set ( 'redirect.strict' , true ) ; $ request -> setHeader ( 'Content-Type' , 'application/json; charset=UTF8' ) ; $ request -> setHeader ( 'X-Accept' , 'application/json' ) ; $ request -> setBody ( json_encode ( $ params ) ) ; $ response = $ request -> send ( ) ; return json_decode ( $ response -> getBody ( ) , $ isArray ) ; }
Retrieve the data from the pocket API
24,645
public function fetchTemplate ( $ template , $ data = array ( ) , $ outtemplate = null ) { if ( trim ( $ template ) == '' ) { throw new \ Exception ( 'No template to format email' ) ; } $ templatedata = $ this -> getTemplateData ( $ template ) ; if ( $ outtemplate === null ) { $ outtemplate = 'default' ; } if ( ! is_array ( $ templatedata ) ) { throw new \ Exception ( sprintf ( 'Email template %s not found' , $ template ) ) ; } if ( $ outtemplate != '' ) { $ outtemplate_real = $ this -> getOutTemplate ( $ outtemplate ) ; if ( ! $ outtemplate_real ) { throw new \ Exception ( sprintf ( 'Email template %s not found' , $ outtemplate ) ) ; } $ outtemplate = $ outtemplate_real ; } $ class = $ this -> templateprocessorclass ; $ templating = new $ class ( ) ; $ templating -> init ( $ this -> tepmlateprocessorinitoptions ) ; if ( is_object ( $ this -> options [ 'application' ] ) ) { $ templating -> setApplication ( $ this -> options [ 'application' ] ) ; } if ( ! $ templating -> checkTemplateExists ( $ templatedata [ 'file' ] ) ) { throw new \ Exception ( sprintf ( 'Email template %s not found' , $ template ) ) ; } $ templating -> setVars ( $ data ) ; $ subject = $ templating -> fetchString ( $ templatedata [ 'subject' ] ) ; $ templating -> setTemplate ( $ templatedata [ 'file' ] ) ; $ emailhtml = $ templating -> fetchTemplate ( ) ; if ( $ outtemplate != '' ) { $ templating -> setVar ( 'EMAILCONTENT' , $ emailhtml ) ; $ templating -> setTemplate ( $ outtemplate ) ; $ emailhtml = $ templating -> fetchTemplate ( ) ; } return array ( 'body' => $ emailhtml , 'subject' => $ subject ) ; }
Generate email body and subject based on templates and options
24,646
protected function getTemplateData ( $ template ) { if ( $ this -> locale != '' ) { $ tdata = $ this -> getTemplateDataForLocale ( $ template , $ this -> locale ) ; if ( is_array ( $ tdata ) ) { return $ tdata ; } } if ( $ this -> deflocale != '' ) { $ tdata = $ this -> getTemplateDataForLocale ( $ template , $ this -> deflocale ) ; if ( is_array ( $ tdata ) ) { return $ tdata ; } } $ tdata = $ this -> getTemplateDataForLocale ( $ template , '' ) ; return $ tdata ; }
Returns template data according to locale settings
24,647
protected function getTemplateDataForLocale ( $ template , $ locale ) { $ metafile = $ this -> templatespath . '/' . $ locale . '/subjects.xml' ; if ( ! file_exists ( $ metafile ) ) { return null ; } $ xml = @ file_get_contents ( $ metafile ) ; if ( ! $ xml || $ xml == '' ) { return null ; } $ array = \ LSS \ XML2Array :: createArray ( $ xml ) ; if ( ! isset ( $ array [ 'templates' ] [ $ template ] ) ) { return null ; } $ templatefile = $ this -> templatespath . '/' . $ locale . '/' . $ template . '.htm' ; if ( ! file_exists ( $ templatefile ) ) { return null ; } $ tmpl = ( $ locale != '' ) ? $ locale . '/' : '' ; $ tmpl .= $ template ; return array ( 'subject' => $ array [ 'templates' ] [ $ template ] [ 'subject' ] , 'file' => $ tmpl ) ; }
Get template information for specified locale
24,648
protected function getOutTemplate ( $ template = 'default' ) { if ( $ this -> locale != '' ) { $ templatefile = $ this -> templatespath . '/' . $ this -> locale . '/' . $ this -> outtemplateprefix . $ template . '.htm' ; if ( file_exists ( $ templatefile ) ) { return $ this -> locale . '/' . $ this -> outtemplateprefix . $ template ; } } if ( $ this -> deflocale != '' ) { $ templatefile = $ this -> templatespath . '/' . $ this -> deflocale . '/' . $ this -> outtemplateprefix . $ template . '.htm' ; if ( file_exists ( $ templatefile ) ) { return $ this -> deflocale . '/' . $ this -> outtemplateprefix . $ template ; } } $ templatefile = $ this -> templatespath . '/' . $ this -> outtemplateprefix . $ template . '.htm' ; if ( file_exists ( $ templatefile ) ) { return $ this -> outtemplateprefix . $ template ; } return null ; }
Return template file for out template
24,649
protected function view ( $ file , array $ params = [ ] ) : TwigRenderer { $ this -> eventHandler -> trigger ( BeforeLoadView :: class , [ 'file' => $ file , 'params' => $ params , ] ) ; $ renderer = $ this -> app -> make ( TwigRenderer :: class ) ; return $ renderer -> loadWithController ( $ this , $ file , $ params ) ; }
Loads the given view file with the given parameters .
24,650
protected function preOrder ( $ endpoint , $ payload ) : Collection { $ payload [ 'sign' ] = Support :: generateSign ( $ payload , $ this -> config -> get ( 'key' ) ) ; Log :: debug ( 'Pre Order:' , [ $ endpoint , $ payload ] ) ; return Support :: requestApi ( $ endpoint , $ payload , $ this -> config -> get ( 'key' ) ) ; }
Preorder an order .
24,651
public function & createOption ( $ text = '' , $ value = '' ) { $ option = $ this -> factory -> create ( 'Form\Checkbox' ) ; if ( $ text ) { $ option -> setInner ( $ text ) ; } if ( $ value ) { $ option -> setValue ( $ value ) ; } $ this -> controls [ ] = $ option ; return $ option ; }
Add an option to the optionslist and returns a reference to it .
24,652
public function limit ( $ new_limit ) { $ this -> limit = $ new_limit ; if ( false === starts_with ( $ new_limit . '' , ':' ) ) { $ this -> limit = ( int ) $ new_limit ; } }
For setting a limit on the query other than the default
24,653
public function offset ( $ offset ) { $ this -> offset = $ offset ; if ( false === starts_with ( $ offset . '' , ':' ) ) { $ this -> offset = ( int ) $ offset ; } }
For setting a offset on the query other than the default
24,654
public function bind_value ( string $ name , $ value , $ data_type = false ) { $ this -> values_to_bind [ $ name ] = array ( 'value' => $ value , 'data_type' => $ data_type , ) ; }
Adds a variable to be bound to in the prepared statement
24,655
public function get_sql ( ) : string { if ( empty ( $ this -> columns_to_select ) ) { $ this -> columns_to_select = [ '*' ] ; } $ from = ' FROM ' . implode ( ', ' , $ this -> from ) . ' ' ; if ( ! empty ( $ this -> joins ) ) { $ from .= $ this -> joins ; } $ from .= 'WHERE ' . $ this -> where_clause ; $ select = 'SELECT ' . implode ( ', ' , $ this -> columns_to_select ) . $ from ; if ( ! empty ( $ this -> group_by ) ) { $ select .= 'GROUP BY ' . implode ( ', ' , $ this -> group_by ) . ' ' ; } if ( $ this -> order_by !== '' ) { $ select .= 'ORDER BY ' . $ this -> order_by . ' ' ; } $ select .= 'LIMIT ' . $ this -> limit ; if ( $ this -> offset !== '' ) { $ select .= ' OFFSET ' . $ this -> offset ; } return $ select ; }
Uses the current state of the object to build the sql statement
24,656
public function supportsType ( Transaction \ TransactionType $ type = null ) { return in_array ( ( null === $ type ? null : $ type -> getValue ( ) ) , static :: $ supportedTypes ) ; }
Returns true if this Transactor supports a given Transaction type
24,657
public function supportsNetwork ( Transaction \ NetworkType $ network = null ) { return in_array ( ( null === $ network ? null : $ network -> getValue ( ) ) , static :: $ supportedNetworks ) ; }
Returns true if this Transactor supports a given Network type
24,658
public function cast ( $ array ) { if ( ! is_array ( $ array ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Expected an array, but got %s!' , gettype ( $ array ) ) ) ; } foreach ( $ array as $ key => $ value ) { $ mapKey = $ this -> mapKey ( $ key ) ; try { $ array [ $ key ] = $ this [ $ mapKey ] -> cast ( $ value ) ; } catch ( KeyNotFoundException $ knfex ) { } catch ( \ InvalidArgumentException $ iaex ) { throw new \ InvalidArgumentException ( sprintf ( 'Unexpected value for key %s: %s' , $ key , $ iaex -> getMessage ( ) ) , 0 , $ iaex ) ; } } return $ array ; }
Cast the values of the given array to the typecast information defined in this class .
24,659
public function getSchemaFile ( $ database ) { $ dir = $ this -> loader -> find ( $ this -> application -> config ( 'directory.database.schema' ) ) -> first ( ) ; return $ dir . DS . $ this -> schemaFileNameStrategy ( $ database ) ; }
get schema file
24,660
public function getSchemaYAMLFile ( $ database ) { $ dir = $ this -> loader -> find ( $ this -> application -> config ( 'directory.database.schema' ) ) -> first ( ) ; return $ dir . DS . $ this -> schemaYAMLFileNameStrategy ( $ database ) ; }
get schema yaml file
24,661
public function start ( ) { ConnectionManager :: getDataSource ( $ this -> _TaskServer -> useDbConfig ) -> reconnect ( array ( 'persistent' => false ) ) ; $ this -> _Shell -> out ( "Task #{$this->_task['id']} started" ) ; $ this -> _task [ 'started' ] = $ this -> _getCurrentDateTime ( ) ; $ this -> _task [ 'stderr' ] = '' ; $ this -> _task [ 'stdout' ] = '' ; $ this -> _TaskServer -> started ( $ this -> _task ) ; $ this -> _run ( ) ; return $ this -> _task ; }
Notify client about started task and run this task
24,662
protected function _stopped ( $ manual = false ) { $ this -> _task = array ( 'stdout' => $ this -> _Process -> getOutput ( ) , 'stderr' => $ this -> _Process -> getErrorOutput ( ) , 'stopped' => $ this -> _getCurrentDateTime ( ) , 'process_id' => 0 , ) + $ this -> _task ; $ this -> _TaskServer -> stopped ( $ this -> _task , $ manual ) ; $ this -> _Shell -> out ( "Task #{$this->_task['id']} stopped, code " . ( string ) $ this -> _task [ 'code' ] ) ; }
Notify client about stopped task
24,663
protected function _argsToString ( array $ arguments ) { $ stringArguments = '' ; foreach ( $ arguments as $ name => $ value ) { if ( is_numeric ( $ name ) ) { $ stringArguments .= ' ' . $ value ; } else { $ stringArguments .= ' ' . $ name . ' ' . ProcessUtils :: escapeArgument ( $ value ) ; } } return $ stringArguments ; }
Convert array of arguments into string
24,664
public function validate ( string $ password ) : bool { foreach ( $ this -> validators as $ validator ) { $ validator -> validate ( $ password ) ; } return true ; }
Validates the given password against the current rule set .
24,665
public function bind ( $ contract , $ class , $ args = [ ] ) { $ closure = function ( $ class , $ args ) { $ reflect = new \ ReflectionClass ( $ class ) ; return $ reflect -> newInstanceArgs ( $ args ) ; } ; $ this -> bindings [ $ contract ] = [ 'type' => 'closure' , 'closure' => $ closure , 'class' => $ class , 'args' => $ args ] ; if ( ! class_exists ( $ contract , false ) ) { eval ( "class {$contract} extends \Hades\Container\Facade {} " ) ; } }
the class will have new instance when use
24,666
public function singleton ( $ contract , $ class , $ args = [ ] ) { $ reflect = new \ ReflectionClass ( $ class ) ; $ instance = $ reflect -> newInstanceArgs ( $ args ) ; $ this -> bindings [ $ contract ] = [ 'type' => 'singleton' , 'instance' => $ instance , 'class' => $ class , 'args' => $ args ] ; if ( ! class_exists ( $ contract , false ) ) { eval ( "class {$contract} extends \Hades\Container\Facade {} " ) ; } }
the class will instance one time when use
24,667
public function make ( $ contract ) { if ( empty ( $ this -> bindings [ $ contract ] ) ) { throw new \ LogicException ( 'Not found contract:' . $ contract ) ; } $ class = $ this -> bindings [ $ contract ] ; if ( $ class [ 'type' ] == 'closure' ) { return call_user_func ( $ class [ 'closure' ] , $ class [ 'class' ] , $ class [ 'args' ] ) ; } else if ( $ class [ 'type' ] == 'singleton' ) { return $ class [ 'instance' ] ; } throw new \ LogicException ( 'Not found contract:' . $ contract ) ; }
make some contract
24,668
public static function orderBy ( ) : array { $ args = \ func_get_args ( ) ; $ data = array_shift ( $ args ) ; foreach ( $ args as $ n => $ field ) { if ( \ is_string ( $ field ) ) { $ tmp = [ ] ; foreach ( $ data as $ key => $ row ) { $ tmp [ $ key ] = $ row [ $ field ] ; } $ args [ $ n ] = $ tmp ; } } $ args [ ] = & $ data ; array_multisort ( $ args ) ; return array_pop ( $ args ) ; }
Order array by arguments
24,669
public static function equal ( array $ a , array $ b ) : bool { $ count_equal = ( \ count ( $ a ) === \ count ( $ b ) ) ; $ difference = ( array_diff ( $ a , $ b ) === array_diff ( $ b , $ a ) ) ; return ( $ count_equal && $ difference ) ; }
Check if two arrays is equal with same keys
24,670
public static function dirToArr ( $ path ) : array { $ result = [ ] ; $ dirContent = scandir ( $ path , null ) ; foreach ( $ dirContent as $ key => $ value ) { if ( ! \ in_array ( $ value , [ '.' , '..' ] ) ) { if ( is_dir ( $ path . DIRECTORY_SEPARATOR . $ value ) ) { $ result [ $ value ] = self :: dirToArr ( $ path . DIRECTORY_SEPARATOR . $ value ) ; } else { $ result [ ] = $ value ; } } } return $ result ; }
Read any files and folder into some directory
24,671
private static function searchMdObject ( $ multi , array $ target ) : array { return array_map ( function ( $ element ) use ( $ target ) { $ exist = true ; foreach ( $ target as $ skey => $ svalue ) { $ exist = $ exist && isset ( $ element -> $ skey ) && ( $ element -> $ skey === $ svalue ) ; } return $ exist ? $ element : null ; } , ( array ) $ multi ) ; }
Make search in MD object
24,672
public static function searchMd ( $ multi , $ target ) { if ( empty ( $ target ) || empty ( $ multi ) ) { return false ; } $ output = \ is_object ( $ multi ) ? self :: searchMdObject ( $ multi , $ target ) : self :: searchMdArray ( $ multi , $ target ) ; $ output = array_values ( array_filter ( $ output ) ) ; return ! empty ( $ output ) ? $ output : false ; }
Find nested array inside two - dimensional array
24,673
public function addDataStr ( $ p_params ) { try { if ( is_object ( $ p_params ) ) { if ( is_object ( $ p_params -> value ) ) { $ this -> object_retour -> strErreur = "The value is not a string." ; $ this -> object_retour -> statut = self :: STATE_ERROR ; die ( ) ; } if ( isset ( $ p_params -> label ) ) { $ this -> object_retour -> data [ $ p_params -> label ] = $ p_params -> value ; } else { $ this -> object_retour -> data = $ p_params -> value ; } } else { $ this -> object_retour -> data = $ p_params ; } } catch ( Exception $ ex ) { $ this -> dieInError ( $ ex . '' ) ; } }
Attetion not handle error from the OdaRetourSQL .
24,674
public function dieInError ( $ message , $ errorCode = self :: STATE_ERROR ) { $ this -> object_retour -> strErreur = $ message ; $ this -> object_retour -> statut = $ errorCode ; die ( ) ; }
To die an interface
24,675
public static function Gmst06 ( $ uta , $ utb , $ tta , $ ttb ) { $ t ; $ gmst ; $ t = ( ( $ tta - DJ00 ) + $ ttb ) / DJC ; $ gmst = IAU :: Anp ( IAU :: Era00 ( $ uta , $ utb ) + ( 0.014506 + ( 4612.156534 + ( 1.3915817 + ( - 0.00000044 + ( - 0.000029956 + ( - 0.0000000368 ) * $ t ) * $ t ) * $ t ) * $ t ) * $ t ) * DAS2R ) ; return $ gmst ; }
- - - - - - - - - - i a u G m s t 0 6 - - - - - - - - - -
24,676
public function withStatus ( $ message , $ type = 'success' ) { $ status = [ 'message' => $ message , 'type' => $ type , ] ; $ this -> with ( 'status' , $ status ) ; return $ this ; }
Flash a container of status to the session .
24,677
public function create ( $ sha , $ message , BranchInterface $ branch , $ author , $ url ) { $ commit = new $ this -> className ( ) ; return $ commit -> setSHA ( $ sha ) -> setMessage ( $ message ) -> setBranch ( $ branch ) -> setAuthor ( $ author ) -> setUrl ( $ url ) ; }
Creates a Commit object with the given response by the VCS provider .
24,678
public function toPrimitive ( ) { if ( empty ( $ this -> args ) ) { throw new \ InvalidArgumentException ( "Args shouldn't be empty" ) ; } $ values = array_keys ( $ this -> args ) ; return implode ( $ this -> glue , $ values ) ; }
Return a primitive value for this object .
24,679
public function import ( $ alias , $ forceInclude = false ) { if ( ( $ baseAlias = $ this -> getAlias ( ) ) !== null ) { $ alias = $ baseAlias . '.' . $ alias ; } return Yii :: import ( $ alias , $ forceInclude ) ; }
Imports the a class or directory . The path alias is automatically prepended if applicable .
24,680
public function getDbConnection ( ) { if ( ! Yii :: app ( ) -> hasComponent ( $ this -> connectionID ) ) { throw new CException ( sprintf ( 'Connection component "%s" does not exist.' , $ this -> connectionID ) ) ; } $ db = Yii :: app ( ) -> getComponent ( $ this -> connectionID ) ; if ( ! $ db instanceof CDbConnection ) { throw new CException ( sprintf ( 'Connection component "%s" is not an instance of CDbConnection.' , $ this -> connectionID ) ) ; } return $ db ; }
Returns the database connection for this component .
24,681
public function publishAssets ( $ path , $ forceCopy = false ) { if ( ! Yii :: app ( ) -> hasComponent ( 'assetManager' ) ) { return false ; } $ assetManager = Yii :: app ( ) -> getComponent ( 'assetManager' ) ; if ( ( $ basePath = $ this -> getPath ( ) ) !== false ) { $ path = $ basePath . DIRECTORY_SEPARATOR . $ path ; } $ assetsUrl = $ assetManager -> publish ( $ path , false , - 1 , $ forceCopy ) ; return $ this -> _assetsUrl = $ assetsUrl ; }
Publishes the extension assets .
24,682
public function registerScriptFile ( $ url , $ position = null ) { if ( ( $ cs = $ this -> getClientScript ( ) ) === false ) { return null ; } if ( isset ( $ this -> _assetsUrl ) ) { $ url = $ this -> _assetsUrl . '/' . ltrim ( $ url , '/' ) ; } return $ cs -> registerScriptFile ( $ url , $ position ) ; }
Registers a JavaScript file .
24,683
public function build ( ) { $ event = new AdminMenuEvent ( ) ; $ this -> eventDispatcher -> dispatch ( Admin :: MENU , $ event ) ; return $ event -> getItems ( ) ; }
Build admin menu .
24,684
protected function replaceRoutableParameters ( $ parameters = array ( ) ) { $ parameters = is_array ( $ parameters ) ? $ parameters : array ( $ parameters ) ; foreach ( $ parameters as $ key => $ parameter ) { if ( $ parameter instanceof UrlRoutable ) { $ parameters [ $ key ] = $ parameter -> getRouteKey ( ) ; } } return $ parameters ; }
Replace UrlRoutable parameters with their route parameter .
24,685
public function getName ( ) { $ name = null ; if ( isset ( $ this -> response [ 'data' ] [ 'attributes' ] [ 'first_name' ] ) ) { $ name = $ this -> response [ 'data' ] [ 'attributes' ] [ 'first_name' ] . ' ' . $ this -> response [ 'data' ] [ 'attributes' ] [ 'last_name' ] ; } return $ name ; }
Get resource owner name
24,686
public function triggerBeforeSelect ( Select $ query , EntityDescriptorInterface $ entityDescriptor ) { $ event = new \ Slick \ Orm \ Event \ Select ( null , [ 'query' => $ query , 'entityDescriptor' => $ entityDescriptor ] ) ; $ event -> setAction ( \ Slick \ Orm \ Event \ Select :: ACTION_BEFORE_SELECT ) ; return Orm :: getEmitter ( $ this -> getEntityClassName ( ) ) -> emit ( $ event ) ; }
Emit before select event
24,687
public function triggerAfterSelect ( $ data , EntityCollection $ entities ) { $ event = new \ Slick \ Orm \ Event \ Select ( null , [ 'data' => $ data , 'entityCollection' => $ entities ] ) ; $ event -> setAction ( \ Slick \ Orm \ Event \ Select :: ACTION_AFTER_SELECT ) ; return Orm :: getEmitter ( $ this -> getEntityClassName ( ) ) -> emit ( $ event ) ; }
Emits the after select event
24,688
public function getConsole ( ) { if ( ! ( $ this -> console instanceof AdapterInterface ) ) { $ this -> console = Console :: getInstance ( ) ; } return $ this -> console ; }
Instantiate console if no is set
24,689
protected function showError ( $ title , $ messages = '' , $ output ) { $ output -> writeln ( "<error>$title</error>" ) ; $ output -> writeln ( '' ) ; if ( is_array ( $ messages ) ) { foreach ( $ messages as $ message ) { $ output -> writeln ( "<comment>$message</comment>" ) ; } $ output -> writeln ( '' ) ; } elseif ( $ messages != '' ) { $ output -> writeln ( "<comment>$messages</comment>" ) ; $ output -> writeln ( '' ) ; } }
Print error message with proper format .
24,690
protected function showSuccess ( $ title , $ messages = '' , $ output ) { $ output -> writeln ( "<info>$title</info>" ) ; $ output -> writeln ( '' ) ; if ( is_array ( $ messages ) ) { foreach ( $ messages as $ message ) { $ output -> writeln ( "$message" ) ; } $ output -> writeln ( '' ) ; } elseif ( $ messages != '' ) { $ output -> writeln ( $ messages ) ; $ output -> writeln ( '' ) ; } }
Print success message .
24,691
public function header ( string $ name , $ value ) : HttpRequest { if ( ! array_key_exists ( $ name , $ this -> headers ) ) { $ this -> headers [ $ name ] = array ( ) ; } $ this -> headers [ $ name ] [ ] = $ value ; return $ this ; }
Adds a header to the request
24,692
public function headers ( array $ headers ) : HttpRequest { foreach ( $ headers as $ name => $ value ) { $ this -> header ( $ name , $ value ) ; } return $ this ; }
Adds an array of headers to the HttpRequest
24,693
public function contentType ( string $ contentType ) : HttpRequest { $ contentType = trim ( $ contentType ) ; if ( stripos ( $ contentType , "multipart/" ) !== false ) { if ( stripos ( $ contentType , "boundary" ) === false ) { $ contentType .= "; boundary=\"" . uniqid ( time ( ) ) . "\"" ; $ contentType = preg_replace ( '/(.)(;{2,})/' , '$1;' , $ contentType ) ; } } return $ this -> header ( "Content-Type" , $ contentType ) ; }
Sets the Content - Type header of the HttpRequest
24,694
public function accept ( string $ contentType ) : HttpRequest { $ contentType = trim ( $ contentType ) ; return $ this -> header ( "Accept" , $ contentType ) ; }
Sets the Accept header of the HttpRequest
24,695
public function authorization ( string $ scheme , string $ value ) : HttpRequest { if ( empty ( $ scheme ) ) { throw new \ InvalidArgumentException ( "Scheme was null or empty" ) ; } if ( empty ( $ value ) ) { throw new \ InvalidArgumentException ( "Value was null or empty" ) ; } return $ this -> header ( "Authorization" , $ scheme . " " . $ value ) ; }
Sets the Authorization header of the HttpRequest
24,696
public function parameter ( string $ name , $ value ) : HttpRequest { $ this -> parameters [ $ name ] = $ value ; return $ this ; }
Adds a query parameter to the HttpRequest .
24,697
public function parameters ( array $ parameters ) : HttpRequest { foreach ( $ parameters as $ name => $ value ) { $ this -> parameter ( $ name , $ value ) ; } return $ this ; }
Adds an array of query parameters to the HttpRequest
24,698
public function cookie ( string $ name , $ value ) : HttpRequest { if ( $ name != 'Array' ) { $ this -> cookies [ $ name ] = $ value ; } return $ this ; }
Adds a cookie to the HttpRequest
24,699
public function basicAuthentication ( string $ username , string $ password = "" ) : HttpRequest { $ this -> username = $ username ; $ this -> password = $ password ; return $ this ; }
Sets the basic authentication to use on the HttpRequest