idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
21,400
public function updateLineages ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doUpdateLineages ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_LINEAGES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_LINEAGES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Updates Lineages on Skill
21,401
public function updateMultiples ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doUpdateMultiples ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_MULTIPLES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_MULTIPLES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Updates Multiples on Skill
21,402
public function updateParents ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doUpdateParent ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_CHILDREN_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_CHILDREN_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Updates Parents on Skill
21,403
public function updateParts ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doUpdateParts ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_PARTS_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_PARTS_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Updates Parts on Skill
21,404
public function updatePictures ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doUpdatePictures ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_PICTURES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_PICTURES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Updates Pictures on Skill
21,405
public function updateReferences ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doUpdateReferences ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_REFERENCES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_REFERENCES_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Updates References on Skill
21,406
public function updateVariations ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Skill not found.' ] ) ; } try { $ this -> doUpdateVariations ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e -> getErrors ( ) ] ) ; } $ this -> dispatch ( SkillEvent :: PRE_VARIATIONS_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: PRE_SAVE , $ model , $ data ) ; $ rows = $ model -> save ( ) ; $ this -> dispatch ( SkillEvent :: POST_VARIATIONS_UPDATE , $ model , $ data ) ; $ this -> dispatch ( SkillEvent :: POST_SAVE , $ model , $ data ) ; if ( $ rows > 0 ) { return Updated ( [ 'model' => $ model ] ) ; } return NotUpdated ( [ 'model' => $ model ] ) ; }
Updates Variations on Skill
21,407
protected function doAddChildren ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addSkillRelatedByDependencyId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Children to Skill
21,408
protected function doAddComposites ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addSkillRelatedByCompositeId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Composites to Skill
21,409
protected function doAddFunctionPhases ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for FunctionPhase' ; } else { $ related = FunctionPhaseQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addFunctionPhase ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add FunctionPhases to Skill
21,410
protected function doAddGroups ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Group' ; } else { $ related = GroupQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addGroup ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Groups to Skill
21,411
protected function doAddKstrukturs ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Kstruktur' ; } else { $ related = KstrukturQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addKstruktur ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Kstrukturs to Skill
21,412
protected function doAddLineages ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Lineage' ; } else { $ related = LineageQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addLineage ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Lineages to Skill
21,413
protected function doAddMultiples ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addMultiple ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Multiples to Skill
21,414
protected function doAddParents ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addSkillRelatedByParentId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Parents to Skill
21,415
protected function doAddParts ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addSkillRelatedByPartId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Parts to Skill
21,416
protected function doAddPictures ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Picture' ; } else { $ related = PictureQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addPicture ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Pictures to Skill
21,417
protected function doAddReferences ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Reference' ; } else { $ related = ReferenceQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addReference ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add References to Skill
21,418
protected function doAddVariations ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addVariation ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to add Variations to Skill
21,419
protected function doRemoveFunctionPhases ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for FunctionPhase' ; } else { $ related = FunctionPhaseQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeFunctionPhase ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove FunctionPhases from Skill
21,420
protected function doRemoveGroups ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Group' ; } else { $ related = GroupQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeGroup ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Groups from Skill
21,421
protected function doRemoveKstrukturs ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Kstruktur' ; } else { $ related = KstrukturQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeKstruktur ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Kstrukturs from Skill
21,422
protected function doRemoveLineages ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Lineage' ; } else { $ related = LineageQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeLineage ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Lineages from Skill
21,423
protected function doRemoveMultiples ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeMultiple ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Multiples from Skill
21,424
protected function doRemoveParents ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeSkillRelatedByDependencyId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Parents from Skill
21,425
protected function doRemoveParts ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeSkillRelatedByPartId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Parts from Skill
21,426
protected function doRemovePictures ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Picture' ; } else { $ related = PictureQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removePicture ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Pictures from Skill
21,427
protected function doRemoveReferences ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Reference' ; } else { $ related = ReferenceQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeReference ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove References from Skill
21,428
protected function doRemoveVariations ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeVariation ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Variations from Skill
21,429
protected function doRemoveVideos ( Skill $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Video' ; } else { $ related = VideoQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeVideo ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Videos from Skill
21,430
protected function doSetEndPositionId ( Skill $ model , $ relatedId ) { if ( $ model -> getEndPositionId ( ) !== $ relatedId ) { $ model -> setEndPositionId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the EndPosition id
21,431
protected function doSetFeaturedPictureId ( Skill $ model , $ relatedId ) { if ( $ model -> getPictureId ( ) !== $ relatedId ) { $ model -> setPictureId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the FeaturedPicture id
21,432
protected function doSetFeaturedTutorialId ( Skill $ model , $ relatedId ) { if ( $ model -> getTutorialId ( ) !== $ relatedId ) { $ model -> setTutorialId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the FeaturedTutorial id
21,433
protected function doSetFeaturedVideoId ( Skill $ model , $ relatedId ) { if ( $ model -> getVideoId ( ) !== $ relatedId ) { $ model -> setVideoId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the FeaturedVideo id
21,434
protected function doSetFunctionPhaseRootId ( Skill $ model , $ relatedId ) { if ( $ model -> getFunctionPhaseId ( ) !== $ relatedId ) { $ model -> setFunctionPhaseId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the FunctionPhaseRoot id
21,435
protected function doSetKstrukturRootId ( Skill $ model , $ relatedId ) { if ( $ model -> getKstrukturId ( ) !== $ relatedId ) { $ model -> setKstrukturId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the KstrukturRoot id
21,436
protected function doSetMultipleOfId ( Skill $ model , $ relatedId ) { if ( $ model -> getMultipleOfId ( ) !== $ relatedId ) { $ model -> setMultipleOfId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the MultipleOf id
21,437
protected function doSetObjectId ( Skill $ model , $ relatedId ) { if ( $ model -> getObjectId ( ) !== $ relatedId ) { $ model -> setObjectId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the Object id
21,438
protected function doSetStartPositionId ( Skill $ model , $ relatedId ) { if ( $ model -> getStartPositionId ( ) !== $ relatedId ) { $ model -> setStartPositionId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the StartPosition id
21,439
protected function doSetVariationOfId ( Skill $ model , $ relatedId ) { if ( $ model -> getVariationOfId ( ) !== $ relatedId ) { $ model -> setVariationOfId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the VariationOf id
21,440
protected function doUpdateChildren ( Skill $ model , $ data ) { SkillDependencyQuery :: create ( ) -> filterBySkillRelatedByParentId ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addSkillRelatedByDependencyId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Children on Skill
21,441
protected function doUpdateComposites ( Skill $ model , $ data ) { SkillPartQuery :: create ( ) -> filterBySkillRelatedByPartId ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addSkillRelatedByCompositeId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Composites on Skill
21,442
protected function doUpdateFunctionPhases ( Skill $ model , $ data ) { FunctionPhaseQuery :: create ( ) -> filterBySkill ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for FunctionPhase' ; } else { $ related = FunctionPhaseQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addFunctionPhase ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of FunctionPhases on Skill
21,443
protected function doUpdateGroups ( Skill $ model , $ data ) { SkillGroupQuery :: create ( ) -> filterBySkill ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Group' ; } else { $ related = GroupQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addGroup ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Groups on Skill
21,444
protected function doUpdateKstrukturs ( Skill $ model , $ data ) { KstrukturQuery :: create ( ) -> filterBySkill ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Kstruktur' ; } else { $ related = KstrukturQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addKstruktur ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Kstrukturs on Skill
21,445
protected function doUpdateLineages ( Skill $ model , $ data ) { LineageQuery :: create ( ) -> filterByAncestor ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Lineage' ; } else { $ related = LineageQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addLineage ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Lineages on Skill
21,446
protected function doUpdateMultiples ( Skill $ model , $ data ) { SkillQuery :: create ( ) -> filterByMultipleOf ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addMultiple ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Multiples on Skill
21,447
protected function doUpdateParents ( Skill $ model , $ data ) { SkillDependencyQuery :: create ( ) -> filterBySkillRelatedByDependencyId ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addSkillRelatedByParentId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Parents on Skill
21,448
protected function doUpdateParts ( Skill $ model , $ data ) { SkillPartQuery :: create ( ) -> filterBySkillRelatedByCompositeId ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addSkillRelatedByPartId ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Parts on Skill
21,449
protected function doUpdatePictures ( Skill $ model , $ data ) { PictureQuery :: create ( ) -> filterBySkill ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Picture' ; } else { $ related = PictureQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addPicture ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Pictures on Skill
21,450
protected function doUpdateReferences ( Skill $ model , $ data ) { SkillReferenceQuery :: create ( ) -> filterBySkill ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Reference' ; } else { $ related = ReferenceQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addReference ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of References on Skill
21,451
protected function doUpdateVariations ( Skill $ model , $ data ) { SkillQuery :: create ( ) -> filterByVariationOf ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addVariation ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Variations on Skill
21,452
protected function doUpdateVideos ( Skill $ model , $ data ) { VideoQuery :: create ( ) -> filterBySkill ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Video' ; } else { $ related = VideoQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addVideo ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Videos on Skill
21,453
public function _post_gallery ( $ output , $ attr , $ instance ) { $ post = get_post ( ) ; if ( ! empty ( $ attr [ 'ids' ] ) ) { if ( empty ( $ attr [ 'orderby' ] ) ) { $ attr [ 'orderby' ] = 'post__in' ; } $ attr [ 'include' ] = $ attr [ 'ids' ] ; } $ atts = shortcode_atts ( [ 'id' => $ post ? $ post -> ID : 0 , 'link' => '' , 'size' => 'thumbnail' , 'columns' => 3 , 'order' => 'ASC' , 'orderby' => 'menu_order ID' , 'include' => '' , ] , $ attr ) ; $ pot_id = intval ( $ atts [ 'id' ] ) ; if ( ! empty ( $ atts [ 'include' ] ) ) { $ attachments = get_posts ( array ( 'include' => $ atts [ 'include' ] , 'post_status' => 'inherit' , 'post_type' => 'attachment' , 'post_mime_type' => 'image' , 'order' => $ atts [ 'order' ] , 'orderby' => $ atts [ 'orderby' ] , ) ) ; } else { $ attachments = get_children ( array ( 'post_parent' => $ pot_id , 'post_status' => 'inherit' , 'post_type' => 'attachment' , 'post_mime_type' => 'image' , 'order' => $ atts [ 'order' ] , 'orderby' => $ atts [ 'orderby' ] , ) ) ; } if ( empty ( $ attachments ) ) { return '' ; } if ( is_feed ( ) ) { return $ this -> _render ( 'feed' , array ( 'attachments' => $ attachments , ) ) ; } return $ this -> _render ( 'pure-css-gallery' , array ( 'attachments' => array_values ( $ attachments ) , 'atts' => $ atts , ) ) ; }
Filters the default gallery shortcode output
21,454
public function _tiny_mce_before_init ( $ mce_init ) { $ styles = '#tinymce .wpview .gallery { margin: 0; display: block; border: 2px solid #666; text-align: center; height: 80px; }' ; $ styles .= '#tinymce .wpview .gallery > * { display: none; }' ; $ styles .= '#tinymce .wpview .gallery::before { margin-top: 20px; display: inline-block; content: \'\\\\f161\'; font-family: dashicons; font-size: 18px; color: #666 }' ; if ( isset ( $ mce_init [ 'content_style' ] ) ) { $ mce_init [ 'content_style' ] .= $ styles ; } else { $ mce_init [ 'content_style' ] = $ styles ; } return $ mce_init ; }
Change style of gallery in wysiwyg
21,455
public function init ( ) { if ( ! isset ( Yii :: $ app -> params [ 'user.emailCaptchaExpire' ] ) ) { Yii :: $ app -> params [ 'user.emailCaptchaExpire' ] = $ this -> expire ; } $ this -> expire = Yii :: $ app -> params [ 'user.emailCaptchaExpire' ] ; $ data = Yii :: $ app -> request -> post ( Yii :: $ app -> request -> get ( 'formName' , '' ) , [ ] ) ; $ this -> email = ArrayHelper :: getValue ( $ data , 'email' ) ; }
Initializes the action .
21,456
public static function Fal03 ( $ t ) { $ a ; $ a = fmod ( 485868.249036 + $ t * ( 1717915923.2178 + $ t * ( 31.8792 + $ t * ( 0.051635 + $ t * ( - 0.00024470 ) ) ) ) , TURNAS ) * DAS2R ; return $ a ; }
- - - - - - - - - i a u F a l 0 3 - - - - - - - - -
21,457
public static function Ee00 ( $ date1 , $ date2 , $ epsa , $ dpsi ) { $ ee ; $ ee = $ dpsi * cos ( $ epsa ) + IAU :: Eect00 ( $ date1 , $ date2 ) ; return $ ee ; }
- - - - - - - - i a u E e 0 0 - - - - - - - -
21,458
protected function datepickerField ( ) { if ( isset ( $ this -> htmlOptions [ 'options' ] ) ) { $ options = $ this -> htmlOptions [ 'options' ] ; unset ( $ this -> htmlOptions [ 'options' ] ) ; } if ( isset ( $ this -> htmlOptions [ 'events' ] ) ) { $ events = $ this -> htmlOptions [ 'events' ] ; unset ( $ this -> htmlOptions [ 'events' ] ) ; } echo $ this -> getLabel ( ) ; echo $ this -> getPrepend ( ) ; $ this -> widget ( 'bootstrap.widgets.CiiDatePicker' , array ( 'model' => $ this -> model , 'attribute' => $ this -> attribute , 'options' => isset ( $ options ) ? $ options : array ( ) , 'events' => isset ( $ events ) ? $ events : array ( ) , 'htmlOptions' => $ this -> htmlOptions , ) ) ; echo $ this -> getAppend ( ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; }
Renders a datepicker field .
21,459
protected function redactorJs ( ) { if ( isset ( $ this -> htmlOptions [ 'options' ] ) ) { $ options = $ this -> htmlOptions [ 'options' ] ; unset ( $ this -> htmlOptions [ 'options' ] ) ; } if ( isset ( $ this -> htmlOptions [ 'width' ] ) ) { $ width = $ this -> htmlOptions [ 'width' ] ; unset ( $ this -> htmlOptions [ 'width' ] ) ; } if ( isset ( $ this -> htmlOptions [ 'height' ] ) ) { $ height = $ this -> htmlOptions [ 'height' ] ; unset ( $ this -> htmlOptions [ 'height' ] ) ; } echo $ this -> getLabel ( ) ; $ this -> widget ( 'bootstrap.widgets.CiiRedactorJs' , array ( 'model' => $ this -> model , 'attribute' => $ this -> attribute , 'editorOptions' => isset ( $ options ) ? $ options : array ( ) , 'width' => isset ( $ width ) ? $ width : '100%' , 'height' => isset ( $ height ) ? $ height : '400px' , 'htmlOptions' => $ this -> htmlOptions ) ) ; echo $ this -> getError ( ) . $ this -> getHint ( ) ; }
Renders a redactorJs .
21,460
public static function GetClientIpEnvironnement ( ) { $ ipaddress = '' ; if ( getenv ( 'HTTP_CLIENT_IP' ) ) $ ipaddress = getenv ( 'HTTP_CLIENT_IP' ) ; else if ( getenv ( 'HTTP_X_FORWARDED_FOR' ) ) $ ipaddress = getenv ( 'HTTP_X_FORWARDED_FOR' ) ; else if ( getenv ( 'HTTP_X_FORWARDED' ) ) $ ipaddress = getenv ( 'HTTP_X_FORWARDED' ) ; else if ( getenv ( 'HTTP_FORWARDED_FOR' ) ) $ ipaddress = getenv ( 'HTTP_FORWARDED_FOR' ) ; else if ( getenv ( 'HTTP_FORWARDED' ) ) $ ipaddress = getenv ( 'HTTP_FORWARDED' ) ; else if ( getenv ( 'REMOTE_ADDR' ) ) $ ipaddress = getenv ( 'REMOTE_ADDR' ) ; else $ ipaddress = 'UNKNOWN' ; return $ ipaddress ; }
Get the client ip from the environnement .
21,461
public static function GetClientIpServer ( ) { $ ipaddress = '' ; if ( $ _SERVER [ 'HTTP_CLIENT_IP' ] ) $ ipaddress = $ _SERVER [ 'HTTP_CLIENT_IP' ] ; else if ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) $ ipaddress = $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ; else if ( $ _SERVER [ 'HTTP_X_FORWARDED' ] ) $ ipaddress = $ _SERVER [ 'HTTP_X_FORWARDED' ] ; else if ( $ _SERVER [ 'HTTP_FORWARDED_FOR' ] ) $ ipaddress = $ _SERVER [ 'HTTP_FORWARDED_FOR' ] ; else if ( $ _SERVER [ 'HTTP_FORWARDED' ] ) $ ipaddress = $ _SERVER [ 'HTTP_FORWARDED' ] ; else if ( $ _SERVER [ 'REMOTE_ADDR' ] ) $ ipaddress = $ _SERVER [ 'REMOTE_ADDR' ] ; else $ ipaddress = 'UNKNOWN' ; return $ ipaddress ; }
Get the client ip from the server global variable .
21,462
public function details ( Model $ Model , $ queryData = null , $ schema = false , $ format = true ) { $ DetailModel = ClassRegistry :: init ( $ this -> settings [ $ Model -> alias ] [ 'alias' ] ) ; if ( is_string ( $ queryData ) ) { $ queryData = array ( 'section' => $ queryData ) ; } $ conditions = array ( $ DetailModel -> alias . '.foreign_key' => $ Model -> getID ( ) ) ; if ( ! empty ( $ queryData [ 'section' ] ) ) { $ section = $ queryData [ 'section' ] ; $ conditions [ $ DetailModel -> alias . '.field LIKE' ] = $ section . '.%' ; unset ( $ queryData [ 'section' ] ) ; } if ( ! empty ( $ queryData [ 'conditions' ] ) ) { $ queryData [ 'conditions' ] = Hash :: merge ( $ conditions , $ queryData [ 'conditions' ] ) ; } $ fields = array ( $ DetailModel -> alias . '.field' , $ DetailModel -> alias . '.value' , $ DetailModel -> alias . '.label' , 'foreign_key' , 'foreign_model' ) ; if ( $ schema ) { $ fields = array ( $ DetailModel -> alias . '.field' , $ DetailModel -> alias . '.input' , $ DetailModel -> alias . '.data_type' , $ DetailModel -> alias . '.label' ) ; } $ order = array ( 'position' => 'ASC' ) ; $ recursive = - 1 ; $ results = $ DetailModel -> find ( 'all' , array_merge ( compact ( 'conditions' , 'fields' , 'order' , 'recursive' ) , $ queryData ) ) ; return $ this -> detailsExtractSections ( $ Model , $ results , $ section , $ schema , $ format ) ; }
Custom method to find all attached details or by section .
21,463
protected function setActiveDatabaseEncoding ( & $ encoding ) { if ( stristr ( 'pdo:mysql|mysqli' , Config :: get ( 'Database' , 'database' ) [ 'driver' ] ) ) { $ encoding = $ this -> db -> encoding ( ) ; } else { $ encoding = NULL ; } }
Protected set active database encoding
21,464
protected function addIdColumnToActiveTableIfNotExists ( & $ activeTable ) { if ( ! array_key_exists ( 'id' , $ activeTable ) ) { $ activeTable = array_merge ( [ 'id' => [ $ this -> db -> int ( 11 ) , $ this -> db -> notNull ( ) , $ this -> db -> autoIncrement ( ) , $ this -> db -> primaryKey ( ) ] ] , $ activeTable ) ; } }
Protected add id column to active table if not exists
21,465
protected function getActiveTableKeyAndColumns ( $ columns , & $ tableKey , & $ tableColumns ) { $ pregGrepArray = preg_grep ( '/_000/' , $ columns ) ; $ tableKey = strtolower ( current ( $ pregGrepArray ) ) ; $ tableColumns = Arrays \ RemoveElement :: element ( $ columns , $ pregGrepArray ) ; }
Protected active table key and columns
21,466
protected function dropColumnFromActiveTable ( $ table , $ key , $ dbForge , & $ status ) { $ dbForge -> dropColumn ( $ table , $ key ) ; $ status = true ; }
Protected drop column from active table
21,467
protected function modifyColumnFromActiveTable ( $ table , $ key , $ val , $ dbForge , & $ status , $ active , $ current ) { if ( $ active !== $ current ) { $ dbForge -> modifyColumn ( $ table , [ $ key => $ val ] ) ; $ status = true ; } else { $ status = false ; } }
Protected modify column from active table
21,468
protected function addColumnFromActiveTable ( $ table , $ key , $ val , $ dbForge , & $ status ) { $ dbForge -> addColumn ( $ table , [ $ key => $ val ] ) ; $ status = true ; }
Protected add column from active table
21,469
protected function active ( ) { if ( empty ( $ activeDatabaseList = $ this -> getActiveDatabaseList ( ) ) ) { return false ; } $ this -> setActiveDatabaseEncoding ( $ encoding ) ; $ status = false ; $ tableKeyColumnDesignData = $ this -> getTableKeyColumnDesignData ( ) ; foreach ( $ activeDatabaseList as $ database ) { $ this -> forge -> createDatabase ( $ database , $ encoding ) ; if ( ! empty ( $ activeTableList = $ this -> getTableListByActiveDatabase ( $ database ) ) ) { $ dbForge = $ this -> getDBForgeDifferentConnectionByDatabaseName ( $ database ) ; $ db = $ this -> getDBDifferentConnectionByDatabaseName ( $ database ) ; foreach ( $ activeTableList as $ table ) { $ activeTableColumnSchema = $ this -> getActiveTableColumnSchema ( $ database , $ table ) ; $ this -> addIdColumnToActiveTableIfNotExists ( $ activeTableColumnSchema ) ; $ activeTableColumns = $ this -> getActiveTableColumns ( $ table = $ this -> getTableNameWithoutExtension ( $ table ) , $ db ) ; $ this -> getActiveTableKeyAndColumns ( $ activeTableColumns , $ activeTableKey , $ activeTableColumns ) ; $ currentTableKey = $ this -> getCurrentTableKey ( $ table , $ activeTableColumnSchema ) ; if ( ! empty ( $ activeTableColumns ) ) { $ columnsMerge = array_merge ( array_flip ( $ activeTableColumns ) , $ activeTableColumnSchema ) ; foreach ( $ columnsMerge as $ key => $ val ) { if ( is_numeric ( $ val ) ) { $ this -> dropColumnFromActiveTable ( $ table , $ key , $ dbForge , $ status ) ; } elseif ( in_array ( $ key , $ activeTableColumns ) ) { $ this -> modifyColumnFromActiveTable ( $ table , $ key , $ val , $ dbForge , $ status , $ activeTableKey , $ currentTableKey ) ; } else { $ this -> addColumnFromActiveTable ( $ table , $ key , $ val , $ dbForge , $ status ) ; } } if ( $ status === true ) { $ this -> addTableToArchive ( $ database , $ table ) ; } } else { $ activeTableColumnSchema [ $ currentTableKey ] = $ tableKeyColumnDesignData ; $ dbForge -> createTable ( $ table , $ activeTableColumnSchema ) ; } } } } }
Protected Actives Databases
21,470
protected function addTableToArchive ( $ database , $ table ) { $ this -> createArchiveDatabaseDirectoryIfNotExists ( $ database ) ; file_put_contents ( $ this -> getArchiveTableFilePath ( $ path = $ database . '/' . $ table ) , $ this -> getActiveTableFileContent ( $ path ) ) ; }
Protected add table to archive
21,471
protected function createArchiveDatabaseDirectoryIfNotExists ( $ database ) { $ path = $ this -> archivesPath . $ database . '/' ; if ( ! is_dir ( $ path ) ) { Filesystem :: createFolder ( $ path ) ; } }
Protected create archive database directory if not exists
21,472
protected function getArchiveDatabaseTableList ( $ database ) { $ databasePath = $ this -> archivesPath . $ database . '/' ; $ tables = Filesystem :: getFiles ( $ databasePath , 'php' ) ; $ pregGrep = preg_grep ( "/\_[0-9]*\.php/" , $ tables ) ; return Arrays \ RemoveElement :: element ( $ tables , $ pregGrep ) ; }
Protected get archive database table list
21,473
protected function archive ( ) { if ( $ archiveDatabaseList = $ this -> getArchiveDatabaseList ( ) ) { foreach ( $ archiveDatabaseList as $ database ) { if ( ! empty ( $ tables = $ this -> getArchiveDatabaseTableList ( $ database ) ) ) { $ dbForge = $ this -> getDBForgeDifferentConnectionByDatabaseName ( $ database ) ; foreach ( $ tables as $ table ) { $ dbForge -> dropTable ( $ this -> getTableNameWithoutExtension ( $ table ) ) ; } } $ tool = $ this -> getDBToolDifferentConnectionByDatabaseName ( $ database ) ; if ( empty ( $ tool -> listTables ( ) ) ) { $ this -> forge -> dropDatabase ( $ database ) ; } } return true ; } return false ; }
Protected Archives Database
21,474
public function setDescription ( $ description = null ) { if ( $ this -> getMajorProtocolVersion ( ) >= 2 ) { $ this -> setSummary ( $ description ) ; } else { $ this -> _description = $ description ; } return $ this ; }
Sets the description relating to the playlist .
21,475
public function getPlaylistVideoFeedUrl ( ) { if ( $ this -> getMajorProtocolVersion ( ) >= 2 ) { return $ this -> getContent ( ) -> getSrc ( ) ; } else { return $ this -> getFeedLink ( Zend_Gdata_YouTube :: PLAYLIST_REL ) -> href ; } }
Returns the URL of the playlist video feed
21,476
public function selective_refresh ( WP_Customize_Manager $ wp_customize ) { $ wp_customize -> get_setting ( 'blogname' ) -> transport = 'postMessage' ; $ wp_customize -> get_setting ( 'blogdescription' ) -> transport = 'postMessage' ; $ wp_customize -> get_setting ( 'header_textcolor' ) -> transport = 'postMessage' ; if ( ! isset ( $ wp_customize -> selective_refresh ) ) { return ; } $ wp_customize -> selective_refresh -> add_partial ( 'blogname' , array ( 'selector' => '.site-title a' , 'container_inclusive' => false , 'render_callback' => array ( $ this , 'blogname' ) , ) ) ; $ wp_customize -> selective_refresh -> add_partial ( 'blogdescription' , array ( 'selector' => '.site-description' , 'container_inclusive' => false , 'render_callback' => array ( $ this , 'blogdescription' ) , ) ) ; }
Adds postMessage support for site title and description for the Customizer .
21,477
public static function parse_css_rules ( array $ rules ) { ob_start ( ) ; foreach ( $ rules as $ rule => $ properties ) { printf ( "%s {\n" , implode ( ",\n" , array_map ( 'trim' , explode ( ',' , $ rule ) ) ) ) ; foreach ( $ properties as $ property => $ value ) { printf ( "\t%s: %s;\n" , $ property , $ value ) ; } echo "}\n" ; } return ob_get_clean ( ) ; }
Return an array of CSS rules as plain CSS .
21,478
public static function column ( $ array , string $ column , bool $ filter = true ) : array { if ( ! is_array ( $ array ) && ! $ array instanceof \ Traversable ) { throw new \ Exception ( sprintf ( 'Array or instance of Traversable expected, "%s" given' , gettype ( $ array ) ) ) ; } $ filterFunc = function ( array $ result ) use ( $ filter ) { return $ filter ? array_filter ( $ result , function ( $ item ) : bool { return null !== $ item ; } ) : $ result ; } ; if ( is_array ( $ array ) && 0 < count ( $ array ) ) { reset ( $ array ) ; if ( is_array ( $ array [ key ( $ array ) ] ) ) { return $ filterFunc ( array_column ( $ array , $ column ) ) ; } } $ accessor = PropertyAccess :: createPropertyAccessor ( ) ; $ result = [ ] ; foreach ( $ array as $ item ) { $ check = $ column ; if ( ( is_array ( $ item ) || $ item instanceof \ ArrayAccess ) && '[' !== $ column [ 0 ] ) { $ check = '[' . $ column . ']' ; } $ result [ ] = $ accessor -> getValue ( $ item , $ check ) ; } return $ filterFunc ( $ result ) ; }
Returns a specific column from an array .
21,479
public function executePipeline ( $ pipeline , Request $ request , Response $ response = null ) { $ relayBuilder = new \ Relay \ RelayBuilder ( $ this -> resolver ) ; $ relay = $ relayBuilder -> newInstance ( $ pipeline ) ; return $ relay ( $ request , $ response ) ; }
Trigger execution of the supplied pipeline through Relay .
21,480
public function rule ( $ key , $ regex ) { if ( ! array_key_exists ( $ key , $ this -> rules ) ) $ this -> rules [ $ key ] = $ regex ; }
aggiungi una nuova regola
21,481
public function namespace ( $ key , $ value ) { if ( ! array_key_exists ( $ key , $ this -> namespaces ) ) $ this -> namespaces [ $ key ] = $ value ; }
aggiungi un nuovo namespace
21,482
public function map ( $ method , $ action , $ callback ) { $ route = new Route ( $ method , $ action , $ callback ) ; array_push ( $ this -> routes , $ route ) ; return $ route ; }
mappature delle richieste
21,483
public function uri ( ) { $ basepath = implode ( '/' , array_slice ( explode ( '/' , $ _SERVER [ 'SCRIPT_NAME' ] ) , 0 , - 1 ) ) . '/' ; $ uri = substr ( $ _SERVER [ 'REQUEST_URI' ] , strlen ( $ basepath ) ) ; if ( strstr ( $ uri , '?' ) ) $ uri = substr ( $ uri , 0 , strpos ( $ uri , '?' ) ) ; $ uri = '/' . trim ( $ uri , '/' ) ; return $ uri ; }
ritorna l uri corrente
21,484
public function dispatch ( ) { $ current_uri = $ this -> base_uri ( ) ; $ current_method = $ this -> method ( ) ; foreach ( $ this -> routes as $ route ) { if ( $ route -> match ( $ current_uri , $ current_method , $ this -> rules ) ) { return $ route -> call ( $ this -> namespaces ) ; } } return false ; }
elaborazione della richiesta dell utente
21,485
public function call ( $ params = null ) { $ method = $ this -> method ; if ( ! empty ( $ this -> constructor_arguments ) ) { $ instance = new $ this -> class ( $ this -> constructor_arguments ) ; } else { $ instance = new $ this -> class ( ) ; } if ( ! is_null ( $ params ) ) { return $ instance -> $ method ( $ params ) ; } return $ instance -> $ method ( ) ; }
Calls the requested class and method name passing in the optional arguments .
21,486
private function extract ( $ handler ) { if ( is_array ( $ handler ) ) { return $ this -> fromClassMethodArray ( $ handler ) ; } if ( strpos ( $ handler , self :: CHAR_AT ) !== false ) { return $ this -> fromAtNotation ( $ handler ) ; } if ( strpos ( $ handler , self :: CHAR_DOT ) !== false ) { return $ this -> fromDotNotation ( $ handler ) ; } return $ this -> fromClassName ( $ handler ) ; }
Extracts the class and method name .
21,487
private function validate ( ) { if ( ! class_exists ( $ this -> class ) ) { throw new \ RuntimeException ( sprintf ( 'Class %s does not exist, is this the correct namespace?' , $ this -> class ) ) ; } if ( ! in_array ( $ this -> method , get_class_methods ( $ this -> class ) ) ) { throw new \ RuntimeException ( sprintf ( 'The method "%s" does not exist in "%s" class.' , $ this -> method , $ this -> class ) ) ; } }
Validates that the current class and methods exist and are callable .
21,488
private function fromAtNotation ( $ handler ) { $ parts = explode ( self :: CHAR_AT , $ handler ) ; if ( count ( $ parts ) != 2 ) { throw new \ InvalidArgumentException ( 'Invalid Class Method format from "at" notation.' ) ; } $ this -> class = $ parts [ 0 ] ; $ this -> method = $ parts [ 1 ] ; }
Extracts the class name and method from the Class Method string in
21,489
public function remove ( $ indexOrName ) { if ( isset ( $ this -> arrayVar [ $ indexOrName ] ) ) { unset ( $ this -> arrayVar [ $ indexOrName ] ) ; return true ; } return false ; }
Remove an item
21,490
public function set ( $ indexOrName , $ value , $ force = true ) { if ( isset ( $ this -> arrayVar [ $ indexOrName ] ) && $ force === false ) { return false ; } $ this -> arrayVar [ $ indexOrName ] = $ value ; return true ; }
Define an item in Array
21,491
public function sort ( $ order = self :: SORT_ASC , $ type = self :: SORT_REGULAR , $ caseSensitive = true ) { if ( $ caseSensitive === false ) { $ type = $ type + SORT_FLAG_CASE ; } if ( $ this -> isAssociative ( ) === true ) { if ( $ order == self :: SORT_ASC ) { asort ( $ this -> arrayVar , $ type ) ; } else { var_dump ( $ type ) ; arsort ( $ this -> arrayVar , $ type ) ; } } else { if ( $ order == self :: SORT_ASC ) { sort ( $ this -> arrayVar , $ type ) ; } else { rsort ( $ this -> arrayVar , $ type ) ; } } return $ this ; }
Sort an array by value
21,492
public function sortByKey ( $ order = self :: SORT_ASC , $ type = self :: SORT_REGULAR , $ caseSensitive = true ) { if ( $ caseSensitive === false ) { $ type = $ type + SORT_FLAG_CASE ; } if ( $ this -> isAssociative ( ) === true ) { array_multisort ( array_keys ( $ this -> arrayVar ) , $ order , $ type , $ this -> arrayVar ) ; } else { if ( $ order == self :: SORT_ASC ) { ksort ( $ this -> arrayVar , $ type ) ; } else { krsort ( $ this -> arrayVar , $ type ) ; } } return $ this ; }
Sort an array by key
21,493
public function update ( Arguments $ arguments , $ property , $ type , array $ options = [ ] ) { if ( ! isset ( $ arguments [ $ property ] ) || ( isset ( $ options [ 'force' ] ) && $ options [ 'force' ] ) ) { $ this -> set ( $ arguments , $ property , $ type , $ options ) ; } }
Set the value of a property in arguments to the value interactively retrieved if it wasn t set previously . Will also forcefully request an update for the property if the option force is set .
21,494
public function set ( Arguments $ arguments , $ property , $ type , array $ options = [ ] ) { $ options = $ this -> validateAndUpdateOptions ( $ options , $ type ) ; $ constraints = [ ] ; if ( is_array ( $ this -> constraints ) && isset ( $ this -> constraints [ $ property ] ) ) { $ constraints = $ this -> constraints [ $ property ] ; } $ options [ 'constraints' ] = $ constraints ; $ options [ 'property' ] = $ property ; if ( $ options [ 'default' ] === null && $ arguments -> get ( $ property , null ) !== null ) { $ options [ 'default' ] = $ arguments [ $ property ] ; } $ result = $ this -> ask ( $ type , $ options ) ; $ arguments [ $ property ] = $ result ; }
Set the value of a property in arguments to the value interactively retrieved .
21,495
private function validateAndUpdateOptions ( array $ options , $ type ) { if ( is_string ( $ type ) ) { $ type = $ this -> types -> getType ( $ type ) ; } if ( ! ( $ type instanceof InputTypeInterface ) ) { throw new InputTypeNotFoundException ( "Type should be an instance of InputTypeInterface or a string" ) ; } $ defaults = $ this -> getDefaultOptions ( $ type ) ; foreach ( $ options as $ key => $ value ) { if ( ! array_key_exists ( $ key , $ defaults ) ) { $ allowed = implode ( ', ' , array_keys ( $ defaults ) ) ; throw new InvalidInputException ( "Found non-default option '{$key}', only allowed to use one of {$allowed}." ) ; } } return array_merge ( $ defaults , $ options ) ; }
Validate options does not contain non - existant options and update with defaults where not defined .
21,496
private function getDefaultOptions ( InputTypeInterface $ type ) { return array_merge ( [ 'force' => false , 'property' => '' , 'constraints' => null , 'required' => false , 'default' => null , 'modify' => null , ] , $ type -> getDefaultOptions ( ) ) ; }
Return the default options for the InputTypeInterface combined with the default options required by the questioner .
21,497
public function message ( $ message , $ lineWidth = 80 , $ style = 'info' ) { if ( null === $ lineWidth ) { $ lineWidth = 80 ; } if ( is_string ( $ message ) ) { $ message = explode ( "\n" , wordwrap ( $ message , $ lineWidth , "\n" , true ) ) ; } foreach ( $ message as $ line ) { $ line = str_pad ( OutputFormatter :: escape ( $ line ) , $ lineWidth ) ; $ this -> getOutput ( ) -> writeln ( "<{$style}>{$line}</{$style}>" ) ; } }
Write a message in the given style with line breaks at the given length .
21,498
public function create ( LanguageForm $ form ) : Language { $ model = Language :: create ( $ form -> name , $ form -> slug , $ form -> locale , $ form -> alias , $ form -> icon ) ; $ this -> assertIsUniqueSlug ( $ model ) ; $ this -> repository -> save ( $ model ) ; return $ model ; }
Language item create .
21,499
public function edit ( $ id , LanguageForm $ form ) : void { $ model = $ this -> repository -> get ( $ id ) ; $ model -> edit ( $ form -> name , $ form -> slug , $ form -> locale , $ form -> alias , $ form -> icon ) ; $ this -> assertIsUniqueSlug ( $ model ) ; $ this -> repository -> save ( $ model ) ; }
Language item edit .