idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
5,700
public function getItemListAvailable ( ) { $ valid_items = [ ] ; foreach ( $ this -> items as $ item ) { if ( $ item -> havePermission ( ) ) { $ valid_items [ ] = $ item ; } } return $ valid_items ; }
Obtain the menu items that the current user can access
5,701
public function exclude ( $ fieldName = null ) { if ( ! isset ( $ this -> query [ 'select' ] ) ) { $ this -> query [ 'select' ] = array ( ) ; } $ fieldNames = is_array ( $ fieldName ) ? $ fieldName : func_get_args ( ) ; foreach ( $ fieldNames as $ fieldName ) { $ this -> query [ 'select' ] [ $ fieldName ] = 0 ; } retur...
Set one or more fields to be excluded from the query projection .
5,702
public function geoNear ( $ x , $ y = null ) { if ( $ x instanceof Point ) { $ x = $ x -> jsonSerialize ( ) ; } $ this -> query [ 'type' ] = Query :: TYPE_GEO_NEAR ; $ this -> query [ 'geoNear' ] = array ( 'near' => is_array ( $ x ) ? $ x : array ( $ x , $ y ) , 'options' => array ( 'spherical' => is_array ( $ x ) && i...
Change the query type to a geoNear command .
5,703
public function getQuery ( array $ options = array ( ) ) { $ query = $ this -> query ; $ query [ 'query' ] = $ this -> expr -> getQuery ( ) ; $ query [ 'newObj' ] = $ this -> expr -> getNewObj ( ) ; return new Query ( $ this -> collection , $ query , $ options ) ; }
Create a new Query instance from the Builder state .
5,704
public function getValue ( $ key ) { if ( ! array_key_exists ( $ key , $ this -> values ) ) { throw new DbManagementException ( DbManagementException :: UNEXISTING_KEY ) ; } return $ this -> values [ $ val ] ; }
getter of a value corresponding to a key .
5,705
public function Edit ( $ RouteIndex = FALSE ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> AddSideMenu ( 'dashboard/routes' ) ; $ this -> Route = Gdn :: Router ( ) -> GetRoute ( $ RouteIndex ) ; $ Validation = new Gdn_Validation ( ) ; $ ConfigurationModel = new Gdn_ConfigurationModel ( $ Validation )...
Edit a route .
5,706
public function Delete ( $ RouteIndex = FALSE , $ TransientKey = FALSE ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> DeliveryType ( DELIVERY_TYPE_BOOL ) ; $ Session = Gdn :: Session ( ) ; if ( $ TransientKey !== FALSE && $ Session -> ValidateTransientKey ( $ TransientKey ) ) Gdn :: Router ( ) -> Del...
Remove a route .
5,707
public function Index ( ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> AddSideMenu ( 'dashboard/routes' ) ; $ this -> AddJsFile ( 'routes.js' ) ; $ this -> Title ( T ( 'Routes' ) ) ; $ this -> MyRoutes = Gdn :: Router ( ) -> Routes ; $ this -> Render ( ) ; }
Show list of current routes .
5,708
public function indexAction ( Request $ request ) { if ( ! $ this -> isInstalled ( ) ) { return new RedirectResponse ( $ request -> getUri ( ) . 'install.html' ) ; } return new Response ( str_replace ( 'var TENSIDEApi=window.location.href.split(\'#\')[0];' , 'var TENSIDEApi=\'' . $ request -> getSchemeAndHttpHost ( ) ....
Provide the index . html file .
5,709
public function assetAction ( $ path , $ file , Request $ request ) { $ filePath = $ this -> getAssetsDir ( ) . '/' . $ path . '/' . $ file ; if ( ! file_exists ( $ filePath ) ) { return new Response ( $ filePath . ' not found' , 404 ) ; } $ response = new Response ( ) ; $ response -> setPublic ( ) ; $ response -> head...
Provide an asset .
5,710
private function getMime ( $ filePath ) { $ chunks = explode ( '.' , $ filePath ) ; if ( count ( $ chunks ) > 1 ) { $ fileExtension = array_pop ( $ chunks ) ; foreach ( [ 'js' => 'text/javascript; charset=UTF-8' , 'map' => 'application/json' , 'css' => 'text/css; charset=UTF-8' , 'png' => 'image/png' , 'svg' => 'image/...
Retrieve the mime type of a file .
5,711
private function getAssetsDir ( ) { if ( $ phar = \ Phar :: running ( ) ) { return $ phar . '/assets' ; } $ dir = dirname ( __DIR__ ) ; while ( ( $ dir = dirname ( $ dir ) ) !== '.' ) { if ( is_dir ( $ dir . '/.build' ) ) { return $ dir . '/.build' ; } } throw new \ RuntimeException ( 'Could not find assets directory.'...
Retrieve the assets dir .
5,712
public static function constants ( ) { $ class = get_called_class ( ) ; if ( ! isset ( self :: $ __constants [ $ class ] ) ) { $ reflection = new ReflectionClass ( $ class ) ; self :: $ __constants [ $ class ] = array_change_key_case ( $ reflection -> getConstants ( ) , CASE_UPPER ) ; } return self :: $ __constants [ $...
Returns an array of the class constants
5,713
public static function constant ( $ name ) { $ name = strtoupper ( $ name ) ; $ value = null ; $ constants = self :: constants ( ) ; if ( isset ( $ constants [ $ name ] ) ) { $ value = $ constants [ $ name ] ; } else { throw new \ Headzoo \ Core \ Exceptions \ UndefinedConstantException ( "Undefined constant {$name}." ...
Returns the value of a specific class constant
5,714
public function SaveStep ( $ Step ) { if ( Gdn :: Config ( $ Step , '' ) != '1' ) SaveToConfig ( $ Step , '1' ) ; if ( Gdn :: Config ( 'Plugins.GettingStarted.Registration' , '0' ) == '1' && Gdn :: Config ( 'Plugins.GettingStarted.Plugins' , '0' ) == '1' && Gdn :: Config ( 'Plugins.GettingStarted.Categories' , '0' ) ==...
1 . If the user edits the registration settings
5,715
public function updateInstallments ( $ recurrentId , $ installments ) { $ uri = Braspag :: $ apiBase . "RecurrentPayment/$recurrentId/Installments" ; $ response = Request :: put ( $ uri ) -> addHeaders ( $ this -> headers ) -> addHeader ( "content-type" , "text/json" ) -> body ( $ installments ) -> send ( ) ; if ( $ re...
Updates the number of installments of one recurrent payment
5,716
public function logFeature ( string $ class , string $ method , array $ args ) : void { if ( ! isset ( $ this -> logged [ $ class ] ) ) { $ this -> logged [ $ class ] = [ ] ; } if ( ! isset ( $ this -> logged [ $ class ] [ $ method ] ) ) { $ this -> logged [ $ class ] [ $ method ] = [ ] ; } if ( ! in_array ( $ args , $...
Log a feature .
5,717
public function titlePad ( ) { $ out = '' ; if ( $ this -> _title === false ) { return $ out ; } $ out .= '<div class="titlepad">' ; $ out .= $ this -> _pageTitle ( $ this -> _title , $ this -> _subTitle ) ; if ( ! empty ( $ this -> _actions ) ) { $ out .= '<ul class="titlepad-actions">' ; foreach ( $ this -> _actions ...
Render the title pad including primary and secondary title as well as all added actions .
5,718
public function confirmationLink ( $ title , $ options ) { if ( ! isset ( $ options [ 'confirm-message' ] ) ) { user_error ( '\'confirm-message\' option is not set on protectedConfirmationLink.' ) ; $ options [ 'confirm-message' ] = '' ; } if ( ! isset ( $ options [ 'confirm-title' ] ) ) { user_error ( '\'confirm-title...
Create a confirmation link .
5,719
public function addConnection ( Array $ config , $ name = 'default' ) { $ connectors = array ( 'mysql' => 'Mysql' , 'pgsql' => 'Postgres' , 'sqlite' => 'SQLite' ) ; if ( ! isset ( $ config [ 'driver' ] ) || ! array_key_exists ( $ config [ 'driver' ] , $ connectors ) ) { throw new \ OtherCode \ Database \ Exceptions \ C...
Create a new PDO connection
5,720
public function getConnection ( $ name = 'default' ) { if ( array_key_exists ( $ name , $ this -> connections ) ) { return $ this -> connections [ $ name ] ; } return null ; }
Return a connection
5,721
public function getQuery ( $ new = false ) { if ( $ this -> query !== null && ! $ new ) { return $ this -> query ; } return new \ OtherCode \ Database \ Query \ Query ( ) ; }
Return a new Query instance
5,722
public function setQuery ( $ query ) { if ( is_string ( $ query ) || $ query instanceof \ OtherCode \ Database \ Query \ Query ) { $ this -> query = $ query ; } return $ this ; }
Set and execute a query
5,723
public function on ( $ connection ) { if ( array_key_exists ( $ connection , $ this -> connections ) ) { $ this -> defaultConnection = $ connection ; } return $ this ; }
Set the new default connection
5,724
public function execute ( $ params = null ) { $ sql = $ this -> query instanceof \ OtherCode \ Database \ Query \ Query ? $ this -> query -> compile ( ) : $ this -> query ; try { $ this -> stmt = $ this -> connections [ $ this -> defaultConnection ] -> prepare ( $ sql ) ; $ this -> stmt -> execute ( $ params ) ; } catc...
Execute the current query
5,725
public function loadResult ( $ index = 0 ) { if ( $ this -> stmt === null ) { return null ; } $ singleResult = $ this -> stmt -> fetch ( \ PDO :: FETCH_NUM ) ; return $ singleResult [ $ index ] ; }
Return a single filed .
5,726
public function loadColumn ( $ index = 0 ) { if ( $ this -> stmt === null ) { return null ; } $ columnList = array ( ) ; while ( $ row = $ this -> stmt -> fetch ( \ PDO :: FETCH_NUM ) ) { $ columnList [ ] = $ row [ $ index ] ; } return $ columnList ; }
Return a single column
5,727
public function loadObject ( $ class_name = "stdClass" ) { if ( $ this -> stmt === null ) { return null ; } return $ this -> stmt -> fetchObject ( $ class_name ) ; }
Return the query result in object format
5,728
public function loadObjectList ( $ class_name = "stdClass" ) { if ( $ this -> stmt === null ) { return null ; } $ objectList = array ( ) ; while ( $ object = $ this -> stmt -> fetchObject ( $ class_name ) ) { $ objectList [ ] = $ object ; } return $ objectList ; }
Return the query result in objects list format
5,729
public function loadAssocRow ( ) { if ( $ this -> stmt === null ) { return null ; } return $ this -> stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ; }
Return a single record as associative array
5,730
public function loadAssocList ( ) { if ( $ this -> stmt === null ) { return null ; } $ assocList = array ( ) ; while ( $ row = $ this -> stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ) { $ assocList [ ] = $ row ; } return $ assocList ; }
Return a list of associative arrays
5,731
public function loadIndexedRow ( ) { if ( $ this -> stmt === null ) { return null ; } return $ this -> stmt -> fetch ( \ PDO :: FETCH_NUM ) ; }
Returna single record as indexed array
5,732
public function loadIndexedList ( ) { if ( $ this -> stmt === null ) { return null ; } $ indexedList = array ( ) ; while ( $ row = $ this -> stmt -> fetch ( \ PDO :: FETCH_NUM ) ) { $ indexedList [ ] = $ row ; } return $ indexedList ; }
Return a list of indexed arrays
5,733
public static function token ( $ prefix = '' ) : string { $ token = sha1 ( uniqid ( $ prefix , true ) . mt_rand ( ) ) ; return $ token ; }
Generate a random 40 character hex token
5,734
public function destroyClientSessionsOnRenewId ( JoinPointInterface $ joinPoint ) { $ session = $ joinPoint -> getProxy ( ) ; $ this -> singleSignOnSessionManager -> destroyRegisteredSsoClientSessions ( $ session ) ; }
Destroys client sessions if the server session gets a new id
5,735
public function getCompiledPath ( $ templatePath , $ options = [ ] ) { $ viewsDir = $ this -> getViewsDir ( ) ; if ( ! isset ( $ options [ 'path' ] ) ) { $ options [ 'path' ] = $ viewsDir ; } $ relativeViewFile = trim ( str_replace ( $ viewsDir , '' , $ templatePath ) , DIRECTORY_SEPARATOR ) ; if ( ! isset ( $ options ...
Set complied path base on template path and config options
5,736
private function setVoltEngine ( array $ options = [ ] ) { $ di = $ this -> getDI ( ) ; $ result = [ ] ; if ( ! isset ( $ options [ 'path' ] ) ) { $ options [ 'path' ] = $ this -> getViewsDir ( ) ; } $ result [ 'compiledPath' ] = function ( $ templatePath ) use ( $ options ) { return $ this -> getCompiledPath ( $ templ...
Set volt engine with options
5,737
public function getRequest ( RequestInterface $ request ) { $ requestStr = $ this -> parser -> getRequestAsString ( $ request ) ; $ endpoint = ( string ) $ request -> getUri ( ) ; $ method = $ request -> getMethod ( ) ; return [ 'request' => $ requestStr , 'endpoint' => $ endpoint , 'method' => $ method , ] ; }
Format request .
5,738
public function getResponse ( MessageInterface $ response ) { $ result = [ ] ; if ( null !== $ response ) { $ responseStr = $ this -> parser -> getBodyWithHeaders ( $ response ) ; $ result = [ 'response' => $ responseStr ] ; } return $ result ; }
Format response .
5,739
public function natural ( TableInterface $ table , $ way = null ) { $ this -> joinArray [ 'way' ] = $ this -> _validateNaturalWayArgument ( $ way ) ; $ this -> joinArray [ 'tables' ] = array ( $ table ) ; $ this -> joinArray [ 'conditionType' ] = 'natural' ; return $ this ; }
Use a natural join .
5,740
private function _setWayValue ( $ way , TableInterface $ table , array $ optionalTables = array ( ) ) { $ this -> joinArray [ 'way' ] = $ way ; $ this -> joinArray [ 'tables' ] = array ( $ table ) ; foreach ( $ optionalTables as $ arg ) { if ( ! $ arg instanceof TableInterface ) { throw new \ InvalidArgumentException (...
Set the join array value with key way and tables . Throw an exception if not each element of args is of type table interface .
5,741
private function _validateOnArguments ( ColumnInterface $ firstColumn , ColumnInterface $ secondColumn ) { $ initialJoinArray = array ( 'way' => null , 'tables' => null , 'conditionType' => null , 'condition' => null ) ; if ( $ this -> joinArray === $ initialJoinArray ) { throw new \ Exception ( 'method to set join way...
Check the passed arguments and throw an exception if necessary .
5,742
private function _validateNaturalWayArgument ( $ way ) { if ( ! $ way ) { return null ; } if ( $ way !== 'inner' && $ way !== 'left' && $ way !== 'leftOuter' && $ way !== 'right' && $ way !== 'rightOuter' ) { throw new \ UnexpectedValueException ( 'the way argument has to be type of inner, left[Outer], right[Outer]' ) ...
Validate the way argument of the natural method . If the passed value is not equal to inner left leftOuter right rightOuter an exception will thrown .
5,743
public function indexAction ( ) { $ query = ( string ) $ this -> params ( ) -> fromQuery ( 'query' , null ) ; $ query = strlen ( $ query ) > 0 ? $ query : null ; $ orderBy = ( string ) $ this -> params ( ) -> fromQuery ( 'orderBy' , null ) ; $ orderBy = strlen ( $ orderBy ) > 0 ? $ orderBy : null ; $ sort = ( string ) ...
Index action for viewing a pagination list
5,744
public function listAction ( ) { $ page = ( int ) $ this -> params ( ) -> fromRoute ( 'page' , 1 ) ; return $ this -> forward ( ) -> dispatch ( $ this -> getRouteIdentifierPrefix ( ) , array ( 'action' => 'index' , 'page' => $ page ) ) ; }
List action for viewing a pagination list
5,745
public function addAction ( ) { $ request = $ this -> getRequest ( ) ; $ service = $ this -> getService ( ) ; $ form = $ this -> getAddForm ( ) ; if ( $ request -> getQuery ( ) -> get ( 'redirect' ) ) { $ redirect = $ request -> getQuery ( ) -> get ( 'redirect' ) ; } else { $ redirect = false ; } $ redirectUrl = $ this...
Add action for adding a new entity
5,746
public function editAction ( ) { $ id = ( int ) $ this -> params ( ) -> fromRoute ( 'id' , null ) ; $ request = $ this -> getRequest ( ) ; $ service = $ this -> getService ( ) ; $ entity = $ service -> getById ( $ id ) ; $ form = $ this -> getEditForm ( ) ; $ form -> bind ( $ entity ) ; if ( $ request -> getQuery ( ) -...
Edit action for editing an entity
5,747
public function deleteAction ( ) { $ id = ( int ) $ this -> params ( ) -> fromRoute ( 'id' , null ) ; $ request = $ this -> getRequest ( ) ; if ( $ request -> isPost ( ) ) { $ confirmed = $ request -> getPost ( 'confirmed' , false ) ; if ( $ confirmed ) { $ id = ( int ) $ request -> getPost ( 'id' ) ; $ this -> getServ...
Delete action for deleting an entity
5,748
public function getPostLogin ( ) { $ title = "Login" ; $ view = $ this -> di -> get ( "view" ) ; $ pageRender = $ this -> di -> get ( "pageRender" ) ; $ form = new LoginForm ( $ this -> di ) ; $ form -> check ( ) ; $ data = [ "form" => $ form -> getHTML ( ) , ] ; $ view -> add ( "user/login" , $ data ) ; $ pageRender -...
Handler with form to login user
5,749
public function getPostRegister ( ) { $ title = "Registrera" ; $ view = $ this -> di -> get ( "view" ) ; $ pageRender = $ this -> di -> get ( "pageRender" ) ; $ form = new RegisterForm ( $ this -> di ) ; $ form -> check ( ) ; $ data = [ "form" => $ form -> getHTML ( ) , ] ; $ view -> add ( "user/register" , $ data ) ; ...
Handler with form to register new user
5,750
public function getProfile ( $ id ) { $ title = "Profil" ; $ view = $ this -> di -> get ( "view" ) ; $ pageRender = $ this -> di -> get ( "pageRender" ) ; $ user = new User ( ) ; $ user -> setDb ( $ this -> di -> get ( "db" ) ) ; $ user -> find ( "id" , $ id ) ; $ data = [ "user" => $ user ] ; $ view -> add ( "user/pro...
Handle user profile page
5,751
private function validateEquals ( ) : bool { $ isValid = \ mb_strlen ( ( string ) $ this -> value , 'UTF-8' ) == $ this -> options [ 'length' ] ? true : false ; if ( ! $ isValid ) { $ this -> setError ( self :: VALIDATOR_ERROR_STRING_LENGTH_NOT_MATCH ) ; } return $ isValid ; }
Checks whether string length is equal to specified number
5,752
private function validateGreaterThan ( ) : bool { if ( $ this -> options [ 'inclusive' ] === true ) { $ isValid = \ mb_strlen ( $ this -> value , 'UTF-8' ) >= $ this -> options [ 'length' ] ? true : false ; if ( ! $ isValid ) { $ this -> setError ( self :: VALIDATOR_ERROR_STRING_LENGTH_MUST_BE_HIGHER_OR_EQUAL_TO_MIN ) ...
Checks whether string length is greater than specified number
5,753
private function validateLowerThan ( ) : bool { if ( $ this -> options [ 'inclusive' ] === true ) { $ isValid = \ mb_strlen ( $ this -> value , 'UTF-8' ) <= $ this -> options [ 'length' ] ? true : false ; if ( ! $ isValid ) { $ this -> setError ( self :: VALIDATOR_ERROR_STRING_LENGTH_MUST_BE_LOWER_OR_EQUAL_TO_MAX ) ; }...
Checks whether string length is lower than specified number
5,754
public function setInstructions ( $ instructions ) { if ( ! is_null ( $ this -> _instructions ) ) { throw new Exception ( 'Instructions for browser responses can only be set once.' ) ; } $ this -> _instructions = array_merge ( $ this -> _baseInstructions , $ instructions ) ; if ( isset ( $ this -> _instructions [ 'id' ...
Set instructions .
5,755
public function getTotal ( ) { if ( is_null ( $ this -> _total ) ) { if ( ( $ total = $ this -> predictTotal ( ) ) ) { $ this -> _total = $ total ; } elseif ( isset ( $ this -> _items ) ) { return count ( $ this -> _items ) ; } else { $ this -> _total = false ; } } return $ this -> _total ; }
Get total .
5,756
public function getHandler ( ) { $ handlers = $ this -> handlers ; if ( isset ( $ this -> instructions [ 'handler' ] ) && isset ( $ handlers [ $ this -> instructions [ 'handler' ] ] ) ) { return Yii :: createObject ( [ 'class' => $ handlers [ $ this -> instructions [ 'handler' ] ] , 'bundle' => $ this , ] ) ; } return ...
Get handler .
5,757
public static function match ( $ userAgent , $ server ) { if ( isset ( $ server [ 'all_http' ] ) ) { if ( strpos ( strtolower ( str_replace ( ' ' , '' , $ server [ 'all_http' ] ) ) , 'operam' ) !== false ) { return true ; } } if ( isset ( $ server [ 'http_x_wap_profile' ] ) || isset ( $ server [ 'http_profile' ] ) ) { ...
Comparison of the UserAgent chain and User Agent signatures
5,758
public static function userAgentStart ( $ userAgent ) { $ mobile_ua = strtolower ( substr ( $ userAgent , 0 , 4 ) ) ; return ( in_array ( $ mobile_ua , self :: $ _uaBegin ) ) ; }
Retrieve beginning clause of user agent
5,759
public function range ( $ value , $ begin , $ end ) : bool { return is_numeric ( $ value ) && $ value >= $ begin && $ value <= $ end ; }
Check if number in specified range .
5,760
public function loadOrmProvider ( $ config , XmlFileLoader $ loader , ContainerBuilder $ container ) { $ container -> setParameter ( $ this -> getAlias ( ) . '.persistence.orm.manager_name' , $ config [ 'manager_name' ] ) ; $ container -> setParameter ( $ this -> getAlias ( ) . '.backend_type_orm' , true ) ; $ loader -...
Load configuration for Doctrine ORM persistence layer
5,761
protected function setPropertyAccessibilityLevel ( int $ level ) { if ( ! $ this -> isPropertyAccessibilityLevelValid ( $ level ) ) { throw new RangeException ( sprintf ( 'Property accessibility level "%s" is invalid' , $ level ) ) ; } $ this -> _propertyAccessibilityLevel = $ level ; }
Set the maximum level of accessibility for allowing properties to be set or get
5,762
protected function getPropertyAccessibilityLevel ( ) : int { if ( ! isset ( $ this -> _propertyAccessibilityLevel ) ) { $ this -> setPropertyAccessibilityLevel ( $ this -> getDefaultPropertyAccessibilityLevel ( ) ) ; } return $ this -> _propertyAccessibilityLevel ; }
Get the maximum level of accessibility for allowing properties to be set or get
5,763
protected function isPropertyAccessibilityLevelValid ( int $ level ) : bool { if ( $ level == AccessibilityLevels :: PUBLIC_LEVEL || $ level == AccessibilityLevels :: PROTECTED_LEVEL || $ level == AccessibilityLevels :: PRIVATE_LEVEL ) { return true ; } return false ; }
Validate the given property accessibility level
5,764
public function changelogAction ( Request $ request , $ canonicalName ) { $ kernel = $ this -> get ( 'kernel' ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ application = $ em -> getRepository ( 'CanalTPSamCoreBundle:Application' ) -> findOneByCanonicalName ( $ canonicalName ) ; if ( is_null ( $ application...
Display CHANGELOG . md file for each application
5,765
public function getList ( ) { $ query = $ this -> getRepository ( ) -> find ( ) ; $ this -> getFilters ( ) -> apply ( $ query ) ; $ this -> getPagination ( ) -> setTotal ( $ query -> count ( ) ) ; $ query -> order ( $ this -> getOrder ( ) ) ; $ query -> limit ( $ this -> getPagination ( ) -> rowsPerPage , $ this -> get...
Get a paginated list of entities
5,766
public function getRepository ( ) { if ( null == $ this -> repository ) { $ this -> setRepository ( Orm :: getRepository ( $ this -> getEntityClassName ( ) ) ) ; } return $ this -> repository ; }
Get entity query
5,767
public function render ( ) { $ output = [ ] ; foreach ( $ this -> meta as $ element ) { $ output [ ] = '<meta' ; foreach ( $ element as $ key => $ value ) { $ output [ ] = sprintf ( ' %s="%s"' , $ key , $ value ) ; } $ output [ ] = ">\n" ; } $ output = apply_filters ( 'novusopress_meta_output' , implode ( '' , $ output...
Prints meta output
5,768
public function add ( $ item , $ rss , $ time ) { return $ this -> cache -> add ( $ item , $ rss , $ time ) ; }
add rss item
5,769
public function buildRssFeed ( ) { $ now = Carbon :: now ( ) ; $ feed = new Feed ( ) ; $ channel = new Channel ( ) ; $ channel -> title ( $ this -> title ( ) ) -> description ( $ this -> description ( ) ) -> url ( url ( '/' ) ) -> language ( $ this -> getLang ( ) ) -> copyright ( 'Copyright (c) ' . $ this -> author ( )...
Return a string with the feed data
5,770
public function getRssFeed ( ) { if ( $ this -> has ( 'rss-feed' ) ) { return $ this -> get ( 'rss-feed' ) ; } $ rss = $ this -> buildRssFeed ( ) ; $ this -> add ( 'rss-feed' , $ rss , $ this -> getCacheTime ( ) ) ; return $ rss ; }
get Rss feed
5,771
public function getUsersSearchAction ( ParamFetcher $ paramFetcher ) { try { $ params = $ paramFetcher -> all ( ) ; $ locationService = $ this -> get ( 'campaignchain.core.location' ) ; $ location = $ locationService -> getLocation ( $ params [ 'location' ] ) ; $ channelRESTService = $ this -> get ( 'campaignchain.chan...
Search for users on Twitter .
5,772
public static function factory ( $ config = array ( ) ) { $ client = new self ( $ config [ 'baseURL' ] , $ config ) ; $ client -> setDefaultOption ( 'headers/Content-Type' , 'application/json' ) ; $ client -> setDefaultOption ( 'X-Kinvey-API-Version' , 2 ) ; $ client -> setAuthMode ( $ config [ 'defaultAuthMode' ] ) ; ...
Static factory method used to turn an array or collection of configuration data into an instantiated object .
5,773
public static function registerPlugins ( KinveyClient $ client , $ plugins = array ( ) ) { $ plugins = array ( new KinveyAuthPlugin ( ) , new KinveyEntityCreateWithIDPlugin ( ) , new KinveyCollectionNamePlugin ( ) , new KinveyFileMetadataPlugin ( ) , new KinveyEntityPathRewritePlugin ( ) , new KinveyUserSoftDeletePlugi...
Register plugin instances in the client .
5,774
public static function getExponentialBackoffPlugin ( $ maxRetries = 0 , array $ kinveyErrorCodes = null ) { return new BackoffPlugin ( new TruncatedBackoffStrategy ( $ maxRetries , new KinveyErrorCodeBackoffStrategy ( $ kinveyErrorCodes , new ExponentialBackoffStrategy ( ) ) ) ) ; }
Retrieve a truncated exponential backoff plugin that will retry requests for certain Kinvey error codes .
5,775
public static function getLogPlugin ( ) { $ adapter = new MonologLogAdapter ( Log :: getMonolog ( ) ) ; $ format = "[{ts}] \"{method} {resource} {protocol}/{version}\" {code} {phrase} time:{total_time} kinveyRID:{res_header_x-kinvey-request-id} request:{req_body}" ; $ formatter = new MessageFormatter ( $ format ) ; ret...
Get the log plugin .
5,776
public function hasComponent ( $ id ) { if ( ! is_string ( $ id ) ) { $ id = array_shift ( $ id ) ; } return $ this -> getLocator ( ) -> has ( $ id ) ; }
Checks whether the named component exists .
5,777
public function setAliases ( $ mappings ) { foreach ( $ mappings as $ name => $ alias ) { if ( ( $ path = Alias :: get ( $ alias ) ) !== false ) { Alias :: set ( $ name , $ path ) ; } else { Alias :: set ( $ name , $ alias ) ; } } }
Defines the root aliases .
5,778
public function setModules ( $ modules ) { foreach ( $ modules as $ id => $ module ) { if ( is_int ( $ id ) ) { $ id = $ module ; $ module = [ ] ; } if ( ! isset ( $ module [ 'class' ] ) ) { Alias :: set ( $ id , $ this -> getModulePath ( ) . DIRECTORY_SEPARATOR . $ id ) ; $ module [ 'class' ] = '\\Modules\\' . ucfirst...
Configures the sub - modules of this module .
5,779
public function getModulePath ( ) { if ( $ this -> _modulePath !== null ) { return $ this -> _modulePath ; } else { return $ this -> _modulePath = $ this -> getBasePath ( ) . DIRECTORY_SEPARATOR . 'Modules' ; } }
Returns the directory that contains the application modules .
5,780
public function setModulePath ( $ value ) { if ( ( $ this -> _modulePath = realpath ( $ value ) ) === false || ! is_dir ( $ this -> _modulePath ) ) { throw new Exception ( Mindy :: t ( 'base' , 'The module path "{path}" is not a valid directory.' , [ '{path}' => $ value ] ) ) ; } }
Sets the directory that contains the application modules .
5,781
public function run ( ) { $ this -> signal -> send ( $ this , 'beginRequest' , $ this ) ; register_shutdown_function ( [ $ this , 'end' ] , 0 , false ) ; $ this -> processRequest ( ) ; $ this -> signal -> send ( $ this , 'endRequest' , $ this ) ; }
Runs the application . This method loads static application components . Derived classes usually overrides this method to do more application - specific tasks . Remember to call the parent implementation so that static application components are loaded .
5,782
public function getId ( ) { if ( $ this -> _id !== null ) { return $ this -> _id ; } else { return $ this -> _id = sprintf ( '%x' , crc32 ( $ this -> getBasePath ( ) . $ this -> name ) ) ; } }
Returns the unique identifier for the application .
5,783
public function setBasePath ( $ path ) { if ( ( $ this -> _basePath = realpath ( $ path ) ) === false || ! is_dir ( $ this -> _basePath ) ) { throw new Exception ( Mindy :: t ( 'base' , 'Application base path "{path}" is not a valid directory.' , [ '{path}' => $ path ] ) ) ; } }
Sets the root directory of the application . This method can only be invoked at the begin of the constructor .
5,784
public function getRuntimePath ( ) { if ( $ this -> _runtimePath !== null ) { return $ this -> _runtimePath ; } else { $ this -> setRuntimePath ( $ this -> getBasePath ( ) . DIRECTORY_SEPARATOR . 'runtime' ) ; return $ this -> _runtimePath ; } }
Returns the directory that stores runtime files .
5,785
public function getParams ( ) { if ( $ this -> _params !== null ) { return $ this -> _params ; } else { $ this -> _params = new Collection ( [ ] ) ; return $ this -> _params ; } }
Returns user - defined parameters .
5,786
public function loadGlobalState ( ) { if ( ( $ this -> _globalState = $ this -> statePersister -> load ( ) ) === null ) { $ this -> _globalState = [ ] ; } $ this -> _stateChanged = false ; }
Loads the global state data from persistent storage .
5,787
public function saveGlobalState ( ) { if ( $ this -> _stateChanged ) { $ this -> _stateChanged = false ; $ this -> statePersister -> save ( $ this -> _globalState ) ; } }
Saves the global state data into persistent storage .
5,788
protected function initSystemHandlers ( ) { if ( MINDY_ENABLE_EXCEPTION_HANDLER || MINDY_ENABLE_ERROR_HANDLER ) { $ handler = Creator :: createObject ( $ this -> errorHandlerConfig ) ; if ( MINDY_ENABLE_EXCEPTION_HANDLER ) { set_exception_handler ( [ $ handler , 'handleException' ] ) ; } if ( MINDY_ENABLE_ERROR_HANDLER...
Initializes the error handlers .
5,789
protected function isEditedGroup ( $ accessLevel , Group $ editedGroup ) { $ parts = explode ( '\\' , $ accessLevel ) ; if ( $ parts [ 1 ] === 'Group' && count ( $ parts ) === 3 && $ parts [ 2 ] === $ editedGroup -> getUuid ( ) ) { return true ; } return false ; }
Returns true if the access level is the edited group .
5,790
private function parseYamlOptions ( array $ opts = [ ] ) { if ( is_file ( $ this -> runner -> pwd . '/.phillip.yml' ) ) { $ options = Yaml :: parseFile ( $ this -> runner -> pwd . '/.phillip.yml' ) ; return array_merge ( $ opts , $ options ) ; } return $ opts ; }
Load options from the YAML config file and merge them with the existing options .
5,791
private function parseCliOptions ( array $ opts = [ ] ) { $ cliOpts = getopt ( 'chvrs:' , [ 'help' , 'version' , 'random' , 'suite:' , 'coverage' , ] ) ; if ( isset ( $ cliOpts [ 'help' ] ) || isset ( $ cliOpts [ 'h' ] ) ) { $ this -> runner -> output -> help ( ) ; exit ; } if ( isset ( $ cliOpts [ 'version' ] ) || iss...
Parse options given on the command line and merge them with the existing options .
5,792
public static function doExecute ( Client $ client , Request $ req ) { $ httpRequest = $ client -> getIo ( ) -> makeRequest ( $ req ) ; $ httpRequest -> setExpectedClass ( $ req -> getExpectedClass ( ) ) ; return self :: decodeHttpResponse ( $ httpRequest , $ client ) ; }
Executes a Request
5,793
public function dumpSchemaYAML ( $ environment ) { $ env = $ this -> getEnvironment ( $ environment ) ; $ current = $ env -> getCurrentVersion ( ) ; $ codeGenerator = new CodeGenerator ( ) ; $ data = [ ] ; $ adapter = $ env -> getAdapter ( ) ; foreach ( $ adapter -> getTables ( ) as $ table ) { if ( $ env -> getSchemaT...
schema yaml dump
5,794
private function getDictionaryBuilder ( DictionaryDefinition $ definition ) : DictionaryBuilderInterface { if ( ! $ this -> dictionaryBuilders -> has ( $ typeName = $ definition -> getType ( ) ) ) { $ typeName = 'default' ; } return $ this -> dictionaryBuilders -> get ( $ typeName ) ; }
Get a dictionary builder for the passed definition .
5,795
public function dumpServices ( ) { $ services = [ ] ; foreach ( $ this -> services as $ serviceName => $ service ) { $ services [ $ serviceName ] = $ this -> getServiceDump ( $ serviceName ) ; } return $ services ; }
Dumps the services depencies mapping
5,796
public function dumpParameters ( ) { $ parameters = [ ] ; foreach ( $ this -> parameters as $ parameterName => $ parameterValue ) { $ parameters [ $ parameterName ] = [ 'value' => $ parameterValue ] ; } return $ parameters ; }
Dumps the parameters depencies mapping
5,797
protected function checkCircularReferences ( $ name , \ Closure $ definition ) { $ arguments = $ this -> getServiceArgumentNames ( $ definition ) ; if ( in_array ( $ name , $ arguments , true ) ) { throw new \ InvalidArgumentException ( 'Circular exception detected' ) ; } }
Checks circular references in
5,798
public function getParentAttribute ( ) { $ parentClass = $ this -> block -> parent_type ; return $ parentClass :: find ( $ this -> block -> parent_id ) ; }
Returns the parent model of this content block .
5,799
private function process ( $ name , $ command ) { $ this -> getNotification ( $ name ) ; if ( $ this -> commandExists ( $ command ) ) { system ( $ command ) ; $ this -> getNotification ( $ name , TRUE ) ; } else if ( $ name == 'composer' ) { system ( 'curl -sS https://getcomposer.org/installer | php' ) ; system ( 'php ...
Provide a ProcessManager .