idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
229,500
public static function startOrder ( ArrayList $ list , $ order ) { $ order = LambdaUtils :: toSelectCallable ( $ order ) ; $ temp = new static ( $ list , $ order , self :: ORDER_ASC ) ; $ temp -> thenBy ( $ order ) ; return $ temp ; }
Create asc order instance
229,501
public static function startOrderDesc ( ArrayList $ list , $ order ) { $ order = LambdaUtils :: toSelectCallable ( $ order ) ; $ temp = new static ( $ list , $ order , self :: ORDER_DESC ) ; $ temp -> thenByDesc ( $ order ) ; return $ temp ; }
Create desc order instance
229,502
public function thenBy ( $ order ) { $ order = LambdaUtils :: toSelectCallable ( $ order ) ; $ this -> orders [ ] = array ( "property" => $ order , "direction" => self :: ORDER_ASC ) ; return $ this ; }
New asc order rule
229,503
public function thenByDesc ( $ order ) { $ order = LambdaUtils :: toSelectCallable ( $ order ) ; $ this -> orders [ ] = array ( "property" => $ order , "direction" => self :: ORDER_DESC ) ; return $ this ; }
New desc order rule
229,504
protected function setDefaultComparator ( ) { $ func = function ( $ a , $ b ) { $ temp = 0 ; $ cmpres = null ; foreach ( $ this -> orders as $ order ) { $ valuea = call_user_func ( $ order [ 'property' ] , $ a ) ; $ valueb = call_user_func ( $ order [ 'property' ] , $ b ) ; if ( $ valuea instanceof \ DateTime || $ valu...
Set the default compare method
229,505
public function toList ( ) { $ data = $ this -> list -> getData ( ) ; usort ( $ data , $ this -> getComparator ( ) ) ; $ newlist = $ this -> list -> newInstance ( ) ; $ newlist -> setData ( $ data ) ; return $ newlist ; }
Sort and get the result
229,506
protected function getFileContents ( ) { $ json = file_get_contents ( $ this -> sessionPath ) ; $ this -> items = json_decode ( $ json , TRUE ) ; }
Get file contents from file .
229,507
private function getEnvironment ( ) { $ env = new \ Dotenv \ Dotenv ( $ this -> basePath ) ; $ env -> load ( ) ; $ this -> env [ 'env' ] = getenv ( 'APP_ENV' ) ; $ this -> env [ 'debug' ] = getenv ( 'APP_DEBUG' ) ; $ this -> env [ 'appSecret' ] = getenv ( 'APP_KEY' ) ; }
Loads the environment from your . env file
229,508
public function boot ( ) { $ this -> session = Session :: getInstance ( ) ; $ this -> container = new AppContainer ; $ this -> container -> addServiceProvider ( new ServiceProvider ( $ this ) ) ; }
Application boot method . Loads the app providers and sets some default application variables
229,509
public function getParentsForBreadcrumbs ( $ entity , & $ parents = [ ] ) { array_push ( $ parents , $ entity ) ; if ( $ entity -> parent !== null ) { $ this -> getParentsForBreadcrumbs ( $ entity -> parent , $ parents ) ; } return array_reverse ( $ parents ) ; }
Finds all parents of the entity
229,510
public function deleteItem ( $ id = null ) { if ( $ id === null ) { throw new ItemNotSelectedException ; } $ entity = $ this -> getById ( $ id ) ; $ this -> deleteEntity ( $ entity ) ; }
Method for deleting an item
229,511
public function publishUnpublish ( $ id , User $ userEntity ) { if ( $ id === null ) { throw new ItemNotSelectedException ; } $ entity = $ this -> getById ( $ id ) ; $ entity -> published = ! $ entity -> published ; $ entity -> modifiedOn = new DateTime ( ) ; $ entity -> modifiedBy = $ userEntity ; $ this -> repository...
Method for publishing and unpublishing entity
229,512
public function getDefaultValues ( $ id = null ) { if ( $ id === null ) { return array ( ) ; } $ entity = $ this -> getById ( $ id ) ; $ values = $ this -> getDefaultFormValues ( $ entity ) ; return $ values ; }
Method for passing default values for form
229,513
public function getUniqueAlias ( $ entity , string $ titleProperty = 'title' , string $ titleValue = null , string $ aliasColumn = 'seoTitle' ) : string { return $ this -> repository -> getUniqueAlias ( $ entity , trim ( $ titleProperty ) , $ titleValue , $ aliasColumn ) ; }
Returns unique alias for SEF URL
229,514
public function getNormalizedName ( ) { if ( $ this -> normalizedName === null ) { $ this -> normalizedName = implode ( '_' , $ this -> getAncestorsNames ( ) ) ; } return $ this -> normalizedName ; }
Get NormalizedName .
229,515
public static function fromSchemaType ( $ qname ) { $ types = SchemaTypes :: getInstance ( ) ; $ type = $ types -> getType ( "{$qname->prefix}:{$qname->localName}" ) ; if ( ! $ type ) return null ; $ datatype = new DOMSchemaDatatype ( "{$qname->prefix}:{$qname->localName}" ) ; $ result = new DOMSchemaSimpleType ( $ qna...
Create an instance for a type in the SchemaTypes types list if there is one
229,516
public static function GetBuiltInComplexTypeByTypeCode ( $ typeCode ) { $ type = XmlTypeCode :: getTypeForCode ( $ typeCode ) ; if ( $ type === false ) { throw new \ InvalidArgumentException ( "The typecode passed to DOMSchemaType::GetBuiltInComplexTypeByTypeCode is not valid" ) ; } return DOMSchemaType :: GetBuiltInCo...
Returns an XmlSchemaComplexType that represents the built - in complex type of the complex type specified .
229,517
public static function GetBuiltInComplexTypeByQName ( $ qualifiedName ) { if ( is_null ( $ qualifiedName ) ) throw new \ lyquidity \ xml \ exceptions \ ArgumentNullException ( "The QName passed to DOMSchemaType::GetBuiltInComplexTypeByQName cannot be null" ) ; $ type = "" ; if ( $ qualifiedName instanceof QName ) { $ t...
Returns an XmlSchemaComplexType that represents the built - in complex type of the complex type specified by qualified name .
229,518
public static function getSchemaType ( $ domNode ) { try { $ types = SchemaTypes :: getInstance ( ) ; $ type = $ types -> getTypeForDOMNode ( $ domNode ) ; if ( $ type ) { $ resolves = SchemaTypes :: getInstance ( ) -> resolvesToBaseType ( $ type , array ( "xs:anySimpleType" , "xsd:anySimpleType" ) ) ; if ( $ resolves ...
Create a DOMSchemaType instance from a DOMNode
229,519
public function processRequest ( RequestInterface $ request ) { $ this -> response = $ this -> communicator -> getResponse ( $ request ) ; return $ this -> response ; }
Sends the request to the server and hands back the response .
229,520
public static function initialize ( Session $ session ) : void { static :: $ _session = $ session ; if ( ! static :: $ _session -> keyExists ( "_RESULTS" ) ) { static :: $ _session -> set ( "_RESULTS" , [ ] ) ; } }
Sets session object .
229,521
public static function flash ( string $ name , $ result ) : void { $ results = static :: $ _session -> get ( "_RESULTS" ) ; $ results [ $ name ] = [ "type" => "flash" , "result" => $ result ] ; static :: $ _session -> set ( "_RESULTS" , $ results ) ; }
Adds a flash result .
229,522
public static function delete ( string $ name ) : void { $ results = static :: $ _session -> get ( "_RESULTS" ) ; unset ( $ results [ $ name ] ) ; static :: $ _session -> set ( "_RESULTS" , $ results ) ; }
Deletes a result .
229,523
public static function get ( $ length = - 1 , int $ offset = 0 ) : array { $ ret = [ ] ; $ results = static :: $ _session -> get ( "_RESULTS" ) ; if ( ! is_numeric ( $ length ) && isset ( $ results [ $ length ] ) ) { $ ret = $ results [ $ length ] [ "result" ] ; if ( $ results [ $ length ] [ "type" ] === "flash" ) { un...
Returns the results .
229,524
public function match ( $ url = null ) { $ match = parent :: match ( $ url ) ; $ regex = $ this -> getRegex ( $ this -> getMatchUrl ( ) ) ; if ( $ regex !== ' ' ) { if ( preg_match ( "@" . ltrim ( $ regex ) . "@si" , $ this -> getRequestedUrl ( ) , $ matches ) || true === $ match ) { unset ( $ matches [ 0 ] ) ; Paramet...
Regex kontrolu yapar
229,525
protected function getValueFromReferencedEntity ( FieldInterface $ field ) { $ references = $ this -> model -> referredIn ( $ field -> name ( ) ) ; foreach ( $ references as $ foreign => $ reference ) { $ entity = $ this -> accessor -> getPropertyValue ( $ this -> instance , $ reference -> container ( ) ) ; if ( $ enti...
Gets value from first referenced entity that has it
229,526
public function getValue ( ArrayAccess $ item ) : string { $ value = $ item -> offsetExists ( $ this -> name ) ? $ item -> offsetGet ( $ this -> name ) : '' ; if ( is_callable ( $ this -> filter ) ) { if ( $ this -> filter instanceof ContextAwareFilterInterface ) { $ this -> filter -> setContext ( clone $ item ) ; } $ ...
Get the value from a data object the filter is applied .
229,527
public function getIndexes ( $ oid ) { $ query = new Query ( "SELECT string_to_array( indkey::text, ' ') AS keys, * FROM pg_index WHERE indrelid = %oid:int%" , array ( 'oid' => $ this -> get ( 'oid' ) ) ) ; $ indexes = $ this -> db -> query ( $ query ) -> fetch ( Result :: TYPE_DETECT ) ; foreach ( $ this -> indexes as...
Get relation indexes from a oid
229,528
public function findByIdentifier ( $ identifier ) { $ identifier = explode ( '.' , $ identifier ) ; if ( count ( $ identifier ) < 2 ) { throw new \ InvalidArgumentException ( "yeah, not a table.column level identifier" ) ; } $ columnName = array_pop ( $ identifier ) ; $ tableName = implode ( '.' , $ identifier ) ; $ ta...
Initalise a attribute by a schema . table . column or table . column identifier AFAICT due to the ambiguity of the identifier this is probably best doen with a round trip to the database . It isn t slow .
229,529
protected function buildComments ( ) { if ( is_null ( $ this -> comments ) ) { $ this -> comments = array ( ) ; } else { return ; } $ sql = <<<SQLSELECT a.attrelid::text || '.' || a.attnum AS key, d.description AS textFROM pg_attribute AS aINNER JOIN pg_description AS d ON a.attrelid = d.objoid AND ...
It s a hassle complicating all the column source queries with a join to pg_description . This is a lazy load comment solution . Midly hacky .
229,530
private function getWatermark ( ImagineInterface $ imagine ) : ? ImageInterface { $ resource = null ; if ( $ this -> getMarkFilepath ( ) !== null ) { $ resource = fopen ( $ this -> getMarkFilepath ( ) , 'rb' ) ; } elseif ( \ is_string ( $ this -> markContent ) ) { $ resource = 'a' ; } elseif ( \ is_resource ( $ this ->...
Get watermark image
229,531
public static function getAppliedFilters ( ) { $ classMethods = get_class_methods ( get_class ( ) ) ; $ calledClassMethods = get_class_methods ( get_called_class ( ) ) ; $ filteredMethods = array_filter ( $ calledClassMethods , function ( $ calledClassMethod ) use ( $ classMethods ) { return ! in_array ( $ calledClassM...
Get applied filters from request .
229,532
function add_field ( $ name , $ title = null , \ Closure $ display_callback = null , Setting \ Section $ section = null , $ default = null ) { if ( is_array ( $ name ) ) { $ field = $ name + [ $ display_callback = null , $ section = null , $ default = null , $ type = 'text' ] ; } else { $ field = compact ( 'name' , 'ti...
Just pass name which is an assoc array - what you see here are legacy params
229,533
public function format ( array $ response ) { $ car = '<br />' ; $ format = '' ; foreach ( $ response as $ page ) { $ format .= '<div class="page"><span class="title">' . ApiTools :: safeString ( $ page -> getTitle ( ) ) . '</span>' . $ car . 'pageid: <span class="pageid">' . $ page -> getPageid ( ) . '</span>' . $ car...
format a page response as an HTML string
229,534
public function setCommand ( string $ args ) : self { if ( $ this -> mailer instanceof SendmailMailer ) { $ this -> mailer -> commandArgs = $ args ; } return $ this ; }
Nastavi argumenty pro mailer
229,535
public static function explode ( $ string , $ delimiter = ',' , $ trim = true , $ skipEmpty = false ) { $ result = explode ( $ delimiter , $ string ) ; if ( $ trim ) { if ( $ trim === true ) { $ trim = 'trim' ; } elseif ( ! is_callable ( $ trim ) ) { $ trim = function ( $ v ) use ( $ trim ) { return trim ( $ v , $ trim...
Explodes string into array optionally trims values and skips empty ones
229,536
function & mock_mount ( array $ fs , $ mountpoint = '~/approot' ) { $ mountpoint = str_replace ( '~' , $ this -> mock_homedir , trim ( $ mountpoint , '/' ) ) ; $ normalizedfs = $ this -> mock_normalize ( $ fs ) ; $ path = & $ this -> mock_ensurepath ( $ mountpoint ) ; $ this -> mock_fsmerge ( $ path , $ normalizedfs ) ...
Mount virtual filesystem at specified location .
229,537
function mock_fsmerge ( & $ fs , & $ comp ) { if ( isset ( $ comp [ '%type' ] ) && $ comp [ '%type' ] == 'file' ) { throw new \ Exception ( '[Mock] Tried to copy file as directory.' ) ; } $ existing_files = [ ] ; foreach ( $ fs as $ node => $ file ) { if ( is_integer ( $ node ) ) { $ existing_files [ ] = $ file [ 'file...
Merges two file system definitions togheter .
229,538
protected function getModuleMigrations ( $ downloadPath , $ moduleMigrationPath = 'asset/data' ) { $ moduleMigrationPath = trim ( $ moduleMigrationPath , '/' ) ; $ moduleMigrations = glob ( $ downloadPath . '/' . $ moduleMigrationPath . '/*.php' ) ; sort ( $ moduleMigrations ) ; return $ moduleMigrations ; }
Check if module have migrations files
229,539
protected function copyModuleMigrations ( array $ config , array $ moduleMigrations ) { $ migrationPath = $ this -> checkMigrationsPath ( $ config ) ; if ( $ migrationPath === false ) { return false ; } $ migrations = glob ( $ migrationPath . '*.php' ) ; $ old_migration_names = array ( ) ; $ copied = 0 ; sort ( $ migra...
Copy all module migration files to application migration directory
229,540
protected function checkMigrationsPath ( array $ config ) { $ migrationPath = isset ( $ config [ 'migration_path' ] ) ? $ config [ 'migration_path' ] : false ; $ migrationPath = str_replace ( 'FCPATH' , '' , $ migrationPath ) ; if ( $ migrationPath !== false && ! is_dir ( $ migrationPath ) ) { mkdir ( $ migrationPath ,...
Check Application Migrations path if not available it will create new one
229,541
protected function getMigrationConfig ( $ downloadPath ) { $ extra = ( $ pkg = $ this -> composer -> getPackage ( ) ) ? $ pkg -> getExtra ( ) : array ( ) ; $ appPath = defined ( 'APPPATH' ) ? APPPATH : $ extra [ 'codeigniter-application-dir' ] ; @ include $ appPath . '/config/migration.php' ; return isset ( $ config ) ...
Get migration configurations
229,542
public function tag ( $ name , Array $ options = array ( ) , $ content = null , $ open = false ) { if ( ! $ name ) { return '' ; } $ htmlOptions = '' ; foreach ( $ options as $ key => $ value ) { $ htmlOptions .= ' ' . $ key . '="' . \ htmlspecialchars ( $ value , \ ENT_COMPAT ) . '"' ; } if ( $ content !== null ) { re...
Constructs an html tag
229,543
public function translate ( $ locale = null , $ create = false ) { $ locale = $ locale ? : $ this -> currentLocale ; if ( null === $ locale ) { throw new \ RuntimeException ( 'No locale has been set and current locale is undefined.' ) ; } if ( $ this -> currentTranslation && $ locale === $ this -> currentTranslation ->...
Returns the translation regarding to the current or fallback locale .
229,544
public function addTranslation ( TranslationInterface $ translation ) { if ( ! $ this -> translations -> containsKey ( $ translation -> getLocale ( ) ) ) { $ this -> translations -> set ( $ translation -> getLocale ( ) , $ translation ) ; $ translation -> setTranslatable ( $ this ) ; } return $ this ; }
Adds the translation .
229,545
public function reference ( $ useCaseName , $ resourcePart = null , Request $ request = null ) { if ( null === $ request ) { $ request = $ this -> getRequest ( ) ; } return $ this -> getUseCaseFactoryInstance ( ) -> setUseCaseName ( $ useCaseName ) -> setRequest ( $ request ) -> getResource ( $ resourcePart ) ; }
Factory method for use of a new UseCase class Returns whole resource or just one part
229,546
private function prepareRatios ( Collection $ categories ) { $ ratios = $ categories -> filter ( function ( Category $ category ) { return $ category -> hasPosts ( ) ; } ) -> transform ( function ( Category $ category ) { return [ 'label' => $ category -> name , 'posts' => $ category -> posts -> count ( ) , ] ; } ) -> ...
Prepare the categories ratios .
229,547
public function BeforeDelete ( $ item ) { $ contContainers = ContentContainer :: Schema ( ) -> FetchByContainer ( true , $ item ) ; $ logger = new Logger ( BackendModule :: Guard ( ) -> GetUser ( ) ) ; foreach ( $ contContainers as $ contContainer ) { $ content = $ contContainer -> GetContent ( ) ; $ provider = Content...
Deletes the container contents related to the container
229,548
public static function toSelectCallable ( $ mixed = null ) { if ( self :: isClosure ( $ mixed ) || self :: isInstanceCallable ( $ mixed ) ) { return $ mixed ; } elseif ( is_null ( $ mixed ) || $ mixed === "" ) { return function ( $ v ) { return $ v ; } ; } elseif ( is_int ( $ mixed ) || is_float ( $ mixed ) || is_strin...
Converts strings empty strings and NULL into a callable
229,549
public static function toConditionCallable ( $ mixed = null ) { if ( self :: isClosure ( $ mixed ) || self :: isInstanceCallable ( $ mixed ) ) { return $ mixed ; } elseif ( is_bool ( $ mixed ) || is_string ( $ mixed ) || is_numeric ( $ mixed ) ) { return function ( $ v ) use ( $ mixed ) { return $ v === $ mixed ; } ; }...
Convert strings numbers booleans and arrays into a callable
229,550
public function scopeFilter ( $ query ) { if ( ! $ this -> filters ) { $ message = 'Please set the $filters property.' ; throw new FilterableSortableException ( $ message ) ; } $ this -> filters = app ( ) -> make ( $ this -> filters ) ; if ( ! $ this -> filters instanceof QueryFilters ) { $ message = '$filters property...
Filter a result set .
229,551
public function scopeSort ( $ query ) { if ( ! $ this -> sorters ) { $ message = 'Please set the $sorters property.' ; throw new FilterableSortableException ( $ message ) ; } $ this -> sorters = app ( ) -> make ( $ this -> sorters ) ; if ( ! $ this -> sorters instanceof QuerySorters ) { $ message = '$sorters property m...
Sort a result set .
229,552
public function makeAliasKey ( $ table , $ increment = true ) { return strtr ( '{table}_{count}' , [ '{table}' => TableNameResolver :: getTableName ( $ table ) , '{count}' => $ this -> _aliasesCount + 1 , ] ) ; }
Makes alias for joined table .
229,553
public static function setup ( string $ connection = 'Default' ) { $ capsule = new Capsule ( ) ; $ capsule -> addConnection ( self :: getConnection ( $ connection ) ) ; $ capsule -> setAsGlobal ( ) ; $ capsule -> bootEloquent ( ) ; }
Setup the Eloquent ORM .
229,554
protected static function getConnection ( string $ connection = 'Default' ) : array { $ configuration = [ ] ; if ( is_array ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'DB' ] [ 'Connections' ] [ $ connection ] ) ) { $ extensionConfiguration = $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXT' ] [ 'extConf' ] [ 't3v_datamapper' ] ; if ( i...
Returns the connection configuration from the Global TYPO3 configuration options .
229,555
public static function get ( $ country ) { switch ( strtoupper ( $ country ) ) { case "DE" : return KlarnaEncoding :: PNO_DE ; case "DK" : return KlarnaEncoding :: PNO_DK ; case "FI" : return KlarnaEncoding :: PNO_FI ; case "NL" : return KlarnaEncoding :: PNO_NL ; case "NO" : return KlarnaEncoding :: PNO_NO ; case "SE"...
Returns the constant for the wanted country .
229,556
public static function getRegexp ( $ enc ) { switch ( $ enc ) { case self :: PNO_SE : return '/^[0-9]{6,6}(([0-9]{2,2}[-\+]{1,1}[0-9]{4,4})|([-\+]' . '{1,1}[0-9]{4,4})|([0-9]{4,6}))$/' ; case self :: PNO_NO : return '/^[0-9]{6,6}((-[0-9]{5,5})|([0-9]{2,2}((-[0-9]' . '{5,5})|([0-9]{1,1})|([0-9]{3,3})|([0-9]{5,5))))$/' ;...
Returns a regexp string for the specified encoding constant .
229,557
public function getSection ( string $ key ) : ConfigurationBagInterface { return new ConfigurationBag ( isset ( $ this -> parameters [ $ key ] ) ? $ this -> parameters [ $ key ] : [ ] ) ; }
Returns a new ConfigurationBag with parameters If the section does not exists an empty ConfigurationBag is returned
229,558
public static function getNest ( $ input , $ open = "(" , $ close = ")" ) { $ pattern = '#\\' . $ open . '((?>[^\\' . $ open . '[\\' . $ close . ']+)|(?R))*\\' . $ close . '#' ; $ count = preg_match_all ( $ pattern , $ input , $ matches ) ; if ( $ count > 0 ) return $ matches [ 0 ] [ 0 ] ; return false ; }
return anything within specified balanced brackets including any nested brackets
229,559
private function addFilterCriteria ( ) { $ filters = $ this -> dm -> getFilterCollection ( ) -> getFilterCriteria ( $ this -> class ) ; foreach ( $ filters as $ filter ) { $ this -> addCriteria ( $ filter ) ; } }
Add any filters to the query criteria .
229,560
private function checkIndexIsEligible ( ) { $ index = $ this -> getIndex ( ) ; if ( $ index -> isSecondaryGlobal ( ) && ! $ index -> hasAttributes ( $ this -> expr -> getAttributes ( ) ) ) { throw ODMException :: queryIndexProjectionIncompatible ( ) ; } return ( bool ) $ this -> getKeyCondition ( ) ; }
Indicates if the selected index is eligible for the assembled query .
229,561
public function delete ( $ hashValue = null , $ rangeValue = null ) { $ this -> setQueryClass ( DeleteItem :: class ) ; if ( $ hashValue !== null ) { $ this -> setPrimaryKey ( $ hashValue , $ rangeValue ) ; } return $ this ; }
Sets the query operation to delete and optionally specifies the primary key .
229,562
public function get ( $ hashValue = null , $ rangeValue = null ) { if ( $ this -> expr -> condition -> count ( ) > 0 ) { throw ODMException :: queryGetOperationConditionsNotSupported ( ) ; } $ this -> setQueryClass ( GetItem :: class ) ; if ( $ hashValue !== null ) { $ this -> setPrimaryKey ( $ hashValue , $ rangeValue...
Sets the query operation to get and optionally specifies the primary key .
229,563
private function getFilter ( $ keyCondition ) { $ filter = clone $ this -> expr -> condition ; $ conditions = $ keyCondition instanceof Composite ? $ keyCondition -> getParts ( ) : [ $ keyCondition ] ; foreach ( $ conditions as $ condition ) { $ filter -> remove ( $ condition ) ; } return $ filter ; }
Return a expression containing only the subexpression parts which are not part of specified key condition .
229,564
public function getQuery ( ) { switch ( $ this -> queryClass ) { case DeleteItem :: class : return $ this -> makeDelete ( ) ; case GetItem :: class : return $ this -> makeGet ( ) ; case PutItem :: class : return $ this -> makePut ( ) ; case Scan :: class : return $ this -> makeScan ( ) ; case UpdateItem :: class : retu...
Build and return the query object .
229,565
public function requireIndexes ( $ bool = true ) { if ( ! $ this -> isQueryOrScan ( ) ) { } if ( $ bool ) { $ this -> queryClass = Query :: class ; } else { $ this -> queryClass = Scan :: class ; } return $ this ; }
Set whether or not to require indexes .
229,566
public function update ( $ hashValue = null , $ rangeValue = null ) { $ this -> setQueryClass ( UpdateItem :: class ) ; if ( $ hashValue !== null ) { $ this -> setPrimaryKey ( $ hashValue , $ rangeValue ) ; } return $ this ; }
Sets the query operation to update and optionally specifies the primary key .
229,567
public function beforeAction ( $ action ) { if ( Cii :: getConfig ( 'useDisqusComments' ) ) throw new CHttpException ( 403 , Yii :: t ( 'Api.comment' , 'The comment API is not available while Disqus comments are enabled.' ) ) ; if ( Cii :: getConfig ( 'useDiscourceComments' ) ) throw new CHttpException ( 403 , Yii :: t...
If Disqus comments are enabled disable the entire API
229,568
private function getCommentModel ( $ id = NULL ) { if ( $ id === NULL ) throw new CHttpException ( 400 , Yii :: t ( 'Api.comment' , 'Missing id' ) ) ; $ model = Comments :: model ( ) -> findByPk ( $ id ) ; if ( $ model === NULL ) throw new CHttpException ( 404 , Yii :: t ( 'Api.comment' , 'Comment #{{id}} was not found...
Retrieves the Comment model
229,569
public function toArray ( ) { $ ary = [ ] ; foreach ( $ this as $ key => $ value ) { $ ary [ $ key ] = $ value ; } return $ ary ; }
Converts the object to an array
229,570
public function addHandlerDefinition ( $ commandClassName , $ handlerServiceId ) { if ( isset ( $ this -> handlerDefinitions [ $ commandClassName ] ) ) { throw new \ InvalidArgumentException ( sprintf ( "Handler with service id '%s' already configured for command %s'" , $ this -> handlerDefinitions [ $ commandClassName...
Add handler definition
229,571
public function onKernelRequest ( ) { if ( $ this -> executed ) return ; $ installerScript = $ this -> scriptFactory -> createScript ( 'PostBootInstaller' ) ; $ installerScript -> setContainer ( $ this -> container ) -> executeActionsFromFile ( $ this -> basePath . '/.PostInstall' ) ; $ installerScript = $ this -> scri...
Executes the action when the onKernelRequest event is dispatched
229,572
public function getTranslation ( string $ key , string $ locale = null ) { $ this -> throwExceptionIfAttributeIsNotTranslatable ( $ key ) ; $ translations = $ this -> getTranslations ( $ key ) ; if ( count ( $ translations ) ) { $ locale = $ locale ? : config ( 'app.locale' ) ; if ( isset ( $ translations [ $ locale ] ...
Get attribute translation .
229,573
public function setTranslation ( string $ key , string $ value = null , string $ locale = null ) { $ this -> throwExceptionIfAttributeIsNotTranslatable ( $ key ) ; $ locale = $ locale ? : config ( 'app.locale' ) ; $ translations = $ this -> getTranslations ( $ key ) ; if ( $ this -> hasSetMutator ( $ key ) ) { $ value ...
Set attribute translation .
229,574
private function runMigrationTool ( array $ dsn ) { $ runner = new CConsoleCommandRunner ( ) ; $ runner -> commands = array ( 'migrate' => array ( 'class' => 'application.commands.CiiMigrateCommand' , 'dsn' => $ dsn , 'interactive' => 0 , ) , 'db' => array ( 'class' => 'CDbConnection' , 'connectionString' => "mysql:hos...
Runs the migration tool effectivly installing the database an all appliciable default settings
229,575
final public function getDefaultPort ( $ name ) { $ this -> _getPortKey ( $ name ) ; if ( $ this -> isNamedPort ( $ name ) ) { return constant ( $ this -> _port_class . $ name ) ; } else { throw new \ InvalidArgumentException ( "Unknown name or scheme: {$name}" ) ; } }
Get the port number from its name or scheme
229,576
final public function isDefaultPort ( $ scheme , $ port ) { $ this -> _getPortKey ( $ scheme ) ; try { return $ this -> isNamedPort ( $ scheme ) and ( $ this -> getDefaultPort ( $ scheme ) === ( int ) $ port ) ; } catch ( \ Exception $ e ) { echo $ e . PHP_EOL ; } }
Checks that the given scheme and port match according to defaults
229,577
public function onFlush ( OnFlushEventArgs $ args ) : void { $ em = $ args -> getEntityManager ( ) ; $ uow = $ em -> getUnitOfWork ( ) ; foreach ( $ uow -> getScheduledEntityInsertions ( ) as $ entity ) { foreach ( $ this -> getInvitations ( $ entity ) as $ invitation ) { $ em -> persist ( $ invitation ) ; $ uow -> com...
Listens for the onFlush event .
229,578
private function getInvitations ( $ object ) { if ( ! $ object instanceof Event || ! $ object -> getFullCompany ( ) ) { return [ ] ; } $ existing = [ ] ; foreach ( $ object -> getInvitations ( ) as $ existing_invitation ) { $ existing [ ] = $ existing_invitation -> getInvitee ( ) ; } $ invitations = [ ] ; foreach ( $ o...
Helper function that generates new invitations as needed .
229,579
public static function register ( ) { foreach ( [ 'post' , 'user' ] as $ type ) { \ register_rest_field ( 'post' === $ type ? get_post_types ( ) : $ type , self :: FIELD_NAME , [ 'get_callback' => [ __CLASS__ , 'get_' . $ type . '_fields' ] ] ) ; } }
Register the field for all post types and users .
229,580
static function render ( $ view , array $ data = [ ] ) { if ( file_exists ( $ view ) ) { if ( is_array ( $ data ) ) { foreach ( $ data as $ _data => $ _value ) { if ( Config :: get ( 'security.anti_xss' ) && is_string ( $ _value ) ) { $ _value = Text :: entities ( $ _value ) ; } $ $ _data = $ _value ; } } else { throw ...
Alias read file
229,581
private function addServiceInstance ( $ id , Definition $ definition , $ isSimpleInstance ) { $ class = $ this -> dumpValue ( $ definition -> getClass ( ) ) ; if ( 0 === strpos ( $ class , "'" ) && false === strpos ( $ class , '$' ) && ! preg_match ( '/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-z...
Generates the service instance .
229,582
private function isTrivialInstance ( Definition $ definition ) { if ( $ definition -> isSynthetic ( ) || $ definition -> getFile ( ) || $ definition -> getMethodCalls ( ) || $ definition -> getProperties ( ) || $ definition -> getConfigurator ( ) ) { return false ; } if ( $ definition -> isDeprecated ( ) || $ definitio...
Checks if the definition is a trivial instance .
229,583
private function addServiceMethodCalls ( Definition $ definition , $ variableName = 'instance' ) { $ calls = '' ; foreach ( $ definition -> getMethodCalls ( ) as $ call ) { $ arguments = array ( ) ; foreach ( $ call [ 1 ] as $ value ) { $ arguments [ ] = $ this -> dumpValue ( $ value ) ; } $ calls .= $ this -> wrapServ...
Adds method calls to a service definition .
229,584
private function addServiceConfigurator ( Definition $ definition , $ variableName = 'instance' ) { if ( ! $ callable = $ definition -> getConfigurator ( ) ) { return '' ; } if ( is_array ( $ callable ) ) { if ( $ callable [ 0 ] instanceof Reference || ( $ callable [ 0 ] instanceof Definition && $ this -> definitionVar...
Adds configurator definition .
229,585
private function addNormalizedIds ( ) { $ code = '' ; $ normalizedIds = $ this -> container -> getNormalizedIds ( ) ; ksort ( $ normalizedIds ) ; foreach ( $ normalizedIds as $ id => $ normalizedId ) { if ( $ this -> container -> has ( $ normalizedId ) ) { $ code .= ' ' . $ this -> doExport ( $ id ) . ' => '...
Adds the normalizedIds property definition .
229,586
private function addRemovedIds ( ) { if ( ! $ ids = $ this -> container -> getRemovedIds ( ) ) { return '' ; } if ( $ this -> asFiles ) { $ code = "require \$this->containerDir.\\DIRECTORY_SEPARATOR.'removed-ids.php'" ; } else { $ code = '' ; $ ids = array_keys ( $ ids ) ; sort ( $ ids ) ; foreach ( $ ids as $ id ) { $...
Adds the removedIds definition .
229,587
private function addFileMap ( ) { $ code = '' ; $ definitions = $ this -> container -> getDefinitions ( ) ; ksort ( $ definitions ) ; foreach ( $ definitions as $ id => $ definition ) { if ( ! $ definition -> isSynthetic ( ) && $ definition -> isShared ( ) && ! $ this -> isHotPath ( $ definition ) ) { $ code .= sprintf...
Adds the fileMap property definition .
229,588
private function getServiceConditionals ( $ value ) { $ conditions = array ( ) ; foreach ( ContainerBuilder :: getInitializedConditionals ( $ value ) as $ service ) { if ( ! $ this -> container -> hasDefinition ( $ service ) ) { return 'false' ; } $ conditions [ ] = sprintf ( "isset(\$this->services['%s'])" , $ service...
Get the conditions to execute for conditional services .
229,589
private function getNextVariableName ( ) { $ firstChars = self :: FIRST_CHARS ; $ firstCharsLength = strlen ( $ firstChars ) ; $ nonFirstChars = self :: NON_FIRST_CHARS ; $ nonFirstCharsLength = strlen ( $ nonFirstChars ) ; while ( true ) { $ name = '' ; $ i = $ this -> variableCount ; if ( '' === $ name ) { $ name .= ...
Returns the next name to use .
229,590
protected function fieldfillers ( ) { $ fieldrender = $ this -> fieldrender ( ) ; if ( $ this -> hintrenderer !== null ) { $ callable = & $ this -> hintrenderer ; $ hintsrender = $ callable ( $ this -> hints ( ) ) ; } else { $ hintsrender = null ; } if ( $ this -> showerrors && $ this -> errorrenderer ) { $ callable = ...
Hook for adding additional fillers for hotwiring funcitonality .
229,591
public static function castFrom ( $ value , string $ name = 'Date' ) : self { if ( is_int ( $ value ) || is_string ( $ value ) || $ value instanceof \ DateTime ) { return new self ( $ value ) ; } if ( ! ( $ value instanceof Date ) ) { throw new \ InvalidArgumentException ( $ name . ' must be a timestamp, a string conta...
casts given value to an instance of Date
229,592
public function writeDirectory ( ) { $ toDirectory = dirname ( $ this -> path ) ; if ( ! file_exists ( $ toDirectory ) ) { mkdir ( $ toDirectory , 0770 , true ) ; } if ( ! is_dir ( $ toDirectory ) ) { throw new Concentrate_FileException ( "Could not write to directory {$toDirectory} because it " . "exists and is not a ...
Creates a directory for this path if such a directory does not already exist
229,593
public function evaluate ( ) { $ postPath = array ( ) ; $ prePath = array ( ) ; $ path = rtrim ( $ this -> path , '/' ) ; $ pathSegments = explode ( '/' , $ path ) ; foreach ( $ pathSegments as $ segment ) { if ( $ segment == '..' ) { if ( count ( $ postPath ) > 0 ) { array_pop ( $ postPath ) ; } else { array_push ( $ ...
Evaluates a path that contains relative references and removes superfluous current directory references
229,594
public function attach ( ObserverInterface $ observer ) { if ( $ this -> isAttached ( $ observer ) ) { return false ; } $ this -> observers [ ] = $ observer ; return true ; }
Returns true if the observer is attached successfully .
229,595
public function detach ( ObserverInterface $ observer ) { foreach ( $ this -> observers as $ key => $ value ) { if ( $ value === $ observer ) { unset ( $ this -> observers [ $ key ] ) ; return true ; } } return false ; }
Returns true if the observer is detached successfully .
229,596
public function notify ( $ arguments = null ) { foreach ( $ this -> observers as $ observer ) { $ observer -> update ( $ this , $ arguments ) ; } }
Notify all the attached observers .
229,597
public function clean ( $ path ) { $ tokens = [ ] ; $ path = $ this -> cleanPath ( $ path ) ; $ prefix = $ this -> prefix ( $ path ) ; $ path = substr ( $ path , strlen ( $ prefix ) ) ; $ parts = array_filter ( explode ( '/' , $ path ) , 'strlen' ) ; foreach ( $ parts as $ part ) { if ( '..' === $ part ) { array_pop ( ...
Normalize and clean path .
229,598
public function getPaths ( $ source ) { $ source = $ this -> cleanSource ( $ source ) ; list ( , $ paths ) = $ this -> parse ( $ source ) ; return $ paths ; }
Get all absolute path to a file or a directory .
229,599
public function isVirtual ( $ path ) : bool { $ parts = explode ( ':' , $ path , 2 ) ; list ( $ alias ) = $ parts ; $ alias = $ this -> cleanAlias ( $ alias ) ; if ( ! array_key_exists ( $ alias , $ this -> paths ) && $ this -> prefix ( $ path ) !== null ) { return false ; } return count ( $ parts ) === 2 ; }
Check virtual or real path .