idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
4,800
public function getInvalidAttribs ( ) { return array_combine ( array_keys ( $ this -> invalidAttribs ) , array_map ( function ( $ ref ) { return $ ref [ 'attrib' ] ; } , array_values ( $ this -> invalidAttribs ) ) ) ; }
Returns all invalidated attributes
4,801
public function getInvalidData ( ) { return array_combine ( array_keys ( $ this -> invalidAttribs ) , array_map ( function ( $ ref ) { return $ ref [ 'value' ] ; } , array_values ( $ this -> invalidAttribs ) ) ) ; }
Returns all invalid input data
4,802
public function getInvalidErrors ( ) { return array_combine ( array_keys ( $ this -> invalidAttribs ) , array_map ( function ( $ ref ) { return $ ref [ 'error' ] ; } , array_values ( $ this -> invalidAttribs ) ) ) ; }
Returns all errors for invalid attribs
4,803
public function getMissingAttribs ( ) { return array_combine ( array_keys ( $ this -> missingAttribs ) , array_map ( function ( $ ref ) { return $ ref [ 'attrib' ] ; } , array_values ( $ this -> missingAttribs ) ) ) ; }
Returns all missing attributes
4,804
public function getMissingErrors ( ) { return array_combine ( array_keys ( $ this -> missingAttribs ) , array_map ( function ( $ ref ) { return $ ref [ 'error' ] ; } , array_values ( $ this -> missingAttribs ) ) ) ; }
Returns all missing error message
4,805
public function getInvalidOrMissingErrors ( ) { $ all = $ this -> invalidAttribs + $ this -> missingAttribs ; return array_combine ( array_keys ( $ all ) , array_map ( function ( $ ref ) { return $ ref [ 'error' ] ; } , array_values ( $ all ) ) ) ; }
Returns combined missing an invalid error messages
4,806
public function hasError ( $ attribName = null ) { if ( is_null ( $ attribName ) ) { return count ( $ this -> invalidAttribs ) > 0 || count ( $ this -> missingAttribs ) > 0 ; } else { return isset ( $ this -> invalidAttribs [ $ attribName ] ) || isset ( $ this -> missingAttribs [ $ attribName ] ) ; } }
Returns whether has error
4,807
public function filterByAlternativeName ( $ alternativeName = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ alternativeName ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ alternativeName ) ) { $ alternativeName = str_replace ( '*' , '%' , $ alternativeName...
Filter the query on the alternative_name column
4,808
public function filterByIsTranslation ( $ isTranslation = null , $ comparison = null ) { if ( is_string ( $ isTranslation ) ) { $ isTranslation = in_array ( strtolower ( $ isTranslation ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( SkillVersionTableMap...
Filter the query on the is_translation column
4,809
public function filterByIsRotation ( $ isRotation = null , $ comparison = null ) { if ( is_string ( $ isRotation ) ) { $ isRotation = in_array ( strtolower ( $ isRotation ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( SkillVersionTableMap :: COL_IS_ROTA...
Filter the query on the is_rotation column
4,810
public function filterByIsAcyclic ( $ isAcyclic = null , $ comparison = null ) { if ( is_string ( $ isAcyclic ) ) { $ isAcyclic = in_array ( strtolower ( $ isAcyclic ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( SkillVersionTableMap :: COL_IS_ACYCLIC ,...
Filter the query on the is_acyclic column
4,811
public function filterByIsCyclic ( $ isCyclic = null , $ comparison = null ) { if ( is_string ( $ isCyclic ) ) { $ isCyclic = in_array ( strtolower ( $ isCyclic ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( SkillVersionTableMap :: COL_IS_CYCLIC , $ isC...
Filter the query on the is_cyclic column
4,812
public function filterByLongitudinalFlags ( $ longitudinalFlags = null , $ comparison = null ) { if ( is_array ( $ longitudinalFlags ) ) { $ useMinMax = false ; if ( isset ( $ longitudinalFlags [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_LONGITUDINAL_FLAGS , $ longitudinalFlags [ 'min' ] , Cri...
Filter the query on the longitudinal_flags column
4,813
public function filterByLatitudinalFlags ( $ latitudinalFlags = null , $ comparison = null ) { if ( is_array ( $ latitudinalFlags ) ) { $ useMinMax = false ; if ( isset ( $ latitudinalFlags [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_LATITUDINAL_FLAGS , $ latitudinalFlags [ 'min' ] , Criteria ...
Filter the query on the latitudinal_flags column
4,814
public function filterByTransversalFlags ( $ transversalFlags = null , $ comparison = null ) { if ( is_array ( $ transversalFlags ) ) { $ useMinMax = false ; if ( isset ( $ transversalFlags [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_TRANSVERSAL_FLAGS , $ transversalFlags [ 'min' ] , Criteria ...
Filter the query on the transversal_flags column
4,815
public function filterBySequencePictureUrl ( $ sequencePictureUrl = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ sequencePictureUrl ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ sequencePictureUrl ) ) { $ sequencePictureUrl = str_replace ( '*' , '%' , $ ...
Filter the query on the sequence_picture_url column
4,816
public function filterByVariationOfId ( $ variationOfId = null , $ comparison = null ) { if ( is_array ( $ variationOfId ) ) { $ useMinMax = false ; if ( isset ( $ variationOfId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_VARIATION_OF_ID , $ variationOfId [ 'min' ] , Criteria :: GREATER_EQUAL ...
Filter the query on the variation_of_id column
4,817
public function filterByStartPositionId ( $ startPositionId = null , $ comparison = null ) { if ( is_array ( $ startPositionId ) ) { $ useMinMax = false ; if ( isset ( $ startPositionId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_START_POSITION_ID , $ startPositionId [ 'min' ] , Criteria :: GR...
Filter the query on the start_position_id column
4,818
public function filterByEndPositionId ( $ endPositionId = null , $ comparison = null ) { if ( is_array ( $ endPositionId ) ) { $ useMinMax = false ; if ( isset ( $ endPositionId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_END_POSITION_ID , $ endPositionId [ 'min' ] , Criteria :: GREATER_EQUAL ...
Filter the query on the end_position_id column
4,819
public function filterByIsComposite ( $ isComposite = null , $ comparison = null ) { if ( is_string ( $ isComposite ) ) { $ isComposite = in_array ( strtolower ( $ isComposite ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( SkillVersionTableMap :: COL_IS...
Filter the query on the is_composite column
4,820
public function filterByIsMultiple ( $ isMultiple = null , $ comparison = null ) { if ( is_string ( $ isMultiple ) ) { $ isMultiple = in_array ( strtolower ( $ isMultiple ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( SkillVersionTableMap :: COL_IS_MULT...
Filter the query on the is_multiple column
4,821
public function filterByMultipleOfId ( $ multipleOfId = null , $ comparison = null ) { if ( is_array ( $ multipleOfId ) ) { $ useMinMax = false ; if ( isset ( $ multipleOfId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_MULTIPLE_OF_ID , $ multipleOfId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ ...
Filter the query on the multiple_of_id column
4,822
public function filterByGeneration ( $ generation = null , $ comparison = null ) { if ( is_array ( $ generation ) ) { $ useMinMax = false ; if ( isset ( $ generation [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_GENERATION , $ generation [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = tr...
Filter the query on the generation column
4,823
public function filterByImportance ( $ importance = null , $ comparison = null ) { if ( is_array ( $ importance ) ) { $ useMinMax = false ; if ( isset ( $ importance [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_IMPORTANCE , $ importance [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = tr...
Filter the query on the importance column
4,824
public function filterByPictureId ( $ pictureId = null , $ comparison = null ) { if ( is_array ( $ pictureId ) ) { $ useMinMax = false ; if ( isset ( $ pictureId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_PICTURE_ID , $ pictureId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; ...
Filter the query on the picture_id column
4,825
public function filterByVideoId ( $ videoId = null , $ comparison = null ) { if ( is_array ( $ videoId ) ) { $ useMinMax = false ; if ( isset ( $ videoId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_VIDEO_ID , $ videoId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset...
Filter the query on the video_id column
4,826
public function filterByTutorialId ( $ tutorialId = null , $ comparison = null ) { if ( is_array ( $ tutorialId ) ) { $ useMinMax = false ; if ( isset ( $ tutorialId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_TUTORIAL_ID , $ tutorialId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = t...
Filter the query on the tutorial_id column
4,827
public function filterByKstrukturId ( $ kstrukturId = null , $ comparison = null ) { if ( is_array ( $ kstrukturId ) ) { $ useMinMax = false ; if ( isset ( $ kstrukturId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_KSTRUKTUR_ID , $ kstrukturId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinM...
Filter the query on the kstruktur_id column
4,828
public function filterByFunctionPhaseId ( $ functionPhaseId = null , $ comparison = null ) { if ( is_array ( $ functionPhaseId ) ) { $ useMinMax = false ; if ( isset ( $ functionPhaseId [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_FUNCTION_PHASE_ID , $ functionPhaseId [ 'min' ] , Criteria :: GR...
Filter the query on the function_phase_id column
4,829
public function filterByVersionComment ( $ versionComment = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ versionComment ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ versionComment ) ) { $ versionComment = str_replace ( '*' , '%' , $ versionComment ) ; $...
Filter the query on the version_comment column
4,830
public function filterByVariationOfIdVersion ( $ variationOfIdVersion = null , $ comparison = null ) { if ( is_array ( $ variationOfIdVersion ) ) { $ useMinMax = false ; if ( isset ( $ variationOfIdVersion [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_VARIATION_OF_ID_VERSION , $ variationOfIdVer...
Filter the query on the variation_of_id_version column
4,831
public function filterByMultipleOfIdVersion ( $ multipleOfIdVersion = null , $ comparison = null ) { if ( is_array ( $ multipleOfIdVersion ) ) { $ useMinMax = false ; if ( isset ( $ multipleOfIdVersion [ 'min' ] ) ) { $ this -> addUsingAlias ( SkillVersionTableMap :: COL_MULTIPLE_OF_ID_VERSION , $ multipleOfIdVersion [...
Filter the query on the multiple_of_id_version column
4,832
public function filterByKkTrixionarySkillIds ( $ kkTrixionarySkillIds = null , $ comparison = null ) { $ key = $ this -> getAliasedColName ( SkillVersionTableMap :: COL_KK_TRIXIONARY_SKILL_IDS ) ; if ( null === $ comparison || $ comparison == Criteria :: CONTAINS_ALL ) { foreach ( $ kkTrixionarySkillIds as $ value ) { ...
Filter the query on the kk_trixionary_skill_ids column
4,833
public function filterByKkTrixionarySkillVersions ( $ kkTrixionarySkillVersions = null , $ comparison = null ) { $ key = $ this -> getAliasedColName ( SkillVersionTableMap :: COL_KK_TRIXIONARY_SKILL_VERSIONS ) ; if ( null === $ comparison || $ comparison == Criteria :: CONTAINS_ALL ) { foreach ( $ kkTrixionarySkillVers...
Filter the query on the kk_trixionary_skill_versions column
4,834
public function useSkillQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinSkill ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Skill' , '\gossi\trixionary\model\SkillQuery' ) ; }
Use the Skill relation Skill object
4,835
public function createToken ( $ user , $ ttl = 3600 ) { $ expires = time ( ) + ( int ) $ ttl ; $ hash = $ this -> getEncoder ( ) -> generateTokenValue ( get_class ( $ user ) , $ user -> getUsername ( ) , $ user -> getPassword ( ) , $ expires ) ; $ token = new Token ( ) ; $ token -> setHash ( $ hash ) ; $ token -> setEx...
Returns a token instance .
4,836
public function updateToken ( Token $ token , $ andFlush = true ) { $ this -> doctrine -> getManager ( ) -> persist ( $ token ) ; if ( $ andFlush ) { $ this -> doctrine -> getManager ( ) -> flush ( ) ; } }
Updates a Token .
4,837
public function registerModels ( $ config ) { $ userModel = array_get ( $ config , 'user' ) ; $ roleModel = array_get ( $ config , 'role' ) ; $ permissionModel = array_get ( $ config , 'permission' ) ; if ( class_exists ( $ userModel ) && method_exists ( $ userModel , 'setRoleModel' ) ) { forward_static_call_array ( [ ...
Registers the models from config .
4,838
public function createUser ( ) { $ user = parent :: createUser ( ) ; $ userStat = new UserStat ( ) ; $ user -> setUserStat ( $ userStat ) ; return $ user ; }
Returns an empty user instance
4,839
public function installDatabase ( $ email , $ verbose ) { $ em = $ this -> getEntityManager ( ) ; $ tool = new SchemaTool ( $ em ) ; if ( $ verbose ) { print_r ( "Installing database.\n" ) ; } $ classes = $ this -> getEntityMetaData ( $ em ) ; if ( $ verbose ) { print_r ( "Drop existing schema if exists.\n" ) ; } $ too...
Install the database .
4,840
protected function validateRoleParent ( array $ setUpConfig , $ roles , Role $ role ) { if ( array_key_exists ( 'parent' , $ setUpConfig ) ) { foreach ( $ roles as $ cached ) { if ( $ cached -> getName ( ) === $ setUpConfig [ 'parent' ] ) { $ role -> setParent ( $ cached ) ; } } } }
Checks if any role setup configuration includes a parent and if so retreives the parent from the roles stack and couples it with the provides role .
4,841
public function updateDatabase ( $ verbose ) { $ em = $ this -> getEntityManager ( ) ; $ tool = new SchemaTool ( $ em ) ; if ( $ verbose ) { print_r ( "Updating database.\n" ) ; } $ classes = $ this -> getEntityMetaData ( $ em ) ; if ( $ verbose ) { print_r ( "Update existing schema.\nRunning:\n" ) ; foreach ( $ tool -...
Update the database .
4,842
protected function getEntityMetaData ( ) { return [ $ this -> getEntityManager ( ) -> getMetadataFactory ( ) -> getMetadataFor ( '\JaztecAcl\Entity\Acl\Privilege' ) , $ this -> getEntityManager ( ) -> getMetadataFactory ( ) -> getMetadataFor ( '\JaztecAcl\Entity\Monitor\RequestedPrivilege' ) , $ this -> getEntityManage...
Get the metadata of all the Doctrine entities in this module .
4,843
public function addAdminUser ( $ email , $ username = 'admin' , $ password = 'admin1234' ) { $ options = $ this -> getServiceLocator ( ) -> get ( 'zfcuser_module_options' ) ; $ cost = $ options -> getPasswordCost ( ) ; $ crypt = new Bcrypt ( ) ; $ crypt -> setCost ( $ cost ) ; $ adminRole = $ this -> getEntityManager (...
Add an administration user to the database .
4,844
protected function getPath ( $ key ) { $ safeName = preg_replace ( '/[^a-zA-Z0-9\:\.\-\|\!\?\,]/us' , '_' , $ key ) ; return $ this -> path . $ this -> prefix . $ safeName . '_' . substr ( sha1 ( $ key ) , - 8 ) ; }
Returns the full path to the file for the provided key
4,845
public function fromArray ( array $ data , $ class , $ document = null , $ mode = self :: UNSERIALIZE_PATCH ) { return $ this -> unserialize ( $ data , $ class , $ document , $ mode ) ; }
This will create a document from the supplied array .
4,846
public function generate ( ) : string { $ uniqueId = uniqid ( ( string ) rand ( ) , true ) ; return ( string ) md5 ( $ uniqueId ) ; }
Simple random token generator
4,847
public function message ( $ field , $ message ) { Arguments :: define ( Boa :: string ( ) , Boa :: string ( ) ) -> check ( $ field , $ message ) ; $ this -> messages [ $ field ] = $ message ; return $ this ; }
Add a custom message for a field .
4,848
public function addProfile ( $ profileName , $ profileDef ) { $ this -> profiles [ $ profileName ] = $ profileDef instanceof \ DataFilter \ Profile ? $ profileDef : new \ DataFilter \ Profile ( $ profileDef ) ; }
Add named profile
4,849
public function setProfile ( $ profileName ) { if ( ! isset ( $ this -> profiles [ $ profileName ] ) ) { throw new \ InvalidArgumentException ( 'Profile "' . $ profileName . '" does not exist' ) ; } $ this -> currentProfile = $ profileName ; }
Set a current profile
4,850
public function run ( array $ data , $ profileName = null ) { if ( $ profileName ) { $ this -> setProfile ( $ profileName ) ; } if ( ! $ this -> currentProfile ) { throw new \ InvalidArgumentException ( "No profile set. Cannot run validation." ) ; } return $ this -> profiles [ $ this -> currentProfile ] -> run ( $ data...
Run checks for data on last profile return result object
4,851
public function initMailer ( $ options ) { $ this -> options = $ options ; if ( isset ( $ this -> options [ 'format' ] ) ) { $ this -> formatoptions = $ this -> options [ 'format' ] ; unset ( $ this -> options [ 'format' ] ) ; } if ( isset ( $ this -> options [ 'logger' ] ) ) { $ this -> setLogger ( $ this -> options [...
Init mailer . Set uo options
4,852
public function formatAndSendEmail ( $ template , $ data , $ email , $ from , $ replyto = '' , $ ccemail = '' , $ bccemail = '' , $ outtemplate = null , $ textemail = false ) { $ this -> logQ ( $ this -> formatoptions [ 'locale' ] , 'formatter' ) ; $ formatter = new EmailFormat ( $ this -> formatoptions ) ; $ templated...
Send email function . It must be defined in child classes
4,853
protected function isCorrectEmailAddress ( $ email , $ title = '' ) { if ( is_array ( $ email ) ) { $ email = $ email [ 'address' ] ; } if ( $ title == '' ) { $ title = 'Email' ; } if ( trim ( $ email ) == '' ) { throw new \ Exception ( $ title . ' address can not be empty' ) ; } if ( preg_match ( '!<.+>!' , $ email , ...
Checks email address
4,854
public function getUser ( $ email ) { $ user = $ this -> userMapper -> findByEmail ( $ email ) ; if ( ! $ user ) { return false ; } return $ user ; }
Get the user to check their credentials
4,855
public function getCreateTable ( string $ table ) : string { return ( string ) $ this -> context -> query ( 'SHOW CREATE TABLE ' . $ table ) -> fetch ( ) -> { 'Create Table' } ; }
Vrati DDL tabulky
4,856
private function createService ( string $ resolvedName , array $ options = null ) { try { if ( isset ( $ this -> delegators [ $ resolvedName ] ) ) { $ object = $ this -> createServiceFromDelegator ( $ resolvedName , $ options ) ; } else { $ object = $ this -> createServiceFromFactory ( $ resolvedName , $ options ) ; } ...
Create a new instance with an already resolved name
4,857
private function createServiceFromFactory ( string $ name , array $ options = null ) { $ factory = $ this -> factories [ $ name ] ?? null ; if ( is_string ( $ factory ) && class_exists ( $ factory ) ) { $ factory = new $ factory ( ) ; if ( $ factory instanceof FactoryInterface ) { $ this -> factories [ $ name ] = $ fac...
Get a factory for the given service name and create an object using that factory or create invokable if service is invokable
4,858
private function createServiceFromDelegator ( string $ name , array $ options = null ) { if ( $ this -> delegators [ $ name ] [ 0 ] === Proxy \ LazyServiceFactory :: class ) { return $ this -> createServiceFromLazyServiceDelegator ( $ name , $ options ) ; } $ creationCallback = $ this -> delegatorCallbackCache [ $ name...
Create a service from delegator definition
4,859
private function createServiceFromLazyServiceDelegator ( string $ name , array $ options = null ) { $ creationCallback = $ this -> delegatorCallbackCache [ $ name ] ?? null ; if ( $ creationCallback ) { $ object = $ creationCallback ( $ this -> creationContext , $ name , $ creationCallback , $ options ) ; return $ obje...
Specialized version of createServiceFromDelegator where delegator is fixed
4,860
private function registerAbstractFactories ( array $ abstractFactories ) { foreach ( $ abstractFactories as $ abstractFactory ) { if ( is_string ( $ abstractFactory ) && class_exists ( $ abstractFactory ) ) { if ( isset ( $ this -> abstractFactoryTags [ $ abstractFactory ] ) ) { continue ; } $ this -> abstractFactoryTa...
Checks if an abstract factory can deliver a service with name provided
4,861
public function transformMagicals ( array $ config ) { if ( isset ( $ config [ 'magicals' ] ) ) { foreach ( $ config [ 'magicals' ] as $ magical ) { if ( isset ( $ config [ 'services' ] [ $ magical ] ) ) { continue ; } if ( ! isset ( $ config [ 'factories' ] [ $ magical ] ) ) { $ factory = $ magical . 'Factory' ; if ( ...
Rewrite config by transforming magicals to factories and invokables
4,862
private function registerInitializers ( array $ initializers ) { foreach ( $ initializers as $ initializer ) { if ( is_string ( $ initializer ) && class_exists ( $ initializer ) ) { $ initializer = new $ initializer ( ) ; if ( ! ( $ initializer instanceof InitializerInterface ) ) { throw InvalidArgumentException :: fro...
Applies initializers to a supplied object
4,863
public function setAlias ( $ name , $ target ) { if ( isset ( $ this -> services [ $ name ] ) && ! $ this -> allowOverride ) { throw ContainerModificationsNotAllowedException :: fromExistingService ( $ name ) ; } $ this -> mapAliasToTarget ( $ name , $ target ) ; }
Add an alias .
4,864
public function setInvokableClass ( string $ name , string $ class = null ) { if ( isset ( $ this -> services [ $ name ] ) && ! $ this -> allowOverride ) { throw ContainerModificationsNotAllowedException :: fromExistingService ( $ name ) ; } $ this -> invokables [ $ name ] = $ class ?? $ name ; }
Add an invokable class mapping .
4,865
public function setFactory ( string $ name , $ factory ) { if ( isset ( $ this -> services [ $ name ] ) && ! $ this -> allowOverride ) { throw ContainerModificationsNotAllowedException :: fromExistingService ( $ name ) ; } $ this -> factories [ $ name ] = $ factory ; }
Specify a factory for a given service name .
4,866
public function mapLazyService ( string $ name , $ class = null ) { if ( isset ( $ this -> services [ $ name ] ) && ! $ this -> allowOverride ) { throw ContainerModificationsNotAllowedException :: fromExistingService ( $ name ) ; } $ this -> lazyServicesClassMap [ $ name ] = $ class ?? $ name ; $ this -> lazyServicesDe...
Create a lazy service mapping to a class .
4,867
public function addDelegator ( string $ name , $ factory ) { if ( isset ( $ this -> services [ $ name ] ) && ! $ this -> allowOverride ) { throw ContainerModificationsNotAllowedException :: fromExistingService ( $ name ) ; } $ factory = is_array ( $ factory ) ? $ factory : [ $ factory ] ; if ( isset ( $ this -> delegat...
Add a delegator or an array of delegators for a given service .
4,868
public function setService ( string $ name , $ service ) { if ( isset ( $ this -> services [ $ name ] ) && ! $ this -> allowOverride ) { throw ContainerModificationsNotAllowedException :: fromExistingService ( $ name ) ; } $ this -> services [ $ name ] = $ service ; }
Map a service .
4,869
public function setShared ( string $ name , bool $ flag ) { if ( isset ( $ this -> services [ $ name ] ) && ! $ this -> allowOverride ) { throw ContainerModificationsNotAllowedException :: fromExistingService ( $ name ) ; } $ this -> shared [ $ name ] = $ flag ; }
Add a service sharing rule .
4,870
private function mapAliasesToTargets ( ) { $ tagged = [ ] ; foreach ( $ this -> aliases as $ alias => $ target ) { if ( isset ( $ tagged [ $ alias ] ) ) { continue ; } if ( $ alias === $ target ) { throw CyclicAliasException :: fromCyclicAlias ( $ alias , $ this -> aliases ) ; } $ tCursor = $ target ; $ aCursor = $ ali...
Assuming that all provided alias keys are valid resolve them .
4,871
private function createLazyServiceDelegatorFactory ( ) { if ( $ this -> lazyServicesDelegator ) { return $ this -> lazyServicesDelegator ; } if ( empty ( $ this -> lazyServicesClassMap ) ) { throw new InvalidArgumentException ( 'Missing "class_map" config key in "lazy_services"' ) ; } $ factoryConfig = new ProxyConfigu...
Create the lazy services delegator factory .
4,872
public function create ( $ type , SourceDataFactoryInterface $ dataFactory , $ name ) { if ( is_string ( $ type ) ) { $ type = $ this -> typeRegistry -> getType ( $ type ) ; } return new Source ( $ type , $ dataFactory , $ name ) ; }
Create mapper source .
4,873
public function afterGenerate ( ) { foreach ( $ this -> extension as $ name => $ generated ) { file_put_contents ( $ this -> directory -> getRealPath ( ) . DIRECTORY_SEPARATOR . $ name . '.php' , $ generated ) ; } }
Called when generating is finished
4,874
public function getFields ( ) { $ fields = array ( ) ; foreach ( $ this -> parts as $ part ) { $ fields = array_merge ( $ fields , $ part -> getParts ( ) ) ; } return $ fields ; }
Returns all fields of the Form
4,875
public function getField ( $ groupKey , $ fieldKey ) { foreach ( $ this -> parts as $ part ) { if ( $ part -> getKey ( ) !== $ groupKey ) { continue ; } foreach ( $ part -> getParts ( ) as $ field ) { if ( $ field -> getKey ( ) !== $ fieldKey ) { continue ; } return $ field ; } } return false ; }
Returns the field for the given group and field key . Return false if the field does not exists .
4,876
public function processFormData ( WebRequest $ request , Response $ response ) { if ( ! $ request -> hasParam ( 'csrf-key' ) || ! $ request -> hasParam ( 'csrf-token' ) ) { return ; } $ key = $ request -> getParam ( 'csrf-key' ) ; $ token = $ request -> getParam ( 'csrf-token' ) ; $ sessionToken = $ request -> getSessi...
Processes all form data
4,877
public function validateFormData ( Framework $ framework ) { $ translationManager = $ framework -> getInstance ( '\\Zepi\\Core\\Language\\Manager\\TranslationManager' ) ; $ errors = array ( ) ; foreach ( $ this -> getChildrenByType ( '\\Zepi\\Web\\UserInterface\\Form\\Field\\FieldAbstract' ) as $ field ) { if ( $ field...
Validates the form data and returns an array with errors . If the array is empty there was no error .
4,878
public function generateCsrfToken ( WebRequest $ request ) { $ key = 'csrf-' . $ this -> generateHash ( 32 ) ; $ token = $ this -> generateHash ( 128 ) ; $ request -> setSessionData ( $ key , $ token ) ; return array ( 'key' => $ key , 'token' => $ token ) ; }
Generates the csrf key and token and saves them in the session data .
4,879
protected function generateHash ( $ length ) { $ token = '' ; for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ rand = mt_rand ( 0 , 35 ) ; if ( $ rand < 26 ) { $ char = chr ( ord ( 'a' ) + $ rand ) ; } else { $ char = chr ( ord ( '0' ) + $ rand - 26 ) ; } $ token .= $ char ; } return $ token ; }
Generates a random hash
4,880
public function factory ( Injector $ injector ) { $ this -> injector = $ injector ; $ this -> constructed = true ; return $ this ; }
The factory method that will be uses by the injector .
4,881
public function route ( Route $ route , $ handler ) { return parent :: route ( $ route , function ( $ request , $ parameter ) use ( $ handler ) { return $ this -> injector -> invoke ( Container :: getDependencyArray ( $ handler ) , [ 'RouteParameter' => $ parameter , 'Request' => $ request ] ) ; } ) ; }
Overload route to wrap route handler in a dependency array
4,882
public function context ( string $ prefix , $ invoker ) { return parent :: context ( $ prefix , function ( ) use ( $ invoker ) { return $ this -> injector -> invoke ( Container :: getDependencyArray ( $ handler ) , [ ] , [ $ this ] ) ; } ) ; }
Overload context to wrap invoker in a dependency array
4,883
public function otherwise ( $ handler ) { return parent :: otherwise ( function ( $ request , $ error ) use ( $ handler ) { return $ this -> injector -> invoke ( Container :: getDependencyArray ( $ handler ) , [ 'Request' => $ request , 'Error' => $ error ] ) ; } ) ; }
Overload otherwise to wrap default handlers in a dependency array
4,884
public function handle ( Request $ request ) : Response { if ( ! $ this -> constructed ) { throw new LogicException ( 'You cant call handle in config state.' ) ; } return parent :: handle ( $ request ) ; }
Overload handle to ensure that this method is only called on an instance and not on the provider .
4,885
public static function createSymlink ( $ symlinkTarget , $ symlinkName ) { if ( false === @ symlink ( $ symlinkTarget , $ symlinkName ) ) { throw new \ Exception ( "An error occurred while creating symlink" . $ symlinkName ) ; } if ( false === $ target = readlink ( $ symlinkName ) ) { throw new \ Exception ( "Symlink $...
Create the symlink .
4,886
public static function createMirror ( $ symlinkTarget , $ symlinkName ) { $ filesystem = new Filesystem ( ) ; $ filesystem -> mkdir ( $ symlinkName ) ; $ filesystem -> mirror ( realpath ( $ symlinkName . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $ symlinkTarget ) , $ symlinkName , null , array ( 'copy_on_windo...
Create the directory mirror .
4,887
protected function importRootParagraph ( DOMElement $ paragraphNode , ZipArchive $ zip , array & $ paragraphIdMap , array $ domains , $ dbSchema ) { return $ this -> saveParagraphStructure ( $ this -> loadParagraphStructure ( $ paragraphNode , $ zip , $ domains , $ dbSchema ) , $ paragraphIdMap ) ; }
Import root - paragraph from its node
4,888
protected function loadParagraphStructure ( DOMElement $ paragraphNode , ZipArchive $ zip , array $ domains , $ dbSchema , & $ offset = 1 ) { $ offset = ( ( int ) $ offset ) ? : 1 ; $ structure = array ( 'id' => $ paragraphNode -> getAttribute ( 'id' ) , 'type' => $ paragraphNode -> getAttribute ( 'type' ) , 'name' => ...
Load paragraph structure from its node
4,889
protected function saveParagraphStructure ( array $ structure , array & $ paragraphIdMap , $ rootId = null ) { $ model = $ this -> getParagraphModel ( ) ; $ paragraph = $ model -> saveRawData ( array ( 'type' => $ structure [ 'type' ] , 'name' => $ structure [ 'name' ] , 'left' => $ structure [ 'left' ] , 'right' => $ ...
Save paragraph structure to database
4,890
protected function importCustomizeRule ( $ rootParagraphId , DOMElement $ ruleNode , ZipArchive $ zip , array $ paragraphIdMap , array $ domains , $ dbSchema ) { $ properties = array ( ) ; $ model = $ this -> getSheetModel ( ) ; $ mapper = $ model -> getMapper ( ) -> getRuleMapper ( ) ; $ media = $ ruleNode -> getAttri...
Import customize - rule from its node
4,891
protected function importCustomizeExtra ( $ rootParagraphId , $ extra ) { $ model = $ this -> getSheetModel ( ) ; $ mapper = $ model -> getMapper ( ) -> getExtraMapper ( ) ; $ extra = $ mapper -> create ( array ( 'rootParagraphId' => $ rootParagraphId , 'extra' => $ extra , ) ) ; return $ extra -> save ( ) ; }
Import customize - extra from its content
4,892
public function processCustomizeRuleSelector ( $ selector , array $ paragraphIdMap ) { return preg_replace_callback ( '/#paragraph-(-?\d+)/' , function ( $ matches ) use ( $ paragraphIdMap ) { $ id = ( string ) ( int ) $ matches [ 1 ] ; if ( isset ( $ paragraphIdMap [ $ id ] ) ) { $ id = $ paragraphIdMap [ $ id ] ; } r...
Process a customize - rule s selector
4,893
protected function splitKeys ( $ masterKey ) { return [ hash_hmac ( $ this -> hashAlgo , 'ENCRYPTION' , $ masterKey , true ) , hash_hmac ( $ this -> hashAlgo , 'AUTHENTICATION' , $ masterKey , true ) ] ; }
HKDF for keys derivation .
4,894
protected function hashEquals ( $ a , $ b ) { if ( function_exists ( 'hash_equals' ) ) { return hash_equals ( $ a , $ b ) ; } $ nonce = openssl_random_pseudo_bytes ( 32 ) ; return hash_hmac ( $ this -> hashAlgo , $ a , $ nonce ) === hash_hmac ( $ this -> hashAlgo , $ b , $ nonce ) ; }
Tests whether the provided hashes are equal
4,895
public static function getBasename ( $ class ) { if ( is_object ( $ class ) === true ) { $ class = get_class ( $ class ) ; } foreach ( [ '\\' , '_' ] as $ separator ) { $ pos = strrpos ( $ class , $ separator ) ; if ( $ pos !== false ) { return substr ( $ class , $ pos + 1 ) ; } } return $ class ; }
Get the basename of a class .
4,896
public static function getNamespace ( $ class ) { if ( is_object ( $ class ) === true ) { $ class = get_class ( $ class ) ; } foreach ( [ '\\' , '_' ] as $ separator ) { $ pos = strrpos ( $ class , $ separator ) ; if ( $ pos !== false ) { return ltrim ( substr ( $ class , 0 , $ pos ) , $ separator ) ; } } return '' ; }
Get the namespace of a class .
4,897
protected function chainAdd ( $ method , $ arguments = [ ] ) { $ this -> chain [ ] = [ 'method' => $ method , 'arguments' => $ arguments , ] ; if ( $ this -> promise !== null ) { $ chain = $ this -> chain ; $ this -> chain = [ ] ; static :: chainApply ( $ this -> promise , $ chain ) ; return $ this -> promise ; } retur...
Add lazy method to chain
4,898
protected static function chainApply ( & $ promise , $ chain = [ ] ) { foreach ( $ chain as $ row ) { $ promise = call_user_func_array ( [ $ promise , $ row [ 'method' ] ] , $ row [ 'arguments' ] ) ; } }
Apply stored chain to promise
4,899
public function moveFile ( $ fileName , $ destinationName ) { return move_uploaded_file ( $ this -> getPathBase ( ) . $ fileName , $ this -> getPathBase ( ) . $ destinationName ) ; }
Mueve un archivo a otra ubicacion