idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
12,800
protected function getOptions ( ServiceLocatorInterface $ services , $ key ) { $ appConfig = $ services -> get ( 'config' ) ; $ options = array_key_exists ( $ key , $ appConfig ) ? $ appConfig [ $ key ] : array ( ) ; if ( array_key_exists ( 'cache' , $ options ) && is_string ( $ options [ 'cache' ] ) && $ services -> has ( $ options [ 'cache' ] ) ) { $ options [ 'cache' ] = $ services -> get ( $ options [ 'cache' ] ) ; } return $ options ; }
Get options from application configuration
12,801
protected function realPath ( $ path ) { if ( php_sapi_name ( ) == 'cli' && ! $ path ) { $ path = $ _SERVER [ 'DOCUMENT_ROOT' ] ; } if ( $ realPath = realpath ( $ path ) ) { $ path = $ realPath ; } return rtrim ( $ path , '/\\' ) ; }
Takes a path and transforms it to a real path .
12,802
private function applyConfig ( $ config ) { try { if ( isset ( $ config [ 'enabledLevels' ] ) ) { $ this -> setEnabledLevels ( $ config [ 'enabledLevels' ] ) ; } else { $ this -> setEnabledLevels ( [ 'error' , 'warning' ] ) ; } if ( isset ( $ config [ 'flushIntervals' ] ) ) { $ this -> setFlushIntervals ( $ config [ 'flushIntervals' ] ) ; } else { $ this -> setFlushIntervals ( 100 ) ; } if ( isset ( $ config [ 'targets' ] ) ) { foreach ( $ config [ 'targets' ] as $ key => $ value ) { if ( isset ( $ value [ 'class' ] ) ) { $ className = $ value [ 'class' ] ; $ this -> _targets [ $ key ] = $ className :: build ( $ value ) ; } } } } catch ( InvalidConfigurationException $ e ) { $ configStr = print_r ( $ config , true ) ; error_log ( 'Invalid Configuration for Logger Component. ' . PHP_EOL . $ configStr ) ; } }
Applies log configuration
12,803
public function setEnabledLevels ( array $ levels ) { $ enabledLevels = array ( ) ; foreach ( $ levels as $ value ) { if ( $ this -> validLevel ( $ value ) ) { array_push ( $ enabledLevels , $ value ) ; } } $ this -> _enabledLevels = $ enabledLevels ; }
Sets enabled logging levels .
12,804
public function showForm ( $ id ) { $ form = $ this -> container -> get ( 'netvlies.form' ) -> get ( $ id ) ; if ( $ form -> getSuccess ( ) ) { return $ this -> container -> get ( 'templating' ) -> render ( 'NetvliesFormBundle:Twig:form_success.html.twig' , array ( 'successMessage' => $ form -> getSuccessMessage ( ) , ) ) ; } else { $ formView = $ form -> getSf2Form ( ) -> createView ( ) ; if ( $ this -> container -> getParameter ( 'netvlies.form.templates.fields' ) != null ) { $ this -> container -> get ( 'twig' ) -> getExtension ( 'form' ) -> renderer -> setTheme ( $ formView , array ( $ this -> container -> getParameter ( 'netvlies.form.templates.fields' ) ) ) ; } return $ this -> container -> get ( 'templating' ) -> render ( $ this -> container -> getParameter ( 'netvlies.form.templates.form' ) , array ( 'id' => $ form -> getId ( ) , 'form' => $ formView , ) ) ; } }
Twig function that displays the form with the requested ID . If the form post was successful the success message is shown by the Twig renderer .
12,805
public function all ( ) { $ attributes = $ this -> attributes ; return array_map ( function ( $ item ) { if ( is_object ( $ item ) && get_class ( $ item ) === Generic :: class ) { $ item = $ item -> all ( ) ; } return $ item ; } , $ attributes ) ; }
Return the base attribute array .
12,806
public function ignore ( $ tube ) { $ this -> write ( 'ignore ' . $ tube ) ; $ response = $ this -> readStatus ( ) ; if ( $ response [ 0 ] != "WATCHING" ) { return false ; } return $ response [ 1 ] ; }
Ignores the tube
12,807
public function put ( $ job , $ options = null ) { if ( $ job instanceof JobInterface ) { if ( $ job -> isRunOnce ( ) ) { $ cacheKey = self :: CACHE_JOB . get_class ( $ job ) ; if ( $ this -> getCache ( ) -> get ( $ cacheKey ) === null ) { $ expire = $ job -> getDelay ( ) + $ job -> getTtr ( ) + 60 ; $ this -> getCache ( ) -> save ( $ cacheKey , 1 , $ expire ) ; } else { return true ; } } $ options = [ 'delay' => $ job -> getDelay ( ) , 'ttr' => $ job -> getTtr ( ) , 'priority' => $ job -> getPriority ( ) ] ; } $ this -> getLogger ( ) -> info ( 'Add job ' . json_encode ( $ job ) ) ; return parent :: put ( $ job , $ options ) ; }
Inserts jobs into the queue
12,808
public function delete ( JobInterface $ job ) { if ( $ job -> isRunOnce ( ) ) { $ this -> getCache ( ) -> delete ( self :: CACHE_JOB . get_class ( $ job ) ) ; } return $ job -> getBeanstalkJob ( ) -> delete ( ) ; }
deletes job from queue
12,809
protected function getIrcMessage ( $ type , array $ params = array ( ) ) { $ message = '' ; if ( $ this -> prefix ) { $ message .= ':' . $ this -> prefix . ' ' ; } $ message .= $ type ; $ params = array_filter ( $ params , function ( $ param ) { return $ param !== null ; } ) ; if ( $ params ) { $ last = end ( $ params ) ; $ params [ key ( $ params ) ] = ':' . $ last ; $ message .= ' ' . implode ( ' ' , $ params ) ; } $ message .= "\r\n" ; return $ message ; }
Returns a formatted IRC message .
12,810
public function ircUser ( $ username , $ hostname , $ servername , $ realname ) { return $ this -> getIrcMessage ( 'USER' , array ( $ username , $ hostname , $ servername , $ realname ) ) ; }
Returns a USER message .
12,811
public function ircMode ( $ target , $ mode = null , $ param = null ) { return $ this -> getIrcMessage ( 'MODE' , array ( $ target , $ mode , $ param ) ) ; }
Returns a MODE message .
12,812
public function ircKick ( $ channel , $ user , $ comment = null ) { return $ this -> getIrcMessage ( 'KICK' , array ( $ channel , $ user , $ comment ) ) ; }
Returns a KICK message .
12,813
public function ircConnect ( $ targetserver , $ port = null , $ remoteserver = null ) { return $ this -> getIrcMessage ( 'CONNECT' , array ( $ targetserver , $ port , $ remoteserver ) ) ; }
Returns a CONNECT message .
12,814
public function ircWhowas ( $ nickname , $ count = null , $ server = null ) { return $ this -> getIrcMessage ( 'WHOWAS' , array ( $ nickname , $ count , $ server ) ) ; }
Returns a WHOWAS message .
12,815
public function ctcpVersionResponse ( $ nickname , $ name , $ version , $ environment ) { return $ this -> getCtcpResponse ( $ nickname , 'VERSION ' . $ name . ':' . $ version . ':' . $ environment ) ; }
Returns a CTCP VERSION reply message .
12,816
public function ctcpSourceResponse ( $ nickname , $ host , $ directories , $ files ) { return $ this -> getCtcpResponse ( $ nickname , 'SOURCE ' . $ host . ':' . $ directories . ':' . $ files ) ; }
Returns a CTCP SOURCE reply message .
12,817
private function bind ( ) { $ this -> app -> bind ( 'League\Fractal\Manager' , function ( ) { $ manager = new Manager ( ) ; $ manager -> setSerializer ( new ArraySerializer ( ) ) ; return $ manager ; } ) ; }
Bind additional classes
12,818
public function setDone ( ) { $ migration = $ this -> getMigration ( ) ; if ( $ migration [ 'state' ] ) { return true ; } $ this -> db ( ) -> update ( $ this -> table , array ( 'state' => true ) , array ( 'id' => $ migration [ 'id' ] ) ) ; }
Sets that the migration was done .
12,819
public function unsetDone ( ) { $ migration = $ this -> getMigration ( ) ; if ( ! $ migration [ 'state' ] ) { return true ; } $ this -> db ( ) -> update ( $ this -> table , array ( 'state' => false ) , array ( 'id' => $ migration [ 'id' ] ) ) ; }
Sets that the migration was reverted .
12,820
public function create ( ) { $ migration = $ this -> getMessages ( ) ; if ( ! $ migration ) { $ this -> db ( ) -> insert ( $ this -> table , array ( 'migration' => get_class ( $ this ) , 'state' => false ) ) ; } else { throw new \ Exception ( 'Migration ' . get_class ( $ this ) . ' already created' ) ; } }
Creates the record in the database of the migration .
12,821
public function getMigration ( ) { $ query = $ this -> db ( ) -> createQueryBuilder ( ) -> select ( 'm.*' ) -> from ( $ this -> table , 'm' ) -> where ( 'migration = ?' ) -> setParameter ( 0 , get_class ( $ this ) ) ; $ results = $ query -> execute ( ) ; $ migration = $ results -> fetch ( ) ; if ( ! $ migration ) { $ this -> create ( ) ; return true ; } return $ migration ; }
Gets the information in the DB of this migration .
12,822
public function addMessage ( $ message ) { $ migrationName = get_class ( $ this ) ; $ this -> messages [ ] = sprintf ( "%s: %s\n" , $ migrationName , $ message ) ; }
Adds messages in the migration for later use .
12,823
public static function validate ( $ attribute ) { $ userClass = Yii :: $ app -> user -> identityClass ; $ regex = $ userClass :: $ idRegex ; $ result = preg_match ( $ regex , $ attribute ) ; return is_int ( $ result ) && $ result > 0 ; }
Validate whether the attribute is valid .
12,824
public function generateSelectItems ( array & $ params ) { $ pageUid = $ params [ 'flexParentDatabaseRow' ] [ '_tx_column_layout_orig_pid' ] ?? $ params [ 'flexParentDatabaseRow' ] [ 'pid' ] ; $ size = $ params [ 'config' ] [ 'txColumnLayout' ] [ 'size' ] ; $ type = $ params [ 'config' ] [ 'txColumnLayout' ] [ 'type' ] ; $ columnSizes = ColumnLayoutUtility :: getSizesFor ( $ size , $ type , $ pageUid ) ; $ settings = ColumnLayoutUtility :: getColumnLayoutSettings ( $ pageUid ) ; $ sizeSettings = $ settings [ 'sizes.' ] [ $ size . '.' ] ; $ typeSettings = $ settings [ 'types.' ] [ $ type . '.' ] ; $ itemLabel = $ this -> getLanguageService ( ) -> sL ( $ typeSettings [ 'itemLabel' ] ) ; $ items = array_map ( function ( $ column ) use ( $ size , $ itemLabel ) { return [ sprintf ( $ itemLabel , $ column , $ size ) , $ column ] ; } , $ columnSizes ) ; if ( $ columnSizes [ 0 ] === 0 && ( $ typeSettings [ 'itemLabelDisabled' ] ?? false ) ) { $ items [ 0 ] [ 0 ] = sprintf ( $ this -> getLanguageService ( ) -> sL ( $ typeSettings [ 'itemLabelDisabled' ] ) , $ type ) ; } $ typeOrdering = $ typeSettings [ 'ordering' ] ?? null ; $ sizeTypeOverride = array_key_exists ( $ type . '.' , $ sizeSettings ) ? $ sizeSettings [ $ type . '.' ] [ 'ordering' ] ?? false : false ; $ typeOrdering = $ sizeTypeOverride ? $ sizeTypeOverride : $ typeOrdering ; if ( $ typeOrdering === 'reverse' ) { $ items = array_reverse ( $ items ) ; } $ params [ 'items' ] = $ items ; }
Generates select items for the gridsystem flexform
12,825
protected function getCryptAes ( ) { if ( $ this -> aes === null ) { $ this -> aes = new \ Crypt_AES ( ) ; $ this -> aes -> setKey ( $ this -> psk ) ; } return $ this -> aes ; }
Get the crypt aes component .
12,826
public function postParseUnitAction ( $ uniqueId , $ success = true ) { $ result = new ParseResult ( ) ; try { if ( $ success ) { $ this -> storage -> setFlags ( $ uniqueId , array ( ZendStorage :: FLAG_SEEN ) ) ; } else { $ this -> storage -> setFlags ( $ uniqueId , array ( ZendStorage :: FLAG_RECENT ) ) ; } } catch ( \ Exception $ e ) { $ result -> setResult ( false ) ; $ result -> setMessage ( $ e -> getMessage ( ) ) ; $ result -> setCode ( $ e -> getCode ( ) ) ; } return $ result ; }
Action to be run after a single set of data retrieved from the remote source has been parsed .
12,827
public function get_template_name ( $ slug ) { $ slug = \ str_replace ( [ Config :: get ( 'theme.templates_directory' ) . '/' , $ this -> blade -> getFileExtension ( ) , ] , '' , $ slug ) ; if ( \ strpos ( $ slug , 'views/' ) !== 0 ) { $ slug = 'views.' . $ slug ; } return $ this -> bladeify ( $ slug ) ; }
Generate the template file name from the slug .
12,828
private function add_default_data ( $ data = [ ] ) { global $ wp_query , $ post ; $ data [ 'wp_query' ] = $ wp_query ; $ data [ 'post' ] = & $ post ; $ data [ 'current_view' ] = $ this -> current_view ; $ data [ 'request' ] = Request :: get_root_instance ( ) ; $ data [ 'errors' ] = Validation :: $ errors ; return $ data ; }
Add default data to template .
12,829
private function getTokens ( $ methodName ) { preg_match_all ( '([A-Z_-][^A-Z_-]*)' , $ methodName , $ rawTokens ) ; $ result = array ( ) ; $ lastToken = null ; $ seenBy = false ; foreach ( $ rawTokens [ 0 ] as $ token ) { $ newToken = $ this -> getToken ( $ token , $ seenBy ) ; if ( $ newToken instanceof ValueToken ) { $ lastToken = $ lastToken !== null && $ lastToken instanceof ValueToken ? new ValueToken ( $ lastToken -> getSource ( ) . $ newToken -> getSource ( ) ) : $ newToken ; } else { if ( $ lastToken instanceof ValueToken ) { $ result [ ] = $ lastToken ; $ lastToken = null ; } $ result [ ] = $ newToken ; } } if ( $ lastToken !== null ) { $ result [ ] = $ lastToken ; } return $ result ; }
Split the method name into tokens and parse them .
12,830
private function getToken ( $ token , & $ hasSeenBy ) { switch ( $ token ) { case 'And' : return new AndToken ( ) ; case 'Or' : return new OrToken ( ) ; case 'By' : case 'Where' : $ hasSeenBy = true ; return new ByToken ( ) ; case 'All' : return new AllToken ( ) ; case 'Distinct' : if ( $ hasSeenBy ) { return new ValueToken ( $ token ) ; } else { return new DistinctToken ( ) ; } case 'Like' : if ( $ hasSeenBy ) { return new LikeToken ( ) ; } else { return new ValueToken ( $ token ) ; } default : return new ValueToken ( $ token ) ; } }
Translate a token source to a token object .
12,831
public function getWellKnown ( ) { $ cached = $ this -> getCache ( 'wellKnown' ) ; if ( ! empty ( $ cached ) ) { return $ cached ; } try { $ response = $ this -> client -> get ( $ this -> wellKnownUrl ) ; } catch ( RequestException $ e ) { $ this -> lastException = $ e ; return null ; } $ output = json_decode ( $ response -> getBody ( ) ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { return null ; } $ this -> setCache ( 'wellKnown' , $ output ) ; return $ output ; }
Get the response of the specified . well - known URL .
12,832
public function getPublicKey ( ) { $ cached = $ this -> getCache ( 'publicKey' ) ; if ( ! empty ( $ cached ) ) { return $ cached ; } $ wellKnown = $ this -> getWellKnown ( ) ; if ( empty ( $ wellKnown -> jwks_uri ) ) { return null ; } try { $ response = $ this -> client -> get ( $ wellKnown -> jwks_uri ) ; } catch ( RequestException $ e ) { $ this -> lastException = $ e ; return null ; } $ jwks = json_decode ( $ response -> getBody ( ) ) ; if ( empty ( $ jwks -> keys [ 0 ] -> x5c [ 0 ] ) ) { return null ; } $ X509 = new X509 ( ) ; if ( ! $ X509 -> loadX509 ( $ jwks -> keys [ 0 ] -> x5c [ 0 ] ) ) { return null ; } $ key = ( string ) $ X509 -> getPublicKey ( ) ; $ this -> setCache ( 'publicKey' , $ key ) ; return $ key ; }
Get the public key of the current well - known URL
12,833
public function validateJWT ( $ jwt ) { try { $ decoded = $ this -> decode ( $ jwt ) ; return ! empty ( $ decoded ) ; } catch ( Exception $ e ) { $ this -> lastException = $ e ; return false ; } }
Check if a JWT is valid
12,834
public function decode ( $ jwt ) { $ wellKnown = $ this -> getWellKnown ( ) ; $ key = $ this -> getPublicKey ( ) ; $ decodedObject = JWT :: decode ( $ jwt , $ key , $ wellKnown -> id_token_signing_alg_values_supported ) ; if ( empty ( $ decodedObject -> iss ) ) { throw new NoIssuerException ( 'No issuer in JWT' ) ; } if ( $ decodedObject -> iss != $ wellKnown -> issuer ) { throw new BadIssuerException ( 'JWT issuer does not match well-known' ) ; } if ( empty ( $ decodedObject -> exp ) ) { throw new NoExpirationException ( 'No expiration in JWT' ) ; } $ decoded = json_decode ( json_encode ( $ decodedObject ) , true ) ; return $ this -> parseClaims ( $ decoded ) ; }
Decode a JWT
12,835
protected function getCache ( $ key ) { if ( array_key_exists ( $ key , $ this -> cache ) ) { return $ this -> cache [ $ key ] ; } return false ; }
Simple cache reader . Implemented as a function so that if you don t want caching you can make a subclass that overrides this function and always returns false
12,836
public function setDividerElement ( string $ element ) : Breadcrumbs { $ this -> validateElement ( 'allowedDividerElement' , $ element ) ; $ this -> setOption ( 'dividerElement' , $ element ) ; return $ this ; }
Set the divider list DOM Element .
12,837
public function setListElement ( string $ element ) : Breadcrumbs { $ this -> validateElement ( 'allowedListElement' , $ element ) ; $ this -> setOption ( 'listElement' , $ element ) ; return $ this ; }
Set the container list DOM Element .
12,838
public function setListItemElement ( string $ element ) : Breadcrumbs { $ this -> validateElement ( 'allowedListItemElement' , $ element ) ; $ this -> setOption ( 'listItemElement' , $ element ) ; return $ this ; }
Set the item DOM Element .
12,839
public function setListActiveElement ( string $ element ) : Breadcrumbs { $ this -> validateElement ( 'allowedListActiveElement' , $ element ) ; $ this -> setOption ( 'listActiveElement' , $ element ) ; return $ this ; }
Set the active DOM Element .
12,840
protected function setElementClasses ( string $ option , $ classes ) : Breadcrumbs { if ( is_string ( $ classes ) ) { $ classes = explode ( ' ' , $ classes ) ; } $ this -> validateClasses ( $ classes ) ; $ this -> setOption ( $ option , array_unique ( $ classes ) ) ; return $ this ; }
Set the classes to the given option type .
12,841
protected function addElementClasses ( string $ option , $ classes ) : Breadcrumbs { if ( is_string ( $ classes ) ) { $ classes = explode ( ' ' , $ classes ) ; } $ this -> validateClasses ( $ classes ) ; $ classes = array_merge ( $ this -> getOption ( $ option ) , $ classes ) ; $ this -> setOption ( $ option , array_unique ( $ classes ) ) ; return $ this ; }
Add one or more CSS classes related to the option type .
12,842
protected function removeElementClasses ( string $ option , $ classes ) : Breadcrumbs { if ( is_string ( $ classes ) ) { $ classes = explode ( ' ' , $ classes ) ; } $ this -> validateClasses ( $ classes ) ; $ classes = array_diff ( $ this -> getOption ( $ option ) , $ classes ) ; $ this -> setOption ( $ option , array_unique ( $ classes ) ) ; return $ this ; }
Remove one or more CSS classes related to the option type .
12,843
protected function validateElement ( string $ type , string $ element ) { if ( ! in_array ( $ element , $ this -> { $ type } ) ) { $ trace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 2 ) [ 1 ] [ 'function' ] ; throw new InvalidArgumentException ( "Breadcrumbs::{$trace} was passed \"$element\", but " . "this is not a valid element. Allowed list : " . implode ( ' ' , $ this -> { $ type } ) ) ; } }
Validate an Element before saving it .
12,844
protected function validateClasses ( $ classes ) { if ( ! is_array ( $ classes ) ) { $ trace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 3 ) [ 2 ] [ 'function' ] ; throw new InvalidArgumentException ( "Breadcrumbs::{$trace}() only accepts strings or arrays." ) ; } foreach ( $ classes as $ key => $ class ) { if ( ! is_string ( $ class ) ) { $ trace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 3 ) [ 2 ] [ 'function' ] ; throw new InvalidArgumentException ( "Breadcrumbs::{$trace}() was passed an array, but at least one of the values " . "was not a string: \$classes['{$key}'] = " . print_r ( $ class , true ) ) ; } } }
Validate the classes to ensure they have the right format .
12,845
public function doUpdate ( $ data ) { $ filter = array ( ) ; $ member = Member :: get ( ) -> byID ( $ data [ "ID" ] ) ; $ this -> extend ( "onBeforeUpdate" , $ data ) ; if ( Member :: currentUserID ( ) && $ member -> canEdit ( Member :: currentUser ( ) ) ) { try { $ this -> saveInto ( $ member ) ; $ member -> write ( ) ; $ this -> sessionMessage ( _t ( "Users.DETAILSUPDATED" , "Account details updated" ) , "success" ) ; } catch ( Exception $ e ) { $ this -> sessionMessage ( $ e -> getMessage ( ) , "warning" ) ; } } else { $ this -> sessionMessage ( _t ( "Users.CANNOTEDIT" , "You cannot edit this account" ) , "warning" ) ; } $ this -> extend ( "onAfterUpdate" , $ data ) ; return $ this -> controller -> redirectBack ( ) ; }
Register a new member
12,846
public static function get_directory_for_current_subsite ( ) { $ subsite = Subsite :: currentSubsite ( ) ; if ( $ subsite ) { if ( ( int ) $ subsite -> AssetsFolderID > 0 ) { $ dirObj = $ subsite -> AssetsFolder ( ) ; $ dirName = str_replace ( 'assets/' , '' , $ dirObj -> Filename ) ; $ dirName = str_replace ( '/' , '' , $ dirName ) ; return $ dirName ; } } else { return false ; } }
Getting subsite directory based on it s assets folder .
12,847
public static function calc_full_directory_for_object ( DataObject $ do ) { if ( $ do -> ClassName == 'Subsite' ) { return self :: calc_directory_for_subsite ( $ do ) ; } else { $ subsite_dir = self :: get_directory_for_current_subsite ( ) ; if ( $ subsite_dir ) { $ str = parent :: calc_full_directory_for_object ( $ do ) ; $ str = "$subsite_dir/$str" ; return $ str ; } else { return false ; } } }
Full subsite directory .
12,848
public function validateConverterClass ( $ attribute , $ params ) { $ className = $ this -> $ attribute ; if ( class_exists ( $ className ) === true ) { if ( new $ className instanceof MeasureConverterInterface === false ) { $ this -> addError ( $ attribute , MeasureHelper :: t ( 'Class does not implement `DevGroup\Measure\converters\MeasureConverterInterface` interface' ) ) ; } } else { $ this -> addError ( $ attribute , MeasureHelper :: t ( 'Class not found' ) ) ; } }
Validate the converter class name
12,849
public static function getTypes ( ) { $ typesList = [ ] ; foreach ( Yii :: $ app -> db -> getTableSchema ( static :: tableName ( ) ) -> columns [ 'type' ] -> enumValues as $ type ) { $ typesList [ $ type ] = MeasureHelper :: t ( $ type ) ; } return $ typesList ; }
Get list of measure types .
12,850
public function getFormatter ( ) { if ( $ this -> formatterInstance === null ) { $ this -> formatterInstance = Yii :: createObject ( [ 'class' => '\yii\i18n\Formatter' , 'decimalSeparator' => $ this -> decimal_separator , 'thousandSeparator' => $ this -> thousand_separator , 'numberFormatterOptions' => [ \ NumberFormatter :: MIN_FRACTION_DIGITS => $ this -> min_fraction_digits , \ NumberFormatter :: MAX_FRACTION_DIGITS => $ this -> max_fraction_digits , ] ] ) ; } return $ this -> formatterInstance ; }
Returns \ yii \ i18n \ Formatter instance for current Currency instance
12,851
public static function getMeasures ( $ type ) { $ query = static :: find ( ) -> select ( [ 'name' , 'id' ] ) -> indexBy ( 'id' ) ; if ( empty ( $ type ) === false ) { $ query -> where ( [ 'type' => $ type ] ) ; } return $ query -> column ( ) ; }
Get measures by type name .
12,852
public function authenticationURL ( ) { $ clientId = config ( 'twitch-api.client_id' ) ; $ scopes = implode ( '+' , config ( 'twitch-api.scopes' ) ) ; $ redirectURL = config ( 'twitch-api.redirect_url' ) ; return config ( 'twitch-api.api_url' ) . '/kraken/oauth2/authorize?response_type=code&client_id=' . $ clientId . '&redirect_uri=' . $ redirectURL . '&scope=' . $ scopes ; }
Returns the authentication URL where the user needs to be redirected to
12,853
public function requestToken ( $ code ) { $ parameters = [ 'client_id' => config ( 'twitch-api.client_id' ) , 'client_secret' => config ( 'twitch-api.client_secret' ) , 'redirect_uri' => config ( 'twitch-api.redirect_url' ) , 'code' => $ code , 'grant_type' => 'authorization_code' ] ; try { $ client = new Client ( ) ; $ response = $ client -> post ( config ( 'twitch-api.api_url' ) . '/kraken/oauth2/token' , [ 'body' => $ parameters ] ) ; $ response = $ response -> json ( ) ; if ( isset ( $ response [ 'access_token' ] ) ) { return $ response [ 'access_token' ] ; } } catch ( \ Exception $ e ) { throw $ e ; } }
Requests a token for a given code
12,854
public static function fromIndex ( Db \ Index $ index ) { return new self ( [ 'name' => $ index -> getName ( ) , 'columns' => $ index -> getColumns ( ) , 'type' => $ index -> getType ( ) ] ) ; }
convert from Phalcon \ Db \ Index object
12,855
public function isSame ( Index $ other , $ renamedColumns = null ) { if ( $ renamedColumns ) { $ columns = [ ] ; foreach ( $ this -> columns as $ col ) { $ columns [ ] = isset ( $ renamedColumns [ $ col ] ) ? $ renamedColumns [ $ col ] -> name : $ col ; } } else { $ columns = $ this -> columns ; } if ( $ columns != $ other -> columns ) { return false ; } if ( $ this -> name == self :: PRIMARY || $ other -> name == self :: PRIMARY ) { return $ this -> name == $ other -> name ; } else { return $ this -> type == $ other -> type ; } }
compare with index
12,856
public function addEmailToOutbox ( \ sb \ Email $ email ) { if ( $ this -> checkHeadersForInjection ( $ email ) ) { return 0 ; } else { $ this -> emails [ ] = $ email ; return true ; } }
Adds an email to the outbox which is sent with the send method
12,857
private function logEmail ( $ email , $ sent ) { $ message = "\nEmail sent at " . date ( 'm/d/y h:i:s' ) ; $ message .= "\nFrom:" . $ email -> from . '@' . $ this -> remote_addr ; $ message .= "\nTo: " . $ email -> to ; foreach ( $ email -> cc as $ cc ) { $ message .= "\nCc:" . $ cc ; } foreach ( $ email -> bcc as $ bcc ) { $ message .= "\nBcc:" . $ bcc ; } $ message .= "\nSubject: " . $ email -> subject ; $ message .= "\nAttachments: " . count ( $ email -> attachments ) . ' ' ; if ( $ this -> log_body ) { $ message .= "\nBody: " . $ email -> body ; $ message .= "\nBody_HTML: " . $ email -> body_HTML ; } $ names = Array ( ) ; foreach ( $ email -> attachments as $ attachment ) { $ names [ ] = $ attachment -> name ; } $ message .= "(" . \ implode ( "," , $ names ) . ")" ; if ( $ sent ) { return $ this -> logger -> sbEmailWriterSent ( $ message ) ; } else { return $ this -> logger -> sbEmailWriterError ( $ message ) ; } }
Logs the sending of emails if logging is enable by specifying the log_file property
12,858
private function checkHeadersForInjection ( \ sb \ Email $ email ) { if ( \ preg_match ( "~\r|:~i" , $ email -> to ) || preg_match ( "~\r|:~i" , $ email -> from ) ) { return true ; } return false ; }
Checks email for injections in from and to addr
12,859
public function get ( ) { $ uri = null ; if ( $ this -> context ) { $ uri = $ this -> context -> getBaseUri ( ) . '/' ; } $ uri .= $ this -> params [ 'endpoint' ] ; $ uri .= sprintf ( "?page=%d&perpage=%d" , $ this -> page , $ this -> perpage ) ; foreach ( $ this -> filters as $ filter ) { if ( ! empty ( $ filter [ 'value' ] ) ) { $ uri .= sprintf ( "&%s=%s" , $ filter [ 'field' ] , rawurlencode ( $ filter [ 'value' ] ) ) ; } } $ res = $ this -> client -> call ( $ uri ) ; $ lr = Client :: getLastResponse ( ) ; $ this -> pagination = isset ( $ lr [ 'body' ] ) && isset ( $ lr [ 'body' ] [ 'pagination' ] ) ? $ lr [ 'body' ] [ 'pagination' ] : [ ] ; $ this -> data = [ ] ; foreach ( $ res as $ data ) { $ this -> data [ ] = ( new Entity ( [ ] , $ this -> client ) ) -> setData ( $ data ) ; } $ this -> current = 0 ; return $ this -> data ; }
Get current data
12,860
public function getNext ( ) { if ( count ( $ this -> pagination ) == 0 ) { $ this -> get ( ) ; } if ( $ this -> page < $ this -> pagination [ 'total_pages' ] ) { $ this -> page ++ ; return $ this -> get ( ) ; } return false ; }
Increase page number and get next results batch return array
12,861
public function setPerPage ( $ perpage ) { if ( $ perpage > 0 ) { $ this -> perpage = ( int ) $ perpage ; $ this -> page = 1 ; } return $ this ; }
Set per page value reset page value to 1
12,862
public function addFilter ( $ field , $ value , $ operator = '=' ) { $ this -> filter [ ] = [ 'field' => $ field , 'value' => $ value , 'operator' => $ operator , ] ; return $ this ; }
Add a filter that will be passed to the API query
12,863
public function resetFilters ( $ field = null ) { if ( is_null ( $ field ) ) { $ this -> filters = [ ] ; } else { if ( isset ( $ this -> filters [ $ field ] ) ) { unset ( $ this -> filters [ $ field ] ) ; } } return $ this ; }
Remove filter matching given identifier or all filters if empty
12,864
public function load ( string $ locale ) : array { $ filename = "{$this->path}/{$locale}.php" ; try { $ loaded = $ this -> files -> getRequire ( $ filename ) ; if ( ! is_array ( $ loaded ) ) { throw new InvalidResourceException ( ) ; } return $ loaded ; } catch ( FileNotFoundException $ e ) { throw new NotFoundResourceException ( "$filename not found." , 0 , $ e ) ; } catch ( \ Throwable $ e ) { throw new InvalidResourceException ( "$filename has invalid resources." , 0 , $ e ) ; } }
Loads a locale .
12,865
public function get ( $ id ) { return $ this -> _sendPayload ( $ this -> _getService ( $ this -> _pageServiceKey ) -> getTemplateLayout ( $ id ) ) ; }
Get template details
12,866
public function transform ( $ widget ) { $ widget = $ this -> entityToArray ( Widget :: class , $ widget ) ; return [ 'id' => ( int ) $ widget [ 'id' ] , 'name' => $ widget [ 'name' ] , 'args' => array_camel_case_keys ( $ widget [ 'args' ] ) , 'isActive' => ( bool ) $ widget [ 'is_active' ] , 'isCacheable' => ( bool ) $ widget [ 'is_cacheable' ] , 'createdAt' => $ widget [ 'created_at' ] , 'updatedAt' => $ widget [ 'updated_at' ] , ] ; }
Transforms widget entity
12,867
public function setConditionBuilder ( \ pwf \ components \ querybuilder \ interfaces \ ConditionBuilder $ builder ) { $ this -> conditionBuilder = $ builder ; return $ this ; }
Set condition builder
12,868
protected function write ( array $ record ) { $ level = $ record [ 'level' ] ; $ message = $ record [ 'formatted' ] ; $ context = empty ( $ record [ 'context' ] ) ? null : $ record [ 'context' ] ; $ time = $ record [ 'datetime' ] -> format ( 'c' ) ; $ this -> toConsole ( $ time , $ level , $ message , $ context ) ; }
Record s writer
12,869
private function toConsole ( $ time , $ level , $ message , $ context ) { $ color = static :: $ colors [ $ level ] ; $ pattern = "<%s>%s</%s>" ; $ message = sprintf ( $ pattern , $ color , $ message , $ color ) ; $ this -> outputcontroller -> out ( $ message ) ; if ( ! empty ( $ context ) && $ this -> include_context ) { $ this -> outputcontroller -> out ( sprintf ( $ pattern , $ color , var_export ( $ context , true ) , $ color ) ) ; } }
Send record to console formatting it
12,870
public function render ( ) { if ( $ this -> onBeforeRender ( ) === false ) { return $ this -> notFound ( ) ; } $ method = \ sb \ Gateway :: $ request -> method ; if ( method_exists ( $ this , $ method ) ) { $ reflection = new \ ReflectionMethod ( $ this , $ method ) ; $ docs = $ reflection -> getDocComment ( ) ; $ servable = false ; if ( ! empty ( $ docs ) ) { if ( preg_match ( "~@servable (true|false)~" , $ docs , $ match ) ) { $ servable = $ match [ 1 ] == 'true' ? true : false ; } } if ( $ servable ) { return $ this -> filterOutput ( $ this -> $ method ( ) ) ; } else { return $ this -> filterOutput ( $ this -> notFound ( $ method ) ) ; } } else { return $ this -> filterOutput ( $ this -> notFound ( $ method ) ) ; } }
Used to render the output through the filterOutput method by calling the handler appropriate to the HTTP request
12,871
protected function getByEmail ( $ email ) { $ users = $ this -> _client -> get ( '/users?search=' . urlencode ( $ email ) ) ; return isset ( $ users [ 0 ] ) ? $ users [ 0 ] : false ; }
Loads a user by email
12,872
public function query ( $ statement ) { if ( 1 == func_num_args ( ) ) { return $ this -> getPDO ( ) -> query ( $ statement ) ; } return call_user_func_array ( array ( $ this -> getPDO ( ) , __FUNCTION__ ) , func_get_args ( ) ) ; }
Executes an SQL statement returning a result set as a PDOStatement object overloading is supported
12,873
public function getFilesList ( $ basePath ) { $ iterator = new AppendIterator ( ) ; foreach ( $ this -> getAllHandlers ( ) as $ handler ) { $ iterator -> append ( $ handler -> getFilesList ( $ basePath ) ) ; } return $ iterator ; }
Returns an AppendIterator with every handler s iterator
12,874
public function getProveedoresInvolucrados ( $ pedidoMercaderias ) { $ provs = [ ] ; foreach ( $ pedidoMercaderias as $ pm ) { if ( ! empty ( $ pm [ 'Mercaderia' ] [ 'Proveedor' ] [ 'id' ] ) ) { $ provs [ ] = $ pm [ 'Mercaderia' ] [ 'Proveedor' ] [ 'id' ] ; } if ( ! empty ( $ pm [ 'Mercaderia' ] [ 'Rubro' ] [ 'Proveedor' ] ) ) { foreach ( $ pm [ 'Mercaderia' ] [ 'Rubro' ] [ 'Proveedor' ] as $ rubro ) { $ provs [ ] = $ rubro [ 'id' ] ; } } } return $ provs ; }
filtrar los proveedores involucrados retornando un listado de ID s
12,875
public function canJumpToState ( $ state ) { if ( $ state instanceof StateInterface ) { $ state = $ state -> getName ( ) ; } $ this -> getState ( $ state ) ; return in_array ( $ this -> currentState -> getName ( ) , $ this -> statePrecedence [ $ state ] , true ) ; }
Tells if moving to the given state is allowed .
12,876
public function jumpToState ( $ state ) { if ( ! $ state instanceof StateInterface ) { $ state = $ this -> getState ( $ state ) ; } if ( ! $ this -> canJumpToState ( $ state ) ) { throw new StateException ( sprintf ( 'Can not jump from state "%s" to "%s".' , $ this -> currentState -> getName ( ) , $ state -> getName ( ) ) ) ; } $ this -> object -> setFiniteState ( $ state -> getName ( ) ) ; $ this -> currentState = $ state ; }
Moves to the given state if allowed .
12,877
protected static function extractDescription ( $ token ) { $ parts = preg_split ( '/\s+:\s+/' , trim ( $ token ) , 2 ) ; return count ( $ parts ) === 2 ? $ parts : [ $ token , null ] ; }
Parse the token into its token and description segments .
12,878
public function getParentId ( $ id ) { $ path = $ this -> getProperty ( $ id , self :: PATH ) ; array_pop ( $ path ) ; return empty ( $ path ) ? null : array_pop ( $ path ) ; }
Returns the id of the parent layout item
12,879
public function resolveId ( $ id ) { return $ this -> aliases -> has ( $ id ) ? $ this -> aliases -> getId ( $ id ) : $ id ; }
Returns real id of the layout item
12,880
public function has ( $ id ) { $ id = $ this -> resolveId ( $ id ) ; return isset ( $ this -> items [ $ id ] ) ; }
Checks if the layout item with the given id exists
12,881
public function add ( $ id , $ parentId , $ blockType , array $ options = [ ] , $ siblingId = null , $ prepend = null ) { $ this -> validateId ( $ id , true ) ; if ( isset ( $ this -> items [ $ id ] ) ) { throw new Exception \ ItemAlreadyExistsException ( sprintf ( 'The "%s" item already exists.' . ' Remove existing item before add the new item with the same id.' , $ id ) ) ; } if ( ! $ parentId && ! $ this -> hierarchy -> isEmpty ( ) ) { throw new Exception \ LogicException ( sprintf ( 'The "%s" item cannot be the root item' . ' because another root item ("%s") already exists.' , $ id , $ this -> hierarchy -> getRootId ( ) ) ) ; } if ( $ parentId ) { $ parentId = $ this -> validateAndResolveId ( $ parentId ) ; } if ( $ siblingId ) { $ siblingId = $ this -> resolveId ( $ siblingId ) ; if ( ! isset ( $ this -> items [ $ siblingId ] ) ) { throw new Exception \ ItemNotFoundException ( sprintf ( 'The "%s" sibling item does not exist.' , $ siblingId ) ) ; } if ( $ parentId && $ siblingId === $ parentId ) { throw new Exception \ LogicException ( 'The sibling item cannot be the same as the parent item.' ) ; } } $ path = $ parentId ? $ this -> getProperty ( $ parentId , self :: PATH , true ) : [ ] ; $ this -> hierarchy -> add ( $ path , $ id , $ siblingId , $ prepend ) ; $ path [ ] = $ id ; $ this -> items [ $ id ] = [ self :: PATH => $ path , self :: BLOCK_TYPE => $ blockType , self :: OPTIONS => $ options ] ; }
Adds a new item to the layout
12,882
public function remove ( $ id ) { $ id = $ this -> validateAndResolveId ( $ id ) ; $ path = $ this -> items [ $ id ] [ self :: PATH ] ; $ this -> hierarchy -> remove ( $ path ) ; unset ( $ this -> items [ $ id ] ) ; $ this -> aliases -> removeById ( $ id ) ; unset ( $ this -> blockThemes [ $ id ] ) ; $ pathLength = count ( $ path ) ; $ pathLastIndex = $ pathLength - 1 ; $ ids = array_keys ( $ this -> items ) ; foreach ( $ ids as $ itemId ) { $ currentPath = $ this -> items [ $ itemId ] [ self :: PATH ] ; if ( count ( $ currentPath ) > $ pathLength && $ currentPath [ $ pathLastIndex ] === $ id ) { unset ( $ this -> items [ $ itemId ] ) ; $ this -> aliases -> removeById ( $ itemId ) ; unset ( $ this -> blockThemes [ $ itemId ] ) ; } } }
Removes the given item from the layout
12,883
public function hasProperty ( $ id , $ name , $ directAccess = false ) { if ( ! $ directAccess ) { $ id = $ this -> validateAndResolveId ( $ id ) ; } return isset ( $ this -> items [ $ id ] [ $ name ] ) || array_key_exists ( $ name , $ this -> items [ $ id ] ) ; }
Checks if the layout item has the given additional property
12,884
public function getProperty ( $ id , $ name , $ directAccess = false ) { if ( $ directAccess ) { if ( ! isset ( $ this -> items [ $ id ] [ $ name ] ) ) { return null ; } return $ this -> items [ $ id ] [ $ name ] ; } $ id = $ this -> validateAndResolveId ( $ id ) ; if ( ! isset ( $ this -> items [ $ id ] [ $ name ] ) && ! array_key_exists ( $ name , $ this -> items [ $ id ] ) ) { throw new Exception \ LogicException ( sprintf ( 'The "%s" item does not have "%s" property.' , $ id , $ name ) ) ; } return $ this -> items [ $ id ] [ $ name ] ; }
Gets a value of an additional property for the layout item
12,885
public function setProperty ( $ id , $ name , $ value ) { $ id = $ this -> validateAndResolveId ( $ id ) ; $ this -> items [ $ id ] [ $ name ] = $ value ; }
Sets a value of an additional property for the layout item
12,886
public function addAlias ( $ alias , $ id ) { $ this -> validateAlias ( $ alias , true ) ; $ this -> validateId ( $ id , true ) ; if ( $ alias === $ id ) { throw new Exception \ LogicException ( sprintf ( 'The "%s" sting cannot be used as an alias for "%s" item' . ' because an alias cannot be equal to the item id.' , $ alias , $ id ) ) ; } if ( isset ( $ this -> items [ $ alias ] ) ) { throw new Exception \ LogicException ( sprintf ( 'The "%s" sting cannot be used as an alias for "%s" item' . ' because another item with the same id exists.' , $ alias , $ id ) ) ; } if ( ! isset ( $ this -> items [ $ this -> resolveId ( $ id ) ] ) ) { throw new Exception \ ItemNotFoundException ( sprintf ( 'The "%s" item does not exist.' , $ id ) ) ; } $ this -> aliases -> add ( $ alias , $ id ) ; }
Creates an alias for the specified layout item
12,887
public function removeAlias ( $ alias ) { $ this -> validateAlias ( $ alias ) ; if ( ! $ this -> aliases -> has ( $ alias ) ) { throw new Exception \ AliasNotFoundException ( sprintf ( 'The "%s" item alias does not exist.' , $ alias ) ) ; } $ this -> aliases -> remove ( $ alias ) ; }
Removes the layout item alias
12,888
public function getHierarchy ( $ id ) { $ path = $ this -> getProperty ( $ id , self :: PATH ) ; return $ this -> hierarchy -> get ( $ path ) ; }
Returns the layout items hierarchy from the given path
12,889
public function getHierarchyIterator ( $ id ) { $ id = $ this -> validateAndResolveId ( $ id ) ; $ children = $ this -> hierarchy -> get ( $ this -> getProperty ( $ id , self :: PATH , true ) ) ; return new HierarchyIterator ( $ id , $ children ) ; }
Returns an iterator which can be used to get ids of all children of the given item The iteration is performed from parent to child
12,890
protected function validateId ( $ id , $ fullCheck = false ) { if ( ! $ id ) { throw new Exception \ InvalidArgumentException ( 'The item id must not be empty.' ) ; } if ( $ fullCheck ) { if ( ! is_string ( $ id ) ) { throw new Exception \ UnexpectedTypeException ( $ id , 'string' , 'id' ) ; } if ( ! $ this -> isValidId ( $ id ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'The "%s" string cannot be used as the item id because it contains illegal characters. ' . 'The valid item id should start with a letter and only contain ' . 'letters, numbers, underscores ("_"), hyphens ("-") and colons (":").' , $ id ) ) ; } } }
Checks if the given value can be used as the layout item id
12,891
protected function validateAndResolveId ( $ id ) { $ this -> validateId ( $ id ) ; $ id = $ this -> resolveId ( $ id ) ; if ( ! isset ( $ this -> items [ $ id ] ) ) { throw new Exception \ ItemNotFoundException ( sprintf ( 'The "%s" item does not exist.' , $ id ) ) ; } return $ id ; }
Checks the layout item id for empty and returns real id Also this method raises an exception if the layout item does not exist
12,892
protected function validateAlias ( $ alias , $ fullCheck = false ) { if ( ! $ alias ) { throw new Exception \ InvalidArgumentException ( 'The item alias must not be empty.' ) ; } if ( $ fullCheck ) { if ( ! is_string ( $ alias ) ) { throw new Exception \ UnexpectedTypeException ( $ alias , 'string' , 'alias' ) ; } if ( ! $ this -> isValidId ( $ alias ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'The "%s" string cannot be used as the item alias because it contains illegal characters. ' . 'The valid alias should start with a letter and only contain ' . 'letters, numbers, underscores ("_"), hyphens ("-") and colons (":").' , $ alias ) ) ; } } }
Checks if the given value can be used as an alias for the layout item
12,893
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ this -> setupEnvironment ( 'administrator' , $ input , $ output ) ; $ this -> joomla -> setCfg ( 'debug' , 1 ) ; $ installer = \ JInstaller :: getInstance ( ) ; if ( $ installer -> install ( $ this -> handleExtension ( $ input , $ output ) ) ) { $ output -> writeln ( $ this -> getExtensionInfo ( $ installer ) ) ; return 0 ; } else { $ output -> writeln ( 'Installation failed due to unknown reason.' ) ; return 1 ; } }
Execute the install command
12,894
protected function handleExtension ( InputInterface $ input , OutputInterface $ output ) { $ source = $ input -> getArgument ( 'extension' ) ; if ( strpos ( $ source , '://' ) ) { $ tmpPath = $ this -> handleDownload ( $ output , $ source ) ; } elseif ( is_dir ( $ source ) ) { $ tmpPath = $ this -> handleDirectory ( $ output , $ source ) ; } else { $ tmpPath = $ this -> handleArchive ( $ output , $ source ) ; } return $ tmpPath ; }
Handle the specified extension An extension can be provided as a download a directory or an archive . This method prepares the installation by providing the extension in a temporary directory ready for install .
12,895
private function getExtensionInfo ( $ installer ) { $ manifest = $ installer -> getManifest ( ) ; $ data = $ this -> joomla -> getExtensionInfo ( $ manifest ) ; $ message = array ( 'Installed ' . $ data [ 'type' ] . ' <info>' . $ data [ 'name' ] . '</info> version <info>' . $ data [ 'version' ] . '</info>' , '' , wordwrap ( $ data [ 'description' ] , 60 ) , '' ) ; return $ message ; }
Get information about the installed extension
12,896
private function handleDownload ( OutputInterface $ output , $ source ) { $ this -> writeln ( $ output , "Downloading $source" , OutputInterface :: VERBOSITY_VERBOSE ) ; return $ this -> unpack ( \ JInstallerHelper :: downloadPackage ( $ source ) ) ; }
Prepare the installation for an extension specified by a URL
12,897
private function handleDirectory ( OutputInterface $ output , $ source ) { $ tmpDir = $ this -> joomla -> getCfg ( 'tmp_path' ) ; $ tmpPath = $ tmpDir . '/' . uniqid ( 'install_' ) ; $ this -> writeln ( $ output , "Copying $source" , OutputInterface :: VERBOSITY_VERBOSE ) ; mkdir ( $ tmpPath ) ; copy ( $ source , $ tmpPath ) ; return $ tmpPath ; }
Prepare the installation for an extension specified by a directory
12,898
private function handleArchive ( OutputInterface $ output , $ source ) { $ tmpDir = $ this -> joomla -> getCfg ( 'tmp_path' ) ; $ tmpPath = $ tmpDir . '/' . basename ( $ source ) ; $ this -> writeln ( $ output , "Extracting $source" , OutputInterface :: VERBOSITY_VERBOSE ) ; copy ( $ source , $ tmpPath ) ; return $ this -> unpack ( $ tmpPath ) ; }
Prepare the installation for an extension in an archive
12,899
public function setCustomer ( ChildCustomer $ v = null ) { if ( $ v === null ) { $ this -> setCustomerId ( NULL ) ; } else { $ this -> setCustomerId ( $ v -> getId ( ) ) ; } $ this -> aCustomer = $ v ; if ( $ v !== null ) { $ v -> addCustomerCustomerGroup ( $ this ) ; } return $ this ; }
Declares an association between this object and a ChildCustomer object .