idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
17,500
public function getAll ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> entrypoints ( ) -> getAll ( $ appId , $ scanId , $ queryParams ) ; return new EntrypointsResponse ( $ response ) ; }
Get all entrypoints for a scan
17,501
public function getById ( $ appId , $ scanId , $ entrypointId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> entrypoints ( ) -> getById ( $ appId , $ scanId , $ entrypointId , $ queryParams ) ; return new EntrypointResponse ( $ response ) ; }
Get entrypoint for scan by id
17,502
public static function hydrateCollection ( array $ taints ) { $ hydrated = [ ] ; foreach ( $ taints as $ taint ) { $ hydrated [ ] = self :: hydrate ( $ taint ) ; } return $ hydrated ; }
Hydrate a collection of taint objects into a collection of TaintEntity objects
17,503
public static function hydrate ( stdClass $ taint ) { $ hydrated = new TaintEntity ( ) ; if ( isset ( $ taint -> id ) ) { $ hydrated -> setId ( $ taint -> id ) ; } if ( isset ( $ taint -> start_line ) ) { $ hydrated -> setStartLine ( $ taint -> start_line ) ; } if ( isset ( $ taint -> end_line ) ) { $ hydrated -> setEndLine ( $ taint -> end_line ) ; } if ( isset ( $ taint -> start_column ) ) { $ hydrated -> setStartColumn ( $ taint -> start_column ) ; } if ( isset ( $ taint -> end_column ) ) { $ hydrated -> setEndColumn ( $ taint -> end_column ) ; } return $ hydrated ; }
Hydrate a taint object into a TaintEntity object
17,504
public function setCatalogId ( int $ nb_catalog_id ) : CNabuDataObject { if ( $ nb_catalog_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_catalog_id" ) ) ; } $ this -> setValue ( 'nb_catalog_id' , $ nb_catalog_id ) ; return $ this ; }
Sets the Catalog Id attribute value .
17,505
public static function hydrateCollection ( array $ concats ) { $ hydrated = [ ] ; foreach ( $ concats as $ concat ) { $ hydrated [ ] = self :: hydrate ( $ concat ) ; } return $ hydrated ; }
Hydrate a collection of concat objects into a collection of ConcatEntity objects
17,506
public static function hydrate ( stdClass $ concat ) { $ hydrated = new ConcatEntity ( ) ; if ( isset ( $ concat -> id ) ) { $ hydrated -> setId ( $ concat -> id ) ; } if ( isset ( $ concat -> line ) ) { $ hydrated -> setLine ( $ concat -> line ) ; } if ( isset ( $ concat -> start_line ) ) { $ hydrated -> setStartLine ( $ concat -> start_line ) ; } if ( isset ( $ concat -> end_line ) ) { $ hydrated -> setEndLine ( $ concat -> end_line ) ; } if ( isset ( $ concat -> file ) ) { $ hydrated -> setFile ( FileHydrator :: hydrate ( $ concat -> file ) ) ; } if ( isset ( $ concat -> function ) ) { $ hydrated -> setFunction ( CustomFunctionHydrator :: hydrate ( $ concat -> function ) ) ; } if ( isset ( $ concat -> class ) ) { $ hydrated -> setClass ( CustomClassHydrator :: hydrate ( $ concat -> class ) ) ; } if ( isset ( $ concat -> start_column ) ) { $ hydrated -> setStartColumn ( $ concat -> start_column ) ; } if ( isset ( $ concat -> end_column ) ) { $ hydrated -> setEndColumn ( $ concat -> end_column ) ; } if ( isset ( $ concat -> taint ) ) { $ hydrated -> setTaint ( TaintHydrator :: hydrate ( $ concat -> taint ) ) ; } return $ hydrated ; }
Hydrate a concat object into a ConcatEntity object
17,507
public function getAll ( array $ queryParams = [ ] ) { $ response = $ this -> api -> oauth2 ( ) -> clients ( ) -> getAll ( $ queryParams ) ; return new ClientsResponse ( $ response ) ; }
Get all clients
17,508
public function getById ( $ clientId , array $ queryParams = [ ] ) { $ response = $ this -> api -> oauth2 ( ) -> clients ( ) -> getById ( $ clientId , $ queryParams ) ; return new ClientResponse ( $ response ) ; }
Get a client by id
17,509
public function create ( ClientBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> oauth2 ( ) -> clients ( ) -> create ( $ input -> toArray ( ) , $ queryParams ) ; return new ClientResponse ( $ response ) ; }
Create a new client
17,510
public function delete ( $ clientId , array $ queryParams ) { $ response = $ this -> api -> oauth2 ( ) -> clients ( ) -> delete ( $ clientId , $ queryParams ) ; return new BaseResponse ( $ response ) ; }
Delete a client
17,511
public function equals ( Account $ account ) : bool { if ( $ this -> name !== $ account -> name ) { return false ; } if ( ! $ this -> homePage -> equals ( $ account -> homePage ) ) { return false ; } return true ; }
Checks if another account is equal .
17,512
private function addFields ( $ modelData ) { $ fields = '' ; $ firstIteration = true ; foreach ( $ modelData -> fields as $ field ) { if ( $ firstIteration ) { $ fields .= self :: getInputFor ( $ field ) . PHP_EOL ; $ firstIteration = false ; } else { $ fields .= $ this -> tab ( 2 ) . self :: getInputFor ( $ field ) . PHP_EOL ; } } $ this -> stub = str_replace ( '{{fields}}' , $ fields , $ this -> stub ) ; return $ this ; }
Add fields to the edit view .
17,513
private function replacePrimaryKey ( $ modelData ) { $ primaryKey = 'id' ; foreach ( $ modelData -> fields as $ field ) { if ( $ field -> index == 'primary' ) { $ primaryKey = $ field -> name ; break ; } } $ this -> stub = str_replace ( '{{primaryKey}}' , $ primaryKey , $ this -> stub ) ; return $ this ; }
Replace the primary key .
17,514
protected function registerHTTPServerInterface ( INabuHTTPServerInterface $ interface ) : bool { $ hash = $ interface -> getHash ( ) ; if ( is_array ( $ this -> http_server_interface_list ) && array_key_exists ( $ hash , $ this -> http_server_interface_list ) ) { throw new ENabuHTTPException ( ENabuHTTPException :: ERROR_HTTP_SERVER_INSTANCE_ALREADY_REGISTERED , array ( get_class ( $ interface ) ) ) ; } if ( $ this -> http_server_interface_list === null ) { $ this -> http_server_interface_list = array ( $ hash => $ interface ) ; } else { $ this -> http_server_interface_list [ $ hash ] = $ interface ; } return $ interface -> init ( ) ; }
Register a new HTTP Server Interface instance .
17,515
public function getClassesFromNamespace ( $ namespace = null ) { $ namespace = $ namespace ? : $ this -> getAppNamespace ( ) ; $ path = $ this -> convertNamespaceToPath ( $ namespace ) ; return $ this -> finder -> findClasses ( $ path ) ; }
Get all classes for a given namespace .
17,516
protected function convertNamespaceToPath ( $ namespace ) { $ appNamespace = $ this -> getAppNamespace ( ) ; if ( substr ( $ namespace , 0 , strlen ( $ appNamespace ) ) != $ appNamespace ) { return null ; } $ subNamespace = substr ( $ namespace , strlen ( $ appNamespace ) ) ; $ subPath = str_replace ( '\\' , '/' , $ subNamespace ) ; return app ( 'path' ) . '/' . $ subPath ; }
Convert given namespace to file path .
17,517
public function clean ( ) { if ( $ this -> files -> exists ( $ this -> path ) ) { $ this -> files -> cleanDirectory ( $ this -> path ) ; } }
Clean model directory .
17,518
protected function getPrimaryKeyColumn ( $ entityMetadata ) { $ primaryKey = 'id' ; $ incrementing = true ; foreach ( $ entityMetadata [ 'table' ] [ 'columns' ] as $ column ) { if ( $ column [ 'primary' ] ) { return $ column ; } } }
Get primary key and auto increment value .
17,519
protected function replaceTraits ( $ entityMetadata , & $ stub ) { $ traits = [ ] ; if ( ! empty ( $ entityMetadata [ 'versionTable' ] ) ) { $ traits [ 'versionable' ] = 'use \ProAI\Versioning\Versionable;' ; } if ( $ entityMetadata [ 'softDeletes' ] ) { $ traits [ 'softDeletes' ] = 'use \ProAI\Versioning\SoftDeletes;' ; } if ( $ this -> hasAutoUuidColumn ( $ entityMetadata ) ) { $ traits [ 'autoUuid' ] = 'use \ProAI\Datamapper\Eloquent\AutoUuid;' ; } $ separator = PHP_EOL . PHP_EOL . ' ' ; $ stub = str_replace ( '{{traits}}' , implode ( $ separator , $ traits ) . $ separator , $ stub ) ; }
Replace traits .
17,520
protected function replaceVersionable ( $ versionTable , & $ stub ) { $ option = ( ! empty ( $ versionTable ) ) ? true : false ; $ stub = str_replace ( '{{versionable}}' , ( ! empty ( $ versionTable ) ) ? 'use \ProAI\Versioning\Versionable;' . PHP_EOL . PHP_EOL . ' ' : '' , $ stub ) ; }
Replace versionable .
17,521
protected function replaceAutoUuids ( $ entityMetadata , & $ stub ) { $ autoUuids = [ ] ; foreach ( $ entityMetadata [ 'table' ] [ 'columns' ] as $ column ) { if ( ! empty ( $ column [ 'options' ] [ 'autoUuid' ] ) ) { $ autoUuids [ ] = $ column [ 'name' ] ; } } $ stub = str_replace ( '{{autoUuids}}' , $ this -> getArrayAsText ( $ autoUuids ) , $ stub ) ; }
Replace autoUuids .
17,522
protected function replaceVersioned ( $ versionTable , & $ stub ) { if ( ! $ versionTable ) { $ stub = str_replace ( '{{versioned}}' , $ this -> getArrayAsText ( [ ] ) , $ stub ) ; return ; } $ versioned = [ ] ; foreach ( $ versionTable [ 'columns' ] as $ column ) { if ( ! $ column [ 'primary' ] || $ column [ 'name' ] == 'version' ) { $ versioned [ ] = $ column [ 'name' ] ; } } $ stub = str_replace ( '{{versioned}}' , $ this -> getArrayAsText ( $ versioned ) , $ stub ) ; }
Replace versioned .
17,523
protected function replaceMapping ( $ entityMetadata , & $ stub ) { $ attributes = [ ] ; foreach ( $ entityMetadata [ 'attributes' ] as $ attributeMetadata ) { $ attributes [ $ attributeMetadata [ 'name' ] ] = $ attributeMetadata [ 'columnName' ] ; } $ embeddeds = [ ] ; foreach ( $ entityMetadata [ 'embeddeds' ] as $ embeddedMetadata ) { $ embedded = [ ] ; $ embedded [ 'class' ] = $ embeddedMetadata [ 'class' ] ; $ embedded [ 'columnPrefix' ] = $ embeddedMetadata [ 'columnPrefix' ] ; $ embeddedAttributes = [ ] ; foreach ( $ embeddedMetadata [ 'attributes' ] as $ attributeMetadata ) { $ embeddedAttributes [ $ attributeMetadata [ 'name' ] ] = $ attributeMetadata [ 'columnName' ] ; } $ embedded [ 'attributes' ] = $ embeddedAttributes ; $ embeddeds [ $ embeddedMetadata [ 'name' ] ] = $ embedded ; } $ relations = [ ] ; foreach ( $ entityMetadata [ 'relations' ] as $ relationMetadata ) { $ relation = [ ] ; $ relation [ 'type' ] = $ relationMetadata [ 'type' ] ; if ( $ relation [ 'type' ] == 'belongsToMany' || $ relation [ 'type' ] == 'morphToMany' ) { $ relation [ 'inverse' ] = ( ! empty ( $ relationMetadata [ 'options' ] [ 'inverse' ] ) ) ; } $ relations [ $ relationMetadata [ 'name' ] ] = $ relation ; } $ mapping = [ 'attributes' => $ attributes , 'embeddeds' => $ embeddeds , 'relations' => $ relations , ] ; $ stub = str_replace ( '{{mapping}}' , $ this -> getArrayAsText ( $ mapping ) , $ stub ) ; }
Replace mapping .
17,524
protected function replaceRelations ( $ relations , & $ stub ) { $ textRelations = [ ] ; foreach ( $ relations as $ key => $ relation ) { $ relationStub = $ this -> stubs [ 'relation' ] ; $ options = [ ] ; if ( $ relation [ 'type' ] != 'morphTo' ) { $ options [ ] = "'" . get_mapped_model ( $ relation [ 'relatedEntity' ] , false ) . "'" ; } foreach ( $ relation [ 'options' ] as $ name => $ option ) { if ( $ option === null ) { $ options [ ] = 'null' ; } elseif ( $ option === true ) { $ options [ ] = 'true' ; } elseif ( $ option === false ) { $ options [ ] = 'false' ; } else { if ( $ name == 'throughEntity' ) { $ options [ ] = "'" . get_mapped_model ( $ option , false ) . "'" ; } elseif ( $ name != 'morphableClasses' ) { $ options [ ] = "'" . $ option . "'" ; } } } $ options = implode ( ", " , $ options ) ; $ relationStub = str_replace ( '{{name}}' , $ relation [ 'name' ] , $ relationStub ) ; $ relationStub = str_replace ( '{{options}}' , $ options , $ relationStub ) ; $ relationStub = str_replace ( '{{ucfirst_type}}' , ucfirst ( $ relation [ 'type' ] ) , $ relationStub ) ; $ relationStub = str_replace ( '{{type}}' , $ relation [ 'type' ] , $ relationStub ) ; $ textRelations [ ] = $ relationStub ; if ( $ relation [ 'type' ] == 'morphTo' || ( $ relation [ 'type' ] == 'morphToMany' && ! $ relation [ 'options' ] [ 'inverse' ] ) ) { $ morphStub = $ this -> stubs [ 'morph_extension' ] ; $ morphableClasses = [ ] ; foreach ( $ relation [ 'options' ] [ 'morphableClasses' ] as $ key => $ name ) { $ morphableClasses [ $ key ] = get_mapped_model ( $ name , false ) ; } $ morphStub = str_replace ( '{{name}}' , $ relation [ 'name' ] , $ morphStub ) ; $ morphStub = str_replace ( '{{morphName}}' , ucfirst ( $ relation [ 'options' ] [ 'morphName' ] ) , $ morphStub ) ; $ morphStub = str_replace ( '{{types}}' , $ this -> getArrayAsText ( $ morphableClasses , 2 ) , $ morphStub ) ; $ textRelations [ ] = $ morphStub ; } } $ stub = str_replace ( '{{relations}}' , implode ( PHP_EOL . PHP_EOL , $ textRelations ) , $ stub ) ; }
Replace relations .
17,525
protected function getArrayAsText ( $ array , $ intendBy = 1 ) { $ intention = '' ; for ( $ i = 0 ; $ i < $ intendBy ; $ i ++ ) { $ intention .= ' ' ; } $ text = var_export ( $ array , true ) ; $ text = preg_replace ( '/[ ]{2}/' , ' ' , $ text ) ; $ text = preg_replace ( "/\=\>[ \n ]+array[ ]+\(/" , '=> array(' , $ text ) ; return $ text = preg_replace ( "/\n/" , "\n" . $ intention , $ text ) ; }
Get an array in text format .
17,526
public function getProject ( CNabuCustomer $ nb_customer = null , $ force = false ) { if ( $ nb_customer !== null && ( $ this -> nb_project === null || $ force ) ) { $ this -> nb_project = null ; if ( $ this instanceof CNabuDataObject && $ this -> contains ( NABU_PROJECT_FIELD_ID ) ) { $ this -> nb_project = $ nb_customer -> getProject ( $ this ) ; } } return $ this -> nb_project ; }
Gets the Project instance .
17,527
public function setProject ( CNabuProject $ nb_project , $ field = NABU_PROJECT_FIELD_ID ) { $ this -> nb_project = $ nb_project ; if ( $ this instanceof CNabuDataObject ) { $ this -> transferValue ( $ nb_project , NABU_PROJECT_FIELD_ID , $ field ) ; } return $ this ; }
Sets the Project instance that owns this object and sets the field containing the project id .
17,528
public function getAll ( $ appId , $ profileId , array $ queryParams ) { $ response = $ this -> api -> applications ( ) -> profiles ( ) -> sources ( ) -> getAll ( $ appId , $ profileId , $ queryParams ) ; return new SourcesResponse ( $ response ) ; }
Get all sources for a profile profile
17,529
public function getById ( $ appId , $ profileId , $ sourceId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> profiles ( ) -> sources ( ) -> getById ( $ appId , $ profileId , $ sourceId , $ queryParams ) ; return new SourceResponse ( $ response ) ; }
Get source for profile profile by id
17,530
public function create ( $ appId , $ profileId , SourceBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> profiles ( ) -> sources ( ) -> create ( $ appId , $ profileId , $ input -> toArray ( ) , $ queryParams ) ; return new SourceResponse ( $ response ) ; }
Create source for profile profile
17,531
public function setErrorReporting ( int $ error_reporting = 0 ) : CNabuDataObject { if ( $ error_reporting === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$error_reporting" ) ) ; } $ this -> setValue ( 'nb_site_module_error_reporting' , $ error_reporting ) ; return $ this ; }
Sets the Site Module Error Reporting attribute value .
17,532
public function setDebugging ( string $ debugging = "F" ) : CNabuDataObject { if ( $ debugging === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$debugging" ) ) ; } $ this -> setValue ( 'nb_site_module_debugging' , $ debugging ) ; return $ this ; }
Sets the Site Module Debugging attribute value .
17,533
protected function replaceClassName ( $ modelName ) { $ this -> stub = str_replace ( '{{class_name}}' , $ modelName , $ this -> stub ) ; $ this -> stub = str_replace ( '{{class_name_lw}}' , strtolower ( $ modelName ) , $ this -> stub ) ; return $ this ; }
Replace the class name .
17,534
protected function replaceNamespace ( stdClass $ scaffolderConfig ) { $ this -> stub = str_replace ( '{{namespace}}' , $ scaffolderConfig -> namespaces -> models , $ this -> stub ) ; return $ this ; }
Replace the namespace .
17,535
static public function getRolesForSite ( $ nb_site ) : CNabuRoleList { $ nb_site_id = nb_getMixedValue ( $ nb_site , NABU_SITE_FIELD_ID ) ; if ( is_numeric ( $ nb_site_id ) ) { $ retval = self :: buildObjectListFromSQL ( 'nb_role_id' , 'select r.* ' . 'from nb_role r, nb_site_role sr, nb_site s ' . 'where r.nb_role_id=sr.nb_role_id ' . 'and sr.nb_site_id=s.nb_site_id ' . 'and s.nb_site_id=%site_id$d' , array ( 'site_id' => $ nb_site_id ) , ( $ nb_site instanceof CNabuSite ? $ nb_site : null ) ) ; } else { $ retval = new CNabuRoleList ( ) ; } return $ retval ; }
Get the Role List of Roles assigned to a Site .
17,536
public function setText ( $ text ) { if ( ! is_string ( $ text ) ) { throw new \ InvalidArgumentException ( __METHOD__ . "() expects parameter one, text, to be a string" ) ; } $ this -> text = $ text ; return $ this ; }
Sets the chunker s text
17,537
public function getMaxChunks ( ) { return ceil ( mb_strlen ( ( string ) $ this -> text , $ this -> encoding ) / $ this -> size ) ; }
Returns the maximum number of chunks in the text
17,538
protected function getChunk ( $ offset ) { if ( ! is_numeric ( $ offset ) || ! is_int ( + $ offset ) || $ offset < 0 ) { throw new \ InvalidArgumentException ( __METHOD__ . "() expects parameter one, offset, to be a positive " . "integer or zero" ) ; } $ chunk = false ; $ text = ( string ) $ this -> text ; if ( $ offset < mb_strlen ( $ text ) ) { $ chunk = mb_substr ( $ text , $ offset , $ this -> size , $ this -> encoding ) ; } return $ chunk ; }
Returns a string chunk or false if chunk does not exist
17,539
private function replaceNamespaceModelExtend ( stdClass $ scaffolderConfig ) { $ this -> stub = str_replace ( '{{namespace_model_extend}}' , $ scaffolderConfig -> inheritance -> model , $ this -> stub ) ; return $ this ; }
Replace the namespace which the model extends
17,540
public function setMediotecaTypeId ( int $ nb_medioteca_type_id ) : CNabuDataObject { if ( $ nb_medioteca_type_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_medioteca_type_id" ) ) ; } $ this -> setValue ( 'nb_medioteca_type_id' , $ nb_medioteca_type_id ) ; return $ this ; }
Sets the Medioteca Type Id attribute value .
17,541
public function equals ( Score $ score ) : bool { if ( null !== $ this -> scaled xor null !== $ score -> scaled ) { return false ; } if ( ( float ) $ this -> scaled !== ( float ) $ score -> scaled ) { return false ; } if ( null !== $ this -> raw xor null !== $ score -> raw ) { return false ; } if ( ( float ) $ this -> raw !== ( float ) $ score -> raw ) { return false ; } if ( null !== $ this -> min xor null !== $ score -> min ) { return false ; } if ( ( float ) $ this -> min !== ( float ) $ score -> min ) { return false ; } if ( null !== $ this -> max xor null !== $ score -> max ) { return false ; } if ( ( float ) $ this -> max !== ( float ) $ score -> max ) { return false ; } return true ; }
Checks if another score is equal .
17,542
public function renderEmailBody ( string $ templateName , string $ templatePackage , string $ format , array $ variables , bool $ emogrify = true ) : string { $ standaloneView = new StandaloneView ( ) ; $ request = $ standaloneView -> getRequest ( ) ; $ request -> setFormat ( $ format ) ; $ templatePath = sprintf ( 'resource://%s/Private/EmailTemplates/' , $ templatePackage ) ; $ templatePathAndFilename = sprintf ( '%s%s.%s' , $ templatePath , $ templateName , $ format ) ; $ standaloneView -> setTemplatePathAndFilename ( $ templatePathAndFilename ) ; $ standaloneView -> setLayoutRootPath ( $ templatePath . 'Layouts' ) ; $ standaloneView -> setPartialRootPath ( $ templatePath . 'Partials' ) ; $ standaloneView -> assignMultiple ( $ variables ) ; $ emailBody = $ standaloneView -> render ( ) ; $ emogrifiedFormats = [ 'htm' , 'html' ] ; if ( $ emogrify && in_array ( $ format , $ emogrifiedFormats ) ) { $ emogrifier = new Emogrifier ( $ emailBody ) ; $ emailBody = $ emogrifier -> emogrify ( ) ; } return $ emailBody ; }
Renders the email body of a template . Can be used directly to only render the email html body . if the given format is htm or html will automatically emogrify the email body . This can be skipped by setting the last parameter to false .
17,543
protected function sendMail ( Message $ mail ) : bool { $ allRecipients = $ mail -> getTo ( ) + $ mail -> getCc ( ) + $ mail -> getBcc ( ) ; $ totalNumberOfRecipients = count ( $ allRecipients ) ; $ actualNumberOfRecipients = 0 ; $ exceptionMessage = '' ; try { $ actualNumberOfRecipients = $ mail -> send ( ) ; } catch ( \ Exception $ e ) { $ exceptionMessage = $ e -> getMessage ( ) ; if ( $ this -> logSendingErrors === self :: LOG_LEVEL_LOG ) { $ this -> systemLogger -> logException ( $ e ) ; } elseif ( $ this -> logSendingErrors === self :: LOG_LEVEL_THROW ) { throw $ e ; } } $ emailInfo = [ 'recipients' => array_keys ( $ mail -> getTo ( ) + $ mail -> getCc ( ) + $ mail -> getBcc ( ) ) , 'failedRecipients' => $ mail -> getFailedRecipients ( ) , 'subject' => $ mail -> getSubject ( ) , 'id' => ( string ) $ mail -> getHeaders ( ) -> get ( 'Message-ID' ) ] ; if ( strlen ( $ exceptionMessage ) > 0 ) { $ emailInfo [ 'exception' ] = $ exceptionMessage ; } if ( $ actualNumberOfRecipients < $ totalNumberOfRecipients && $ this -> logSendingErrors === self :: LOG_LEVEL_LOG ) { $ this -> systemLogger -> log ( sprintf ( 'Could not send an email to all given recipients. Given %s, sent to %s' , $ totalNumberOfRecipients , $ actualNumberOfRecipients ) , LOG_ERR , $ emailInfo ) ; return false ; } if ( $ this -> logSendingSuccess === self :: LOG_LEVEL_LOG ) { $ this -> systemLogger -> log ( 'Email sent successfully.' , LOG_INFO , $ emailInfo ) ; } return true ; }
Sends a mail and logs or throws any errors depending on configuration
17,544
public function getAll ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> concats ( ) -> getAll ( $ appId , $ scanId , $ queryParams ) ; return new ConcatsResponse ( $ response ) ; }
Get all concats for a scan
17,545
public function getById ( $ appId , $ scanId , $ concatId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> concats ( ) -> getById ( $ appId , $ scanId , $ concatId , $ queryParams ) ; return new ConcatResponse ( $ response ) ; }
Get concat for scan by id
17,546
public static function hydrateCollection ( array $ validators ) { $ hydrated = [ ] ; foreach ( $ validators as $ validator ) { $ hydrated [ ] = self :: hydrate ( $ validator ) ; } return $ hydrated ; }
Hydrate a collection of validator objects into a collection of ValidatorEntity objects
17,547
public static function hydrate ( stdClass $ validator ) { $ hydrated = new ValidatorEntity ( ) ; if ( isset ( $ validator -> id ) ) { $ hydrated -> setId ( $ validator -> id ) ; } if ( isset ( $ validator -> class ) ) { $ hydrated -> setClass ( $ validator -> class ) ; } if ( isset ( $ validator -> method ) ) { $ hydrated -> setMethod ( $ validator -> method ) ; } if ( isset ( $ validator -> parameter ) ) { $ hydrated -> setParameter ( $ validator -> parameter ) ; } if ( isset ( $ validator -> characters ) ) { $ hydrated -> setCharacters ( $ validator -> characters ) ; } if ( isset ( $ validator -> issueType ) ) { $ hydrated -> setIssueType ( TypeHydrator :: hydrate ( $ validator -> issueType ) ) ; } return $ hydrated ; }
Hydrate a validator object into a ValidatorEntity object
17,548
public static function findByKey ( $ nb_customer , $ key ) { $ nb_customer_id = nb_getMixedValue ( $ nb_customer , 'nb_customer_id' ) ; if ( is_numeric ( $ nb_customer_id ) ) { $ retval = CNabuMediotecaType :: buildObjectFromSQL ( 'select * ' . 'from nb_medioteca_type ' . 'where nb_customer_id=%cust_id$d ' . "and nb_medioteca_type_key='%key\$s'" , array ( 'cust_id' => $ nb_customer_id , 'key' => $ key ) ) ; } else { $ retval = null ; } return $ retval ; }
Find an instance identified by nb_medioteca_type_key field .
17,549
public static function getAllMediotecaTypes ( CNabuCustomer $ nb_customer ) { $ nb_customer_id = nb_getMixedValue ( $ nb_customer , 'nb_customer_id' ) ; if ( is_numeric ( $ nb_customer_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_medioteca_type_id' , 'select * ' . 'from nb_medioteca_type ' . 'where nb_customer_id=%cust_id$d' , array ( 'cust_id' => $ nb_customer_id ) , $ nb_customer ) ; } else { $ retval = new CNabuMediotecaTypeList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_medioteca_type_id is the index and each value is an instance of class CNabuMediotecaTypeBase .
17,550
public static function getFilteredMediotecaTypeList ( $ nb_customer , $ q = null , $ fields = null , $ order = null , $ offset = 0 , $ num_items = 0 ) { $ nb_customer_id = nb_getMixedValue ( $ nb_customer , NABU_CUSTOMER_FIELD_ID ) ; if ( is_numeric ( $ nb_customer_id ) ) { $ fields_part = nb_prefixFieldList ( CNabuMediotecaTypeBase :: getStorageName ( ) , $ fields , false , true , '`' ) ; $ order_part = nb_prefixFieldList ( CNabuMediotecaTypeBase :: getStorageName ( ) , $ fields , false , false , '`' ) ; if ( $ num_items !== 0 ) { $ limit_part = ( $ offset > 0 ? $ offset . ', ' : '' ) . $ num_items ; } else { $ limit_part = false ; } $ nb_item_list = CNabuEngine :: getEngine ( ) -> getMainDB ( ) -> getQueryAsArray ( "select " . ( $ fields_part ? $ fields_part . ' ' : '* ' ) . 'from nb_medioteca_type ' . 'where ' . NABU_CUSTOMER_FIELD_ID . '=%cust_id$d ' . ( $ order_part ? "order by $order_part " : '' ) . ( $ limit_part ? "limit $limit_part" : '' ) , array ( 'cust_id' => $ nb_customer_id ) ) ; } else { $ nb_item_list = null ; } return $ nb_item_list ; }
Gets a filtered list of Medioteca Type instances represented as an array . Params allows the capability of select a subset of fields order by concrete fields or truncate the list by a number of rows starting in an offset .
17,551
public function getAll ( array $ queryParams = [ ] ) { $ response = $ this -> api -> sources ( ) -> getAll ( $ queryParams ) ; return new SourcesResponse ( $ response ) ; }
Get all directories from the root source directory
17,552
public function getById ( $ appId , $ aclId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> acls ( ) -> getById ( $ appId , $ aclId , $ queryParams ) ; return new AclResponse ( $ response ) ; }
Get a acl for application by id
17,553
public function create ( $ appId , AclBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> acls ( ) -> create ( $ appId , $ input -> toArray ( ) , $ queryParams ) ; return new AclResponse ( $ response ) ; }
Create a new acl for a application
17,554
public function update ( $ appId , $ aclId , AclBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> acls ( ) -> update ( $ appId , $ aclId , $ input -> toArray ( ) , $ queryParams ) ; return new AclResponse ( $ response ) ; }
Update existing acl for application by id
17,555
public function byVerb ( Verb $ verb ) : self { $ this -> filter [ 'verb' ] = $ verb -> getId ( ) -> getValue ( ) ; return $ this ; }
Filters by a verb .
17,556
public function byActivity ( Activity $ activity ) : self { $ this -> filter [ 'activity' ] = $ activity -> getId ( ) -> getValue ( ) ; return $ this ; }
Filter by an Activity .
17,557
public function limit ( int $ limit ) : self { if ( $ limit < 0 ) { throw new \ InvalidArgumentException ( 'Limit must be a non-negative integer' ) ; } $ this -> filter [ 'limit' ] = $ limit ; return $ this ; }
Sets the maximum number of Statements to return . The server side sets the maximum number of results when this value is not set or when it is 0 .
17,558
public function acquireItem ( $ key , $ index = false ) { if ( $ index === self :: INDEX_KEY ) { $ nb_site = CNabuEngine :: getEngine ( ) -> getApplication ( ) -> getRequest ( ) -> getSite ( ) ; $ retval = CNabuSiteTarget :: findByKey ( $ nb_site , $ key ) ; } else { $ retval = parent :: acquireItem ( $ key , $ index ) ; } return $ retval ; }
Overrides temporally this method to support nb_site_target_key acquisitions .
17,559
public function setSiteTargetCTAId ( int $ nb_site_target_cta_id ) : CNabuDataObject { if ( $ nb_site_target_cta_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_site_target_cta_id" ) ) ; } $ this -> setValue ( 'nb_site_target_cta_id' , $ nb_site_target_cta_id ) ; return $ this ; }
Sets the Site Target CTA Id attribute value .
17,560
public static function findByKey ( $ nb_medioteca , $ key ) { $ nb_medioteca_id = nb_getMixedValue ( $ nb_medioteca , 'nb_medioteca_id' ) ; if ( is_numeric ( $ nb_medioteca_id ) ) { $ retval = CNabuSiteTargetSection :: buildObjectFromSQL ( 'select * ' . 'from nb_site_target_section ' . 'where nb_medioteca_id=%medioteca_id$d ' . "and nb_site_target_section_key='%key\$s'" , array ( 'medioteca_id' => $ nb_medioteca_id , 'key' => $ key ) ) ; } else { $ retval = null ; } return $ retval ; }
Find an instance identified by nb_site_target_section_key field .
17,561
public static function getAllSiteTargetSections ( CNabuMedioteca $ nb_medioteca ) { $ nb_medioteca_id = nb_getMixedValue ( $ nb_medioteca , 'nb_medioteca_id' ) ; if ( is_numeric ( $ nb_medioteca_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_site_target_section_id' , 'select * ' . 'from nb_site_target_section ' . 'where nb_medioteca_id=%medioteca_id$d' , array ( 'medioteca_id' => $ nb_medioteca_id ) , $ nb_medioteca ) ; } else { $ retval = new CNabuSiteTargetSectionList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_site_target_section_id is the index and each value is an instance of class CNabuSiteTargetSectionBase .
17,562
public static function getFilteredSiteTargetSectionList ( $ nb_medioteca = null , $ q = null , $ fields = null , $ order = null , $ offset = 0 , $ num_items = 0 ) { $ nb_medioteca_id = nb_getMixedValue ( $ nb_customer , NABU_MEDIOTECA_FIELD_ID ) ; if ( is_numeric ( $ nb_medioteca_id ) ) { $ fields_part = nb_prefixFieldList ( CNabuSiteTargetSectionBase :: getStorageName ( ) , $ fields , false , true , '`' ) ; $ order_part = nb_prefixFieldList ( CNabuSiteTargetSectionBase :: getStorageName ( ) , $ fields , false , false , '`' ) ; if ( $ num_items !== 0 ) { $ limit_part = ( $ offset > 0 ? $ offset . ', ' : '' ) . $ num_items ; } else { $ limit_part = false ; } $ nb_item_list = CNabuEngine :: getEngine ( ) -> getMainDB ( ) -> getQueryAsArray ( "select " . ( $ fields_part ? $ fields_part . ' ' : '* ' ) . 'from nb_site_target_section ' . 'where ' . NABU_MEDIOTECA_FIELD_ID . '=%medioteca_id$d ' . ( $ order_part ? "order by $order_part " : '' ) . ( $ limit_part ? "limit $limit_part" : '' ) , array ( 'medioteca_id' => $ nb_medioteca_id ) ) ; } else { $ nb_item_list = null ; } return $ nb_item_list ; }
Gets a filtered list of Site Target Section instances represented as an array . Params allows the capability of select a subset of fields order by concrete fields or truncate the list by a number of rows starting in an offset .
17,563
public function setOrder ( int $ order ) : CNabuDataObject { if ( $ order === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$order" ) ) ; } $ this -> setValue ( 'nb_site_target_section_order' , $ order ) ; return $ this ; }
Sets the Site Target Section Order attribute value .
17,564
public function deauthenticate ( ResponseFactory $ response , Guard $ guard , JWTAuth $ auth ) { $ guard -> logout ( ) ; $ auth -> invalidate ( ) ; return $ response -> json ( [ ] ) ; }
Deauthenticate the user .
17,565
public function refresh ( ResponseFactory $ response , JWTAuth $ auth ) { try { $ token = $ auth -> parseToken ( ) -> refresh ( ) ; } catch ( JWTException $ e ) { throw new UnauthorizedHttpException ( 'jwt-auth' , $ e -> getMessage ( ) ) ; } return $ response -> json ( [ 'token' => $ token ] ) ; }
Refresh user token .
17,566
public static function getAllCommerceProducts ( CNabuCommerce $ nb_commerce ) { $ nb_commerce_id = nb_getMixedValue ( $ nb_commerce , 'nb_commerce_id' ) ; if ( is_numeric ( $ nb_commerce_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_commerce_product_id' , 'select * ' . 'from nb_commerce_product ' . 'where nb_commerce_id=%commerce_id$d' , array ( 'commerce_id' => $ nb_commerce_id ) , $ nb_commerce ) ; } else { $ retval = new CNabuCommerceProductList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_commerce_product_id is the index and each value is an instance of class CNabuCommerceProductBase .
17,567
public static function getFilteredCommerceProductList ( $ q = null , $ fields = null , $ order = null , $ offset = 0 , $ num_items = 0 ) { $ nb_commerce_id = nb_getMixedValue ( $ nb_customer , NABU_COMMERCE_FIELD_ID ) ; if ( is_numeric ( $ nb_commerce_id ) ) { $ fields_part = nb_prefixFieldList ( CNabuCommerceProductBase :: getStorageName ( ) , $ fields , false , true , '`' ) ; $ order_part = nb_prefixFieldList ( CNabuCommerceProductBase :: getStorageName ( ) , $ fields , false , false , '`' ) ; if ( $ num_items !== 0 ) { $ limit_part = ( $ offset > 0 ? $ offset . ', ' : '' ) . $ num_items ; } else { $ limit_part = false ; } $ nb_item_list = CNabuEngine :: getEngine ( ) -> getMainDB ( ) -> getQueryAsArray ( "select " . ( $ fields_part ? $ fields_part . ' ' : '* ' ) . 'from nb_commerce_product ' . 'where ' . NABU_COMMERCE_FIELD_ID . '=%commerce_id$d ' . ( $ order_part ? "order by $order_part " : '' ) . ( $ limit_part ? "limit $limit_part" : '' ) , array ( 'commerce_id' => $ nb_commerce_id ) ) ; } else { $ nb_item_list = null ; } return $ nb_item_list ; }
Gets a filtered list of Commerce Product instances represented as an array . Params allows the capability of select a subset of fields order by concrete fields or truncate the list by a number of rows starting in an offset .
17,568
public function setTaxPercentage ( $ tax_percentage ) : CNabuDataObject { if ( $ tax_percentage === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$tax_percentage" ) ) ; } $ this -> setValue ( 'nb_commerce_product_tax_percentage' , $ tax_percentage ) ; return $ this ; }
Sets the Commerce Product Tax Percentage attribute value .
17,569
public function setTaxAmount ( $ tax_amount ) : CNabuDataObject { if ( $ tax_amount === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$tax_amount" ) ) ; } $ this -> setValue ( 'nb_commerce_product_tax_amount' , $ tax_amount ) ; return $ this ; }
Sets the Commerce Product Tax Amount attribute value .
17,570
public function setPriceWithTax ( $ price_with_tax ) : CNabuDataObject { if ( $ price_with_tax === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$price_with_tax" ) ) ; } $ this -> setValue ( 'nb_commerce_product_price_with_tax' , $ price_with_tax ) ; return $ this ; }
Sets the Commerce Product Price With Tax attribute value .
17,571
public function setIsUpselling ( string $ is_upselling = "F" ) : CNabuDataObject { if ( $ is_upselling === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$is_upselling" ) ) ; } $ this -> setValue ( 'nb_commerce_product_is_upselling' , $ is_upselling ) ; return $ this ; }
Sets the Commerce Product Is Upselling attribute value .
17,572
public function setSoldIndividually ( string $ sold_individually = "T" ) : CNabuDataObject { if ( $ sold_individually === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$sold_individually" ) ) ; } $ this -> setValue ( 'nb_commerce_product_sold_individually' , $ sold_individually ) ; return $ this ; }
Sets the Commerce Product Sold Individually attribute value .
17,573
public function setIsVirtual ( string $ is_virtual = "F" ) : CNabuDataObject { if ( $ is_virtual === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$is_virtual" ) ) ; } $ this -> setValue ( 'nb_commerce_product_is_virtual' , $ is_virtual ) ; return $ this ; }
Sets the Commerce Product Is Virtual attribute value .
17,574
public function getCommerce ( $ force = false ) { if ( $ this -> nb_commerce === null || $ force ) { $ this -> nb_commerce = null ; if ( ! $ this -> isBuiltIn ( ) && $ this -> isValueNumeric ( NABU_COMMERCE_FIELD_ID ) ) { $ nb_commerce = new CNabuCommerce ( $ this -> getValue ( NABU_COMMERCE_FIELD_ID ) ) ; if ( $ nb_commerce -> isFetched ( ) ) { $ this -> nb_commerce = $ nb_commerce ; } } } return $ this -> nb_commerce ; }
Gets the Commerce instance that owns this object .
17,575
public function setCommerce ( CNabuCommerce $ nb_commerce ) { $ this -> nb_commerce = $ nb_commerce ; $ this -> transferValue ( $ nb_commerce , NABU_COMMERCE_FIELD_ID ) ; return $ this ; }
Sets the Commerce instance that onws this object .
17,576
public static function getProspectsForIContact ( $ nb_icontact , CNabuIContactProspectStatusType $ nb_status_type = null ) : CNabuIContactProspectList { if ( is_numeric ( $ nb_icontact_id = nb_getMixedValue ( $ nb_icontact , 'nb_icontact_id' ) ) ) { $ status_id = nb_getMixedValue ( $ nb_status_type , 'nb_icontact_prospect_status_type_id' ) ; $ retval = CNabuIContactProspect :: buildObjectListFromSQL ( 'nb_icontact_prospect_id' , 'SELECT ip.* FROM nb_icontact_prospect ip, nb_icontact i WHERE ip.nb_icontact_id=i.nb_icontact_id AND i.nb_icontact_id=%cont_id$d ' . ( is_numeric ( $ status_id ) ? 'AND ip.nb_icontact_prospect_status_id=%status_id$d ' : '' ) . 'ORDER BY ip.nb_icontact_prospect_creation_datetime DESC' , array ( 'cont_id' => $ nb_icontact_id , 'status_id' => $ status_id ) , ( $ nb_icontact instanceof CNabuIContact ? $ nb_icontact : null ) ) ; if ( $ nb_icontact instanceof CNabuIContact ) { $ retval -> iterate ( function ( $ key , $ nb_prospect ) use ( $ nb_icontact ) { $ nb_prospect -> setIContact ( $ nb_icontact ) ; return true ; } ) ; } } else { $ retval = new CNabuIContactProspectList ( ) ; } return $ retval ; }
Get related Prospects of a User .
17,577
public static function getCountProspectsOfUser ( $ nb_icontact , $ nb_user , CNabuIContactProspectStatusType $ nb_status_type = null ) : int { if ( is_numeric ( $ nb_icontact_id = nb_getMixedValue ( $ nb_icontact , 'nb_icontact_id' ) ) && is_numeric ( $ nb_user_id = nb_getMixedValue ( $ nb_user , 'nb_user_id' ) ) ) { $ status_id = nb_getMixedValue ( $ nb_status_type , 'nb_icontact_prospect_status_type_id' ) ; $ retval = CNabuEngine :: getEngine ( ) -> getMainDB ( ) -> getQueryAsCount ( 'nb_icontact_prospect ip, nb_icontact i' , null , "ip.nb_icontact_id=i.nb_icontact_id AND i.nb_icontact_id=$nb_icontact_id" . " AND ip.nb_user_id=$nb_user_id" . ( is_numeric ( $ status_id ) ? " AND ip.nb_icontact_prospect_status_id=$status_id " : '' ) ) ; } else { $ retval = 0 ; } return $ retval ; }
Get the count of related Prospects of a User .
17,578
public static function encodeEmail ( string $ email ) : string { return md5 ( self :: EMAIL_PREF . preg_replace ( '/\\s/' , '' , mb_strtolower ( $ email ) ) . self :: EMAIL_SUFF ) ; }
Encodes a clear email using the nabu - 3 algorithm . This algorithm is not reversible .
17,579
public function setEmail ( string $ email = null ) : CNabuDataObject { parent :: setEmail ( $ email ) ; return parent :: setEmailHash ( is_string ( $ email ) ? self :: encodeEmail ( $ email ) : null ) ; }
Sets the Email and encoding it into a nabu - 3 hashing algorithm .
17,580
public static function findIContactProspectsByEmailHash ( CNabuIContact $ nb_icontact , string $ hash ) : CNabuIContactProspectList { if ( is_numeric ( $ nb_icontact_id = nb_getMixedValue ( $ nb_icontact , 'nb_icontact_id' ) ) && strlen ( $ hash ) === 32 ) { $ list = CNabuIContactProspect :: buildObjectListFromSQL ( 'nb_icontact_prospect_id' , 'SELECT * FROM nb_icontact_prospect WHERE nb_icontact_id=%icontact_id$d AND nb_icontact_prospect_email_hash=\'%hash$s\'' , array ( 'icontact_id' => $ nb_icontact_id , 'hash' => $ hash ) ) ; } else { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$hash' ) ) ; } return $ list ; }
To find a list of Prospects related by the same Email hash .
17,581
public function getAttachments ( bool $ force = false ) : CNabuIContactProspectAttachmentList { if ( $ this -> nb_attachment_list -> isEmpty ( ) || $ force ) { $ this -> nb_attachment_list -> clear ( ) ; $ this -> nb_attachment_list -> merge ( CNabuIContactProspectAttachment :: getAttachmentsForProspect ( $ this ) ) ; } return $ this -> nb_attachment_list ; }
Get the list of all attachments associated with this instance .
17,582
public function addAttachment ( string $ name , string $ mimetype , string $ file , CNabuIContactProspectDiary $ nb_diary = null , bool $ save = true ) { if ( $ this -> isFetched ( ) ) { $ nb_icontact = $ this -> getIContact ( ) ; $ base_path = $ nb_icontact -> getBasePath ( ) ; $ retval = $ nb_attachment = new CNabuIContactProspectAttachment ( ) ; $ nb_attachment -> setIcontactProspect ( $ this ) ; $ nb_attachment -> setIcontactProspectDiaryId ( $ nb_diary instanceof CNabuIContactProspectDiary ? $ nb_diary -> getId ( ) : null ) ; $ nb_attachment -> setName ( $ name ) ; $ nb_attachment -> setMIMEType ( $ mimetype ) ; $ nb_attachment -> grantHash ( ) ; $ nb_attachment -> putFile ( $ file ) ; if ( $ save ) { $ nb_attachment -> save ( ) ; $ this -> nb_attachment_list -> addItem ( $ nb_attachment ) ; } return $ retval ; } else { throw new ENabuIContactException ( ENabuIContactException :: ERROR_ICONTACT_NOT_FETCHED ) ; } }
Add an Attachment file to this Prospect .
17,583
public function deleteAttachment ( $ nb_attachment ) : bool { $ retval = false ; $ nb_attachment_id = nb_getMixedValue ( $ nb_attachment , NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID ) ; if ( is_numeric ( $ nb_attachment_id ) ) { $ nb_attachment = $ this -> nb_attachment_list -> getItem ( $ nb_attachment_id ) ; if ( $ nb_attachment -> getIContactProspectId ( ) == $ this -> getId ( ) ) { $ nb_attachment -> deleteFile ( ) ; $ this -> nb_attachment_list -> removeItem ( $ nb_attachment ) ; $ nb_attachment -> delete ( ) ; $ retval = true ; } } return $ retval ; }
Delete an Attachment from the list if exists .
17,584
public function save ( $ trace = false ) { $ retval = parent :: save ( $ trace ) ; $ this -> nb_attachment_list -> iterate ( function ( $ key , CNabuIContactProspectAttachment $ nb_attachment ) use ( $ retval ) { $ retval |= $ nb_attachment -> save ( ) ; return true ; } ) ; return $ retval ; }
Overrides the parent method to save modified subordinated instances .
17,585
public function registerAnnotations ( ) { $ app = $ this -> app ; $ loader = new AnnotationLoader ( $ app [ 'files' ] , __DIR__ . '/../Annotations' ) ; $ loader -> registerAll ( ) ; }
Registers all annotation classes
17,586
public function setIsApi ( string $ is_api = "F" ) : CNabuDataObject { if ( $ is_api === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$is_api" ) ) ; } $ this -> setValue ( 'nb_language_is_api' , $ is_api ) ; return $ this ; }
Sets the Language Is Api attribute value .
17,587
public function setName ( string $ name ) : CNabuDataObject { if ( $ name === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$name" ) ) ; } $ this -> setValue ( 'nb_language_name' , $ name ) ; return $ this ; }
Sets the Language Name attribute value .
17,588
public static function hydrateCollection ( array $ summaries ) { $ hydrated = [ ] ; foreach ( $ summaries as $ summary ) { $ hydrated [ ] = self :: hydrate ( $ summary ) ; } return $ hydrated ; }
Hydrate a collection of summary objects into a collection of SummaryEntity objects
17,589
public static function hydrate ( stdClass $ summary ) { $ hydrated = new SummaryEntity ( ) ; if ( isset ( $ summary -> id ) ) { $ hydrated -> setId ( $ summary -> id ) ; } if ( isset ( $ summary -> line ) ) { $ hydrated -> setLine ( $ summary -> line ) ; } if ( isset ( $ summary -> content ) ) { $ hydrated -> setContent ( $ summary -> content ) ; } if ( isset ( $ summary -> highlighted_content ) ) { $ hydrated -> setHighlightedContent ( $ summary -> highlighted_content ) ; } if ( isset ( $ summary -> file ) ) { $ hydrated -> setFile ( FileHydrator :: hydrate ( $ summary -> file ) ) ; } if ( isset ( $ summary -> function ) ) { $ hydrated -> setFunction ( CustomFunctionHydrator :: hydrate ( $ summary -> function ) ) ; } if ( isset ( $ summary -> class ) ) { $ hydrated -> setClass ( CustomClassHydrator :: hydrate ( $ summary -> class ) ) ; } return $ hydrated ; }
Hydrate a summary object into a SummaryEntity object
17,590
private function setRedirections ( SimpleXMLElement $ element ) { $ pages = $ element -> addChild ( 'redirections' ) ; $ this -> setRedirection ( $ pages , 'default' , 'default' ) ; $ this -> setRedirection ( $ pages , 'page_not_found' , 'pageNotFound' ) ; $ this -> setRedirection ( $ pages , 'login' , 'login' ) ; $ this -> setRedirection ( $ pages , 'login_redirection' , 'loginRedirection' ) ; $ this -> setRedirection ( $ pages , 'logout_redirection' , 'logoutRedirection' ) ; $ this -> setRedirection ( $ pages , 'alias_not_found' , 'aliasNotFound' ) ; $ this -> setRedirection ( $ pages , 'alias_locked' , 'aliasLocked' ) ; }
Build redirection pointers for special cases .
17,591
private function setRedirection ( SimpleXMLElement $ element , string $ field , string $ tag_name ) { $ page = $ element -> addChild ( $ tag_name ) ; switch ( $ this -> nb_data_object -> getValue ( "nb_site_${field}_target_use_uri" ) ) { case 'T' : $ id = $ this -> nb_data_object -> getValue ( "nb_site_${field}_target_id" ) ; if ( is_numeric ( $ id ) && is_string ( $ hash = $ this -> grantTargetHash ( $ id ) ) ) { $ page -> addAttribute ( 'useURI' , 'T' ) ; $ page -> addAttribute ( 'id' , $ hash ) ; $ this -> putAttributesFromList ( $ page , array ( "nb_site_${field}_error_code" => "errorCode" ) ) ; } break ; case 'U' : $ translations = $ this -> nb_data_object -> getTranslations ( ) ; $ urls = array ( ) ; $ translations -> iterate ( function ( $ lang , $ nb_translation ) use ( & $ urls , $ field ) { $ urls [ $ lang ] = $ nb_translation -> getValue ( "nb_site_lang_${field}_target_url" ) ; return true ; } ) ; if ( count ( $ urls ) > 0 ) { $ page -> addAttribute ( 'useURI' , 'U' ) ; foreach ( $ urls as $ lang => $ url ) { if ( strlen ( $ url ) > 0 ) { $ nb_language = $ this -> nb_data_object -> getLanguage ( $ lang ) ; $ address = $ page -> addChild ( 'url' ) ; $ address -> addAttribute ( 'lang' , $ nb_language -> getHash ( ) ) ; $ address -> addAttribute ( 'url' , $ url ) ; } } } $ this -> putAttributesFromList ( $ page , array ( "nb_site_${field}_error_code" => "errorCode" ) , true ) ; break ; } }
Build a redirection element .
17,592
private function setTargets ( SimpleXMLElement $ parent ) { $ xml_targets = new CNabuXMLSiteTargetList ( $ this -> nb_data_object -> getTargets ( true ) ) ; $ xml_targets -> build ( $ parent ) ; }
Build Target branch .
17,593
private function setMaps ( SimpleXMLElement $ parent ) { $ xml_targets = new CNabuXMLSiteMapList ( $ this -> nb_data_object -> getSiteMaps ( true ) ) ; $ xml_targets -> build ( $ parent ) ; }
Build Map branch .
17,594
private function setStaticContents ( SimpleXMLElement $ parent ) { $ xml_statics = new CNabuXMLSiteStaticContentList ( $ this -> nb_data_object -> getStaticContents ( true ) ) ; $ xml_statics -> build ( $ parent ) ; }
Build Static Content branch .
17,595
private function grantTargetHash ( int $ nb_site_target_id ) : string { $ nb_site_target = $ this -> nb_data_object -> getTarget ( $ nb_site_target_id ) ; return $ nb_site_target -> isFetched ( ) ? $ nb_site_target -> grantHash ( true ) : null ; }
Grant that a target have a valid hash to identify it .
17,596
public static function hydrateCollection ( array $ files ) { $ hydrated = [ ] ; foreach ( $ files as $ file ) { $ hydrated [ ] = self :: hydrate ( $ file ) ; } return $ hydrated ; }
Hydrate a collection of file objects into a collection of FileEntity objects
17,597
public static function hydrate ( stdClass $ file ) { $ hydrated = new FileEntity ( ) ; if ( isset ( $ file -> id ) ) { $ hydrated -> setId ( $ file -> id ) ; } if ( isset ( $ file -> loc ) ) { $ hydrated -> setLoc ( $ file -> loc ) ; } if ( isset ( $ file -> path ) ) { $ hydrated -> setPath ( $ file -> path ) ; } if ( isset ( $ file -> scanned ) ) { $ hydrated -> setScanned ( $ file -> scanned ) ; } if ( isset ( $ file -> code ) ) { $ hydrated -> setCode ( $ file -> code ) ; } return $ hydrated ; }
Hydrate a file object into a FileEntity object
17,598
public function addTarget ( CNabuSiteTarget $ nb_site_target , $ default = false ) { $ nb_site_target -> setSite ( $ this ) ; if ( $ default ) { $ this -> setDefaultTarget ( $ nb_site_target ) ; } return $ this -> nb_site_target_list -> addItem ( $ nb_site_target ) ; }
Add a target to a site .
17,599
public function getTarget ( $ nb_site_target ) { $ nb_site_target_id = nb_getMixedValue ( $ nb_site_target , 'nb_site_target_id' ) ; return ( is_numeric ( $ nb_site_target_id ) || nb_isValidGUID ( $ nb_site_target_id ) ) ? $ this -> nb_site_target_list -> getItem ( $ nb_site_target_id ) -> setSite ( $ this ) : null ; }
Gets a Target item from the list of targets loaded in the Site .