idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
45,900
public function setDisplayCodeLine ( $ displayCodeLine = true ) { $ this -> isBool ( $ displayCodeLine , 'displayCodeLine' ) ; $ this -> displayCodeLine = $ displayCodeLine ; return $ this ; }
Set whether or not to display the code line at the bottom
45,901
public function getDisplayCodeLine ( ) { if ( $ this -> getPaymentSlipData ( ) -> getWithAccountNumber ( ) !== true || $ this -> getPaymentSlipData ( ) -> getWithReferenceNumber ( ) !== true ) { return false ; } return $ this -> displayCodeLine ; }
Get whether or not to display the code line at the bottom
45,902
public function getFilterForRule ( Rule $ rule ) { $ filterIdentifier = $ rule -> getFilter ( ) ; if ( class_exists ( $ filterIdentifier ) ) { return new $ filterIdentifier ; } $ error = "Unable to locate filter for: $filterIdentifier defined in " . get_class ( $ rule ) ; throw new \ UnexpectedValueException ( $ error ...
Finds the filter responsible for executing a specific rule
45,903
public function actionView ( $ id ) { $ formModel = new AddAuthItemForm ( ) ; $ am = Yii :: app ( ) -> getAuthManager ( ) ; if ( isset ( $ _POST [ 'AddAuthItemForm' ] ) ) { $ formModel -> attributes = $ _POST [ 'AddAuthItemForm' ] ; if ( $ formModel -> validate ( ) ) { if ( ! $ am -> isAssigned ( $ formModel -> items ,...
Displays the assignments for the user with the given id .
45,904
public function actionRevoke ( ) { if ( isset ( $ _GET [ 'itemName' ] , $ _GET [ 'userId' ] ) ) { $ itemName = $ _GET [ 'itemName' ] ; $ userId = $ _GET [ 'userId' ] ; $ am = Yii :: app ( ) -> getAuthManager ( ) ; if ( $ am -> isAssigned ( $ itemName , $ userId ) ) { $ am -> revoke ( $ itemName , $ userId ) ; if ( $ am...
Revokes an assignment from the given user .
45,905
protected function getAssignmentOptions ( $ userId ) { $ options = array ( ) ; $ am = Yii :: app ( ) -> authManager ; $ assignments = $ am -> getAuthAssignments ( $ userId ) ; $ assignedItems = array_keys ( $ assignments ) ; $ authItems = $ am -> getAuthItems ( ) ; foreach ( $ authItems as $ itemName => $ item ) { if (...
Returns a list of possible assignments for the user with the given id .
45,906
private function parseOptions ( $ options ) { $ parseResult = new \ stdClass ( ) ; $ parseResult -> invalidOptions = array ( ) ; $ parseResult -> missingOptions = array_flip ( ( array ) $ this -> getRequiredOptions ( ) ) ; if ( is_array ( $ options ) && count ( $ options ) == 1 && isset ( $ options [ 'value' ] ) ) { $ ...
Parses provided options into their properties and returns results for the parsing process
45,907
private function parseOptionsArray ( $ options , \ stdClass $ result ) { foreach ( $ options as $ option => $ value ) { if ( ! property_exists ( $ this , $ option ) ) { $ result -> invalidOptions [ ] = $ option ; continue ; } $ this -> $ option = $ value ; unset ( $ result -> missingOptions [ $ option ] ) ; } }
Parses Options in the array format
45,908
private function parseSingleOption ( $ options , \ stdClass $ result ) { $ option = $ this -> getDefaultOption ( ) ; if ( null === $ option ) { throw new RuleDefinitionException ( sprintf ( 'No default option is configured for rule %s' , get_class ( $ this ) ) ) ; } if ( ! property_exists ( $ this , $ option ) ) { $ re...
Parses single option received
45,909
public function getZendInstance ( $ class , $ options ) { if ( strpos ( $ class , 'Zend\Filter' ) === false ) { $ class = "Zend\Filter\\" . $ class ; } if ( ! class_exists ( $ class ) ) { throw new InvalidZendFilterException ( "Could not find or autoload: $class" ) ; } try { new \ ReflectionMethod ( $ class , 'setOptio...
Instantiates a configured Zend Filter if it exists
45,910
protected function setDefaults ( ) { $ this -> setBankLeftAttr ( 3 , 8 , 50 , 4 ) ; $ this -> setBankRightAttr ( 66 , 8 , 50 , 4 ) ; $ this -> setRecipientLeftAttr ( 3 , 23 , 50 , 4 ) ; $ this -> setRecipientRightAttr ( 66 , 23 , 50 , 4 ) ; $ this -> setAccountLeftAttr ( 27 , 43 , 30 , 4 ) ; $ this -> setAccountRightAt...
Sets the common default attributes of the elements
45,911
public function setSlipPosition ( $ slipPosX , $ slipPosY ) { $ this -> setSlipPosX ( $ slipPosX ) ; $ this -> setSlipPosY ( $ slipPosY ) ; return $ this ; }
Set the starting X & Y position of the slip
45,912
public function setSlipSize ( $ slipWidth , $ slipHeight ) { $ this -> setSlipHeight ( $ slipHeight ) ; $ this -> setSlipWidth ( $ slipWidth ) ; return $ this ; }
Set the height & width of the slip
45,913
protected function setAttributes ( & $ element , $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { if ( $ posX ) { $ element [ 'PosX' ] = $ posX ; } elseif ( ! isset ( $ ele...
Set the attributes for a given payment slip element
45,914
public function setBankLeftAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> bankLeftAttr , $ posX , $ posY , $ width , $ height ,...
Set the left bank attributes
45,915
public function setBankRightAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> bankRightAttr , $ posX , $ posY , $ width , $ height...
Set the right bank attributes
45,916
public function setRecipientLeftAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> recipientLeftAttr , $ posX , $ posY , $ width , ...
Set the left recipient attributes
45,917
public function setRecipientRightAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> recipientRightAttr , $ posX , $ posY , $ width ...
Set the right recipient attributes
45,918
public function setAccountLeftAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> accountLeftAttr , $ posX , $ posY , $ width , $ he...
Set the left account attributes
45,919
public function setAccountRightAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> accountRightAttr , $ posX , $ posY , $ width , $ ...
Set the right account attributes
45,920
public function setAmountFrancsLeftAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { if ( $ textAlign === null ) { $ textAlign = 'R' ; } $ this -> setAttributes ( $ t...
Set the left francs amount attributes
45,921
public function setAmountFrancsRightAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { if ( $ textAlign === null ) { $ textAlign = 'R' ; } $ this -> setAttributes ( $ ...
Set the right francs amount attributes
45,922
public function setAmountCentsLeftAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> amountCentsLeftAttr , $ posX , $ posY , $ widt...
Set the left cents amount attributes
45,923
public function setAmountCentsRightAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> amountCentsRightAttr , $ posX , $ posY , $ wi...
Set the right cents amount attributes
45,924
public function setPayerLeftAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> payerLeftAttr , $ posX , $ posY , $ width , $ height...
Set the left payer attributes
45,925
public function setPayerRightAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> payerRightAttr , $ posX , $ posY , $ width , $ heig...
Set the right payer attributes
45,926
public function setDisplayBackground ( $ displayBackground = true ) { $ this -> isBool ( $ displayBackground , 'displayBackground' ) ; $ this -> displayBackground = $ displayBackground ; return $ this ; }
Set whether or not to display the background
45,927
public function setDisplayAccount ( $ displayAccount = true ) { $ this -> isBool ( $ displayAccount , 'displayAccount' ) ; $ this -> displayAccount = $ displayAccount ; return $ this ; }
Set whether or not to display the account
45,928
public function setDisplayAmount ( $ displayAmount = true ) { $ this -> isBool ( $ displayAmount , 'displayAmount' ) ; $ this -> displayAmount = $ displayAmount ; return $ this ; }
Set whether or not to display the amount
45,929
public function setDisplayBank ( $ displayBank = true ) { $ this -> isBool ( $ displayBank , 'displayBank' ) ; $ this -> displayBank = $ displayBank ; return $ this ; }
Set whether or not to display the bank
45,930
public function setDisplayPayer ( $ displayPayer = true ) { $ this -> isBool ( $ displayPayer , 'displayPayer' ) ; $ this -> displayPayer = $ displayPayer ; return $ this ; }
Set whether or not to display the payer
45,931
public function setDisplayRecipient ( $ displayRecipient = true ) { $ this -> isBool ( $ displayRecipient , 'displayRecipient' ) ; $ this -> displayRecipient = $ displayRecipient ; return $ this ; }
Set whether or not to display the recipient
45,932
protected function isIntOrFloat ( $ parameter , $ varName ) { if ( ( ! is_int ( $ parameter ) && ! is_float ( $ parameter ) ) ) { throw new InvalidArgumentException ( sprintf ( '$%s is neither an integer nor a float.' , $ varName ) ) ; } }
Verify that a given parameter is an integer or a float
45,933
public function setWithBank ( $ withBank = true ) { $ this -> isBool ( $ withBank , 'withBank' ) ; $ this -> withBank = $ withBank ; if ( $ withBank === false ) { $ this -> bankName = '' ; $ this -> bankCity = '' ; } return $ this ; }
Set if payment slip has a bank specified
45,934
public function setWithAccountNumber ( $ withAccountNumber = true ) { $ this -> isBool ( $ withAccountNumber , 'withAccountNumber' ) ; $ this -> withAccountNumber = $ withAccountNumber ; if ( $ withAccountNumber === false ) { $ this -> accountNumber = '' ; } return $ this ; }
Set if payment slip has an account number specified
45,935
public function setWithRecipient ( $ withRecipient = true ) { $ this -> isBool ( $ withRecipient , 'withRecipient' ) ; $ this -> withRecipient = $ withRecipient ; if ( $ withRecipient === false ) { $ this -> recipientLine1 = '' ; $ this -> recipientLine2 = '' ; $ this -> recipientLine3 = '' ; $ this -> recipientLine4 =...
Set if payment slip has a recipient specified
45,936
public function setWithAmount ( $ withAmount = true ) { $ this -> isBool ( $ withAmount , 'withAmount' ) ; $ this -> withAmount = $ withAmount ; if ( $ withAmount === false ) { $ this -> amount = 0.0 ; } return $ this ; }
Set if payment slip has an amount specified
45,937
public function setWithPayer ( $ withPayer = true ) { $ this -> isBool ( $ withPayer , 'withPayer' ) ; $ this -> withPayer = $ withPayer ; if ( $ withPayer === false ) { $ this -> payerLine1 = '' ; $ this -> payerLine2 = '' ; $ this -> payerLine3 = '' ; $ this -> payerLine4 = '' ; } return $ this ; }
Set if payment slip has a payer specified
45,938
public function setBankData ( $ bankName , $ bankCity ) { $ this -> setBankName ( $ bankName ) ; $ this -> setBankCity ( $ bankCity ) ; return $ this ; }
Sets the name city and account number of the bank
45,939
public function setRecipientData ( $ recipientLine1 , $ recipientLine2 , $ recipientLine3 = '' , $ recipientLine4 = '' ) { $ this -> setRecipientLine1 ( $ recipientLine1 ) ; $ this -> setRecipientLine2 ( $ recipientLine2 ) ; $ this -> setRecipientLine3 ( $ recipientLine3 ) ; $ this -> setRecipientLine4 ( $ recipientLin...
Sets the four lines of the recipient
45,940
public function setPayerData ( $ payerLine1 , $ payerLine2 , $ payerLine3 = '' , $ payerLine4 = '' ) { $ this -> setPayerLine1 ( $ payerLine1 ) ; $ this -> setPayerLine2 ( $ payerLine2 ) ; $ this -> setPayerLine3 ( $ payerLine3 ) ; $ this -> setPayerLine4 ( $ payerLine4 ) ; return $ this ; }
Sets the four lines of the payer
45,941
protected function getAccountDigits ( ) { if ( ! $ this -> getWithAccountNumber ( ) ) { throw new DisabledDataException ( 'account number' ) ; } if ( $ this -> getNotForPayment ( ) ) { return 'XXXXXXXXX' ; } $ accountNumber = $ this -> getAccountNumber ( ) ; if ( $ accountNumber === '' ) { return $ accountNumber ; } $ ...
Clear the account of the two hyphens
45,942
public function getAmountFrancs ( ) { if ( $ this -> getNotForPayment ( ) ) { return 'XXXXXXXX' ; } $ amount = $ this -> getAmount ( ) ; $ francs = intval ( $ amount ) ; return $ francs ; }
Get the francs amount without cents
45,943
public function getAmountCents ( ) { if ( $ this -> getNotForPayment ( ) ) { return 'XX' ; } $ amount = $ this -> getAmount ( ) ; $ francs = intval ( $ amount ) ; $ cents = round ( ( $ amount - $ francs ) * 100 ) ; return str_pad ( $ cents , 2 , '0' , STR_PAD_LEFT ) ; }
Get the zero filled right padded two digits long cents amount
45,944
protected function modulo10 ( $ number ) { $ next = 0 ; for ( $ i = 0 ; $ i < strlen ( $ number ) ; $ i ++ ) { $ next = $ this -> moduloTable [ ( $ next + intval ( substr ( $ number , $ i , 1 ) ) ) % 10 ] ; } return ( 10 - $ next ) % 10 ; }
Creates Modulo10 recursive check digit
45,945
protected function breakStringIntoBlocks ( $ string , $ blockSize = 5 , $ alignFromRight = true ) { if ( $ alignFromRight === true ) { $ string = strrev ( $ string ) ; } $ string = trim ( chunk_split ( $ string , $ blockSize , ' ' ) ) ; if ( $ alignFromRight === true ) { $ string = strrev ( $ string ) ; } return $ stri...
Get a given string broken down in blocks of a certain size
45,946
private function parseHostedConfiguration ( array $ configuration , ContainerBuilder $ container ) { $ entityId = [ 'entity_id_route' => $ configuration [ 'metadata' ] [ 'entity_id_route' ] ] ; $ serviceProvider = array_merge ( $ configuration [ 'service_provider' ] , $ entityId ) ; $ identityProvider = array_merge ( $...
Creates and register MetadataConfiguration object based on the configuration given .
45,947
protected function useObjectMethod ( $ method , $ value ) { $ currentObject = $ this -> getCurrentObject ( ) ; if ( $ currentObject === null ) { throw new FilterException ( "The target object was not provided to the filter, can't execute method. Please report this." ) ; } if ( ! method_exists ( $ currentObject , $ meth...
Filters by executing a method in the object
45,948
public function setWithReferenceNumber ( $ withReferenceNumber = true ) { $ this -> isBool ( $ withReferenceNumber , 'withReferenceNumber' ) ; $ this -> withReferenceNumber = $ withReferenceNumber ; if ( $ withReferenceNumber === false ) { $ this -> referenceNumber = '' ; } return $ this ; }
Set if payment slip has a reference number specified
45,949
public function setWithBankingCustomerId ( $ withBankingCustomerId = true ) { $ this -> isBool ( $ withBankingCustomerId , 'withBankingCustomerId' ) ; $ this -> withBankingCustomerId = $ withBankingCustomerId ; if ( $ withBankingCustomerId === false ) { $ this -> bankingCustomerId = '' ; } return $ this ; }
Set if the payment slip s reference number should contain the banking customer ID
45,950
public function getCompleteReferenceNumber ( $ formatted = true , $ fillZeros = true ) { $ referenceNumber = $ this -> getReferenceNumber ( ) ; $ notForPayment = $ this -> getNotForPayment ( ) ; $ completeReferenceNumber = $ referenceNumber ; if ( $ notForPayment ) { $ completeReferenceNumber = str_pad ( $ referenceNum...
Get complete reference number
45,951
protected function appendCheckDigit ( $ referenceNumber , $ notForPayment = false ) { if ( $ notForPayment === true ) { return $ referenceNumber . 'X' ; } return $ referenceNumber . $ this -> modulo10 ( $ referenceNumber ) ; }
Append the check digit to the reference number
45,952
public function getCodeLine ( $ fillZeros = true ) { $ referenceNumber = $ this -> getCompleteReferenceNumber ( false , $ fillZeros ) ; $ accountNumber = $ this -> getAccountDigits ( ) ; if ( $ this -> getWithAmount ( ) ) { $ francs = $ this -> getAmountFrancs ( ) ; $ cents = $ this -> getAmountCents ( ) ; $ francs = s...
Get the full code line at the bottom of the ESR
45,953
public function getItems ( $ itemName = null ) { if ( $ itemName && isset ( $ this -> _items [ $ itemName ] ) ) { return $ this -> _items [ $ itemName ] ; } return $ this -> _items ; }
Return thee parents and children of specific item or all items
45,954
public function hasParent ( $ itemName , $ parentName ) { $ parents = $ this -> getParents ( $ itemName ) ; if ( in_array ( $ parentName , $ parents ) ) { return true ; } return false ; }
Returns whether the given item has a specific parent .
45,955
public function hasChild ( $ itemName , $ childName ) { $ children = $ this -> getChildren ( $ itemName ) ; if ( in_array ( $ childName , $ children ) ) { return true ; } return false ; }
Returns whether the given item has a specific child .
45,956
public function hasAncestor ( $ itemName , $ ancestorName ) { $ ancestors = $ this -> getAncestors ( $ itemName ) ; return isset ( $ ancestors [ $ ancestorName ] ) ; }
Returns whether the given item has a specific ancestor .
45,957
public function hasDescendant ( $ itemName , $ descendantName ) { $ descendants = $ this -> getDescendants ( $ itemName ) ; return isset ( $ descendants [ $ descendantName ] ) ; }
Returns whether the given item has a specific descendant .
45,958
public function getAncestor ( $ itemName , $ depth = 0 ) { $ ancestors = array ( ) ; $ parents = $ this -> getParents ( $ itemName ) ; if ( empty ( $ parents ) ) { $ parents = $ this -> owner -> db -> createCommand ( ) -> select ( 'parent' ) -> from ( $ this -> owner -> itemChildTable ) -> where ( 'child=:child' , arra...
Returns all ancestors for the given item recursively .
45,959
public function getDescendant ( $ itemName , $ depth = 0 ) { $ descendants = array ( ) ; $ children = $ this -> getChildren ( $ itemName ) ; if ( empty ( $ children ) ) { $ children = $ this -> owner -> db -> createCommand ( ) -> select ( 'child' ) -> from ( $ this -> owner -> itemChildTable ) -> where ( 'parent=:paren...
Returns all the descendants for the given item recursively .
45,960
private function getPermissions ( $ items = null , $ depth = 0 ) { $ permissions = array ( ) ; if ( $ items === null ) { $ items = $ this -> owner -> getAuthItems ( ) ; } foreach ( $ items as $ itemName => $ item ) { $ permissions [ $ itemName ] = array ( 'name' => $ itemName , 'item' => $ item , 'children' => $ this -...
Returns the permission tree for the given items .
45,961
private function getItemPermissions ( $ itemName ) { $ item = $ this -> owner -> getAuthItem ( $ itemName ) ; return $ item instanceof CAuthItem ? $ this -> getPermissions ( $ item -> getChildren ( ) ) : array ( ) ; }
Builds the permissions for the given item .
45,962
public function getItemsPermissions ( $ names ) { $ permissions = array ( ) ; $ items = $ this -> getPermissions ( ) ; $ flat = $ this -> flattenPermissions ( $ items ) ; foreach ( $ flat as $ itemName => $ item ) { if ( in_array ( $ itemName , $ names ) ) { $ permissions [ $ itemName ] = $ item ; } } return $ permissi...
Returns the permissions for the items with the given names .
45,963
public function flattenPermissions ( $ permissions ) { $ flattened = array ( ) ; foreach ( $ permissions as $ itemName => $ itemPermissions ) { $ flattened [ $ itemName ] = $ itemPermissions ; if ( isset ( $ itemPermissions [ 'children' ] ) ) { $ children = $ itemPermissions [ 'children' ] ; unset ( $ itemPermissions [...
Flattens the given permission tree .
45,964
public function checkAccess ( $ operation , $ params = array ( ) , $ allowCaching = true ) { if ( $ this -> getIsAdmin ( ) ) { return true ; } return parent :: checkAccess ( $ operation , $ params , $ allowCaching ) ; }
Performs access check for this user .
45,965
protected function walkObject ( $ object , $ limitProperty = null ) { if ( $ object === null ) { return ; } $ metadata = $ this -> metadataFactory -> getClassMetadata ( get_class ( $ object ) ) ; $ walker = new ObjectWalker ( $ object , $ this -> filterLoader ) ; $ properties = ( $ limitProperty !== null ) ? array ( $ ...
Iterates over annotated properties in an object filtering the selected values
45,966
public function actionIndex ( ) { $ dataProvider = new AuthItemDataProvider ( ) ; $ dataProvider -> type = $ this -> type ; $ this -> render ( 'index' , array ( 'dataProvider' => $ dataProvider , ) ) ; }
Displays a list of items of the given type .
45,967
public function actionCreate ( ) { $ model = new AuthItemForm ( 'create' ) ; if ( isset ( $ _POST [ 'AuthItemForm' ] ) ) { $ model -> attributes = $ _POST [ 'AuthItemForm' ] ; if ( $ model -> validate ( ) ) { $ am = Yii :: app ( ) -> getAuthManager ( ) ; if ( ( $ item = $ am -> getAuthItem ( $ model -> name ) ) === nul...
Displays a form for creating a new item of the given type .
45,968
public function actionUpdate ( $ name ) { $ am = Yii :: app ( ) -> getAuthManager ( ) ; $ item = $ am -> getAuthItem ( $ name ) ; if ( $ item === null ) { throw new CHttpException ( 404 , Yii :: t ( 'AuthModule.main' , 'Page not found.' ) ) ; } $ model = new AuthItemForm ( 'update' ) ; if ( isset ( $ _POST [ 'AuthItemF...
Displays a form for updating the item with the given name .
45,969
public function actionView ( $ name ) { $ formModel = new AddAuthItemForm ( ) ; $ am = Yii :: app ( ) -> getAuthManager ( ) ; if ( isset ( $ _POST [ 'AddAuthItemForm' ] ) ) { $ formModel -> attributes = $ _POST [ 'AddAuthItemForm' ] ; if ( $ formModel -> validate ( ) ) { if ( ! $ am -> hasItemChild ( $ name , $ formMod...
Displays the item with the given name .
45,970
public function actionDelete ( ) { if ( isset ( $ _GET [ 'name' ] ) ) { $ name = $ _GET [ 'name' ] ; $ am = Yii :: app ( ) -> getAuthManager ( ) ; $ item = $ am -> getAuthItem ( $ name ) ; if ( $ item instanceof CAuthItem ) { $ am -> removeAuthItem ( $ name ) ; if ( $ am instanceof CPhpAuthManager ) { $ am -> save ( ) ...
Deletes the item with the given name .
45,971
public function actionRemoveParent ( $ itemName , $ parentName ) { $ am = Yii :: app ( ) -> getAuthManager ( ) ; if ( $ am -> hasItemChild ( $ parentName , $ itemName ) ) { $ am -> removeItemChild ( $ parentName , $ itemName ) ; if ( $ am instanceof CPhpAuthManager ) { $ am -> save ( ) ; } } $ this -> redirect ( array ...
Removes the parent from the item with the given name .
45,972
public function actionRemoveChild ( $ itemName , $ childName ) { $ am = Yii :: app ( ) -> getAuthManager ( ) ; if ( $ am -> hasItemChild ( $ itemName , $ childName ) ) { $ am -> removeItemChild ( $ itemName , $ childName ) ; if ( $ am instanceof CPhpAuthManager ) { $ am -> save ( ) ; } } $ this -> redirect ( array ( 'v...
Removes the child from the item with the given name .
45,973
protected function getItemChildOptions ( $ itemName ) { $ options = array ( ) ; $ am = Yii :: app ( ) -> getAuthManager ( ) ; $ item = $ am -> getAuthItem ( $ itemName ) ; if ( $ item instanceof CAuthItem ) { $ exclude = $ am -> getAncestors ( $ itemName ) ; $ exclude [ $ itemName ] = $ item ; $ exclude = array_merge (...
Returns a list of possible children for the item with the given name .
45,974
protected function getValidChildTypes ( ) { $ validTypes = array ( ) ; switch ( $ this -> type ) { case CAuthItem :: TYPE_OPERATION : break ; case CAuthItem :: TYPE_TASK : $ validTypes [ ] = CAuthItem :: TYPE_OPERATION ; break ; case CAuthItem :: TYPE_ROLE : $ validTypes [ ] = CAuthItem :: TYPE_OPERATION ; $ validTypes...
Returns a list of the valid child types for the given type .
45,975
public function flushAccess ( $ itemName , $ userId ) { if ( ( $ cache = $ this -> getCache ( ) ) !== null ) { $ cacheKey = $ this -> resolveCacheKey ( $ itemName , $ userId ) ; return $ cache -> delete ( $ cacheKey ) ; } return false ; }
Flushes the access cache for the specified user .
45,976
protected function getCache ( ) { return $ this -> cachingDuration > 0 && $ this -> cacheID !== false ? Yii :: app ( ) -> getComponent ( $ this -> cacheID ) : null ; }
Returns the caching component for this component .
45,977
private function parseClassMetadata ( $ class ) { $ metadata = new ClassMetadata ( $ class ) ; $ this -> loadParentMetadata ( $ metadata ) ; $ this -> loadInterfaceMetadata ( $ metadata ) ; $ this -> loader -> loadClassMetadata ( $ metadata ) ; $ this -> setParsedClass ( $ class , $ metadata ) ; if ( $ this -> cache !=...
Reads class metadata for a new and unparsed class
45,978
protected function loadParentMetadata ( ClassMetadataInterface $ metadata ) { $ parent = $ metadata -> getReflectionClass ( ) -> getParentClass ( ) ; if ( $ parent ) { $ metadata -> mergeRules ( $ this -> getClassMetadata ( $ parent -> getName ( ) ) ) ; } }
Checks if the class being parsed has a parent and cascades parsing to its parent
45,979
public function getLoginUrl ( string $ redirectUrl , array $ permissions = [ 'public_profile' ] , ? string $ stateParam = null ) : string { $ helper = $ this -> facebook -> getRedirectLoginHelper ( ) ; if ( isset ( $ stateParam ) ) { $ helper -> getPersistentDataHandler ( ) -> set ( 'state' , $ stateParam ) ; } $ url =...
Creates Response that redirects person to FB for authorization and back
45,980
public static function fromSha ( $ sha , $ baseUrl , ClientInterface $ client ) { $ url = Project :: getProjectBaseFromUrl ( $ baseUrl ) . '/git/trees' ; return static :: get ( $ sha , $ url , $ client ) ; }
Get the Tree object for an SHA hash .
45,981
public function getObject ( $ path ) { if ( $ path === '' || $ path === '.' ) { return $ this ; } $ data = $ this -> getObjectData ( $ path ) ; if ( $ data === false ) { return false ; } if ( $ data [ 'type' ] === 'blob' ) { return Blob :: fromSha ( $ data [ 'sha' ] , $ this -> getUri ( ) , $ this -> client ) ; } elsei...
Get an object in this tree .
45,982
private function getObjectData ( $ path ) { foreach ( $ this -> tree as $ objectData ) { if ( $ objectData [ 'path' ] === $ path ) { return $ objectData ; } } return false ; }
Find an object definition by its path .
45,983
private function getObjectRecursive ( $ path ) { $ tree = $ object = $ this ; foreach ( $ this -> splitPath ( $ path ) as $ part ) { $ object = $ tree -> getObject ( $ part ) ; if ( ! $ object instanceof Tree ) { return $ object ; } $ tree = $ object ; } return $ object ; }
Get an object recursively in this tree .
45,984
public function triggerHook ( ) { $ hookUrl = $ this -> getLink ( '#hook' ) ; $ options = [ ] ; $ options [ 'json' ] = new \ stdClass ( ) ; $ options [ 'auth' ] = null ; $ this -> sendRequest ( $ hookUrl , 'post' , $ options ) ; }
Trigger the integration s web hook .
45,985
public static function listValidationErrors ( BadResponseException $ exception ) { $ response = $ exception -> getResponse ( ) ; if ( $ response && $ response -> getStatusCode ( ) === 400 ) { $ response -> getBody ( ) -> seek ( 0 ) ; $ data = $ response -> json ( ) ; if ( isset ( $ data [ 'detail' ] ) && is_array ( $ d...
Process an API exception to list integration validation errors .
45,986
public function getActivities ( ) { if ( ! isset ( $ this -> data [ '_embedded' ] [ 'activities' ] ) ) { return [ ] ; } $ activities = [ ] ; foreach ( $ this -> data [ '_embedded' ] [ 'activities' ] as $ data ) { $ activities [ ] = new Activity ( $ data , $ this -> baseUrl , $ this -> client ) ; } return $ activities ;...
Get activities embedded in the result .
45,987
public function getEntity ( ) { if ( ! isset ( $ this -> data [ '_embedded' ] [ 'entity' ] ) || ! isset ( $ this -> resourceClass ) ) { throw new \ Exception ( "No entity found in result" ) ; } $ data = $ this -> data [ '_embedded' ] [ 'entity' ] ; $ resourceClass = $ this -> resourceClass ; return new $ resourceClass ...
Get the entity embedded in the result .
45,988
public function getRawContent ( ) { if ( $ this -> size == 0 ) { return '' ; } if ( $ this -> encoding === 'base64' ) { $ raw = base64_decode ( $ this -> content , true ) ; if ( $ raw === false ) { throw new \ RuntimeException ( 'Failed to decode content' ) ; } return $ raw ; } throw new \ RuntimeException ( 'Unrecogni...
Get the raw content of the file .
45,989
public static function underscore ( $ camel_cased_word ) { $ word = $ camel_cased_word ; $ word = preg_replace ( '/\\\/' , '/' , $ word ) ; $ acronym_regex = static :: inflections ( ) -> acronym_regex ; $ word = preg_replace_callback ( "/(?:([A-Za-z\d])|^)({$acronym_regex})(?=\b|[^a-z])/" , function ( $ matches ) { ret...
Makes an underscored lowercase form from the expression in the string .
45,990
public static function humanize ( $ lower_case_and_underscored_word ) { $ result = $ lower_case_and_underscored_word ; foreach ( static :: inflections ( ) -> humans as $ rule => $ replacement ) { if ( ( $ result = preg_replace ( $ rule , $ replacement , $ result , 1 ) ) ) break ; } ; $ result = preg_replace ( '/_id$/' ...
Capitalizes the first word and turns underscores into spaces and strips a trailing _id if any . Like + titleize + this is meant for creating pretty output .
45,991
private static function apply_inflections ( $ word , $ rules ) { $ result = $ word ; preg_match ( '/\b\w+\Z/' , strtolower ( $ result ) , $ matches ) ; if ( empty ( $ word ) || array_search ( $ matches [ 0 ] , static :: inflections ( ) -> uncountables ) !== false ) { return $ result ; } else { foreach ( $ rules as $ ru...
Applies inflection rules for + singularize + and + pluralize + .
45,992
private function load ( ) { if ( ! $ this -> loaded && isset ( $ this -> storage ) ) { $ this -> data = $ this -> storage -> load ( $ this -> id ) ; $ this -> original = $ this -> data ; $ this -> loaded = true ; } }
Load session data if storage is defined .
45,993
public static function validatePublicKey ( $ value ) { $ value = preg_replace ( '/\s+/' , ' ' , $ value ) ; if ( ! strpos ( $ value , ' ' ) ) { return false ; } list ( $ type , $ key ) = explode ( ' ' , $ value , 3 ) ; if ( ! in_array ( $ type , static :: $ allowedAlgorithms ) || base64_decode ( $ key , true ) === fals...
Validate an SSH public key .
45,994
public static function get ( $ id , $ collectionUrl = null , ClientInterface $ client ) { try { $ url = $ collectionUrl ? rtrim ( $ collectionUrl , '/' ) . '/' . urlencode ( $ id ) : $ id ; $ request = new Request ( 'get' , $ url ) ; $ data = self :: send ( $ request , $ client ) ; return new static ( $ data , $ url , ...
Get a resource by its ID .
45,995
public static function send ( RequestInterface $ request , ClientInterface $ client , array $ options = [ ] ) { $ response = null ; try { $ response = $ client -> send ( $ request , $ options ) ; $ body = $ response -> getBody ( ) -> getContents ( ) ; $ data = [ ] ; if ( $ body ) { $ response -> getBody ( ) -> seek ( 0...
Send a Guzzle request .
45,996
protected function sendRequest ( $ url , $ method = 'get' , array $ options = [ ] ) { return $ this -> send ( new Request ( $ method , $ url ) , $ this -> client , $ options ) ; }
A simple helper function to send an HTTP request .
45,997
protected static function checkNew ( array $ data ) { $ errors = [ ] ; if ( $ missing = array_diff ( static :: getRequired ( ) , array_keys ( $ data ) ) ) { $ errors [ ] = 'Missing: ' . implode ( ', ' , $ missing ) ; } foreach ( $ data as $ key => $ value ) { $ errors += static :: checkProperty ( $ key , $ value ) ; } ...
Validate a new resource .
45,998
public static function wrapCollection ( array $ data , $ baseUrl , ClientInterface $ client ) { $ resources = [ ] ; foreach ( $ data as $ item ) { $ resources [ ] = new static ( $ item , $ baseUrl , $ client ) ; } return $ resources ; }
Create an array of resource instances from a collection s JSON data .
45,999
protected function runOperation ( $ op , $ method = 'post' , array $ body = [ ] ) { if ( ! $ this -> operationAvailable ( $ op , true ) ) { throw new OperationUnavailableException ( "Operation not available: $op" ) ; } $ options = [ ] ; if ( ! empty ( $ body ) ) { $ options [ 'json' ] = $ body ; } $ request = new Reque...
Execute an operation on the resource .