idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
17,200
public function getById ( $ activityId , array $ queryParams = [ ] ) { $ response = $ this -> api -> activities ( ) -> getById ( $ activityId , $ queryParams ) ; return new ActivityResponse ( $ response ) ; }
Get activity by id
17,201
protected function handleShutdown ( ) { if ( ! \ is_null ( $ error = \ error_get_last ( ) ) && $ this -> isFatalError ( $ error [ 'type' ] ) ) { $ this -> handleUncaughtException ( new FatalErrorException ( $ error [ 'message' ] , $ error [ 'type' ] , 0 , $ error [ 'file' ] , $ error [ 'line' ] ) ) ; } }
Handle the application shutdown routine .
17,202
protected function isFatalError ( $ type ) { $ errorCodes = [ E_ERROR , E_CORE_ERROR , E_COMPILE_ERROR , E_PARSE ] ; if ( \ defined ( 'FATAL_ERROR' ) ) { $ errorCodes [ ] = FATAL_ERROR ; } return \ in_array ( $ type , $ errorCodes ) ; }
Determine if the error type is fatal .
17,203
protected function addDbup ( \ Phar $ phar ) { $ content = file_get_contents ( __DIR__ . '/../../../dbup' ) ; $ content = preg_replace ( '{^#!/usr/bin/env php\s*}' , '' , $ content ) ; $ phar -> addFromString ( 'dbup' , $ content ) ; }
Remove the shebang from the file before add it to the PHAR file .
17,204
public function setSiteTargetSectionId ( int $ nb_site_target_section_id ) : CNabuDataObject { if ( $ nb_site_target_section_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_site_target_section_id" ) ) ; } $ this -> setValue ( 'nb_site_target_section_id' , $ nb_site_target_section_id ) ; return $ this ; }
Sets the Site Target Section Id attribute value .
17,205
public function refresh ( bool $ force = false , bool $ cascade = false ) : bool { return parent :: refresh ( $ force , $ cascade ) && $ this -> appendTranslatedRefresh ( $ force ) ; }
Overrides refresh method to add translations branch to refresh .
17,206
public static function getAllProjects ( 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_project_id' , 'select * ' . 'from nb_project ' . 'where nb_customer_id=%cust_id$d' , array ( 'cust_id' => $ nb_customer_id ) , $ nb_customer ) ; } else { $ retval = new CNabuProjectList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_project_id is the index and each value is an instance of class CNabuProjectBase .
17,207
public function setCustomerId ( int $ nb_customer_id ) : CNabuDataObject { if ( $ nb_customer_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_customer_id" ) ) ; } $ this -> setValue ( 'nb_customer_id' , $ nb_customer_id ) ; return $ this ; }
Sets the Customer Id attribute value .
17,208
public static function hydrateCollection ( array $ modifications ) { $ hydrated = [ ] ; foreach ( $ modifications as $ modification ) { $ hydrated [ ] = self :: hydrate ( $ modification ) ; } return $ hydrated ; }
Hydrate a collection of modification objects into a collection of ModificationEntity objects
17,209
public static function hydrate ( stdClass $ modification ) { $ hydrated = new ModificationEntity ( ) ; if ( isset ( $ modification -> id ) ) { $ hydrated -> setId ( $ modification -> id ) ; } if ( isset ( $ modification -> virtual_line ) ) { $ hydrated -> setVirtualLine ( $ modification -> virtual_line ) ; } if ( isset ( $ modification -> original_line ) ) { $ hydrated -> setOriginalLine ( $ modification -> original_line ) ; } if ( isset ( $ modification -> column_start ) ) { $ hydrated -> setColumnStart ( $ modification -> column_start ) ; } if ( isset ( $ modification -> column_end ) ) { $ hydrated -> setColumnEnd ( $ modification -> column_end ) ; } if ( isset ( $ modification -> content ) ) { $ hydrated -> setContent ( $ modification -> content ) ; } if ( isset ( $ modification -> highlighted_content ) ) { $ hydrated -> setHighlightedContent ( $ modification -> highlighted_content ) ; } if ( isset ( $ modification -> original_content ) ) { $ hydrated -> setOriginalContent ( $ modification -> original_content ) ; } if ( isset ( $ modification -> file ) ) { $ hydrated -> setFile ( FileHydrator :: hydrate ( $ modification -> file ) ) ; } return $ hydrated ; }
Hydrate a modification object into a ModificationEntity object
17,210
public function getMiddlewareForMethod ( $ method ) { $ middleware = [ ] ; foreach ( $ this -> middleware as $ name => $ options ) { if ( isset ( $ options [ 'only' ] ) && ! \ in_array ( $ method , ( array ) $ options [ 'only' ] ) ) { continue ; } if ( isset ( $ options [ 'except' ] ) && \ in_array ( $ method , ( array ) $ options [ 'except' ] ) ) { continue ; } $ middleware [ ] = $ name ; } return $ middleware ; }
Get the middleware for a given method .
17,211
public static function hydrateCollection ( array $ teams ) { $ hydrated = [ ] ; foreach ( $ teams as $ team ) { $ hydrated [ ] = self :: hydrate ( $ team ) ; } return $ hydrated ; }
Hydrate a collection of team objects into a collection of TeamEntity objects
17,212
public static function hydrate ( stdClass $ team ) { $ hydrated = new TeamEntity ( ) ; if ( isset ( $ team -> id ) ) { $ hydrated -> setId ( $ team -> id ) ; } if ( isset ( $ team -> name ) ) { $ hydrated -> setName ( $ team -> name ) ; } if ( isset ( $ team -> organization ) ) { $ hydrated -> setOrganization ( OrgHydrator :: hydrate ( $ team -> organization ) ) ; } if ( isset ( $ team -> users ) && is_array ( $ team -> users ) ) { $ hydrated -> setUsers ( UserHydrator :: hydrateCollection ( $ team -> users ) ) ; } if ( isset ( $ team -> created_by ) ) { $ hydrated -> setCreatedBy ( UserHydrator :: hydrate ( $ team -> created_by ) ) ; } if ( isset ( $ team -> created_at ) ) { $ hydrated -> setCreatedAt ( new DateTime ( $ team -> created_at ) ) ; } return $ hydrated ; }
Hydrate a team object into a TeamEntity object
17,213
public function setCommerceProductId ( int $ nb_commerce_product_id ) : CNabuDataObject { if ( $ nb_commerce_product_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_commerce_product_id" ) ) ; } $ this -> setValue ( 'nb_commerce_product_id' , $ nb_commerce_product_id ) ; return $ this ; }
Sets the Commerce Product Id attribute value .
17,214
public function getLanguages ( $ force = false ) { if ( ! CNabuEngine :: getEngine ( ) -> isOperationModeStandalone ( ) && ( $ this -> languages_list -> getSize ( ) === 0 || $ force ) ) { $ this -> languages_list = CNabuIContactProspectStatusTypeLanguage :: getLanguagesForTranslatedObject ( $ this ) ; } return $ this -> languages_list ; }
Get all language instances corresponding to available translations .
17,215
public function getTranslations ( $ force = false ) { if ( ! CNabuEngine :: getEngine ( ) -> isOperationModeStandalone ( ) && ( $ this -> translations_list -> getSize ( ) === 0 || $ force ) ) { $ this -> translations_list = CNabuIContactProspectStatusTypeLanguage :: getTranslationsForTranslatedObject ( $ this ) ; } return $ this -> translations_list ; }
Gets available translation instances .
17,216
public function refresh ( bool $ force = false , bool $ cascade = false ) : bool { if ( ( $ retval = parent :: refresh ( $ force , $ cascade ) ) === true && $ cascade ) { $ this -> getMediotecas ( $ force ) ; $ this -> getSites ( $ force ) ; $ this -> getCommerces ( $ force ) ; $ this -> getCatalogs ( $ force ) ; $ this -> getMessagings ( $ force ) ; $ this -> getProjects ( $ force ) ; $ this -> getRoles ( $ force ) ; } return $ retval ; }
Overrides refresh method to add Customer subentities to be refreshed .
17,217
public function getMediotecas ( $ force = false ) { if ( $ this -> nb_medioteca_list -> isEmpty ( ) || $ force ) { $ this -> nb_medioteca_list -> clear ( ) ; $ this -> nb_medioteca_list -> merge ( CNabuMedioteca :: getAllMediotecas ( $ this ) ) ; } return $ this -> nb_medioteca_list -> getItems ( ) ; }
Gets available Medioteca instances in the list .
17,218
public function getMedioteca ( $ nb_medioteca ) { $ retval = false ; if ( is_object ( $ nb_medioteca ) && ! ( $ nb_medioteca instanceof CNabuDataObject ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_CLASS_TYPE , array ( '$nb_medioteca' , get_class ( $ nb_medioteca ) ) ) ; } if ( $ nb_medioteca !== null ) { $ nb_medioteca_id = nb_getMixedValue ( $ nb_medioteca , NABU_MEDIOTECA_FIELD_ID ) ; if ( is_numeric ( $ nb_medioteca_id ) || nb_isValidGUID ( $ nb_medioteca_id ) ) { $ retval = $ this -> nb_medioteca_list -> getItem ( $ nb_medioteca_id ) ; } elseif ( $ nb_medioteca_id !== null && $ nb_medioteca_id !== false ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$nb_medioteca' , print_r ( $ nb_medioteca , true ) ) ) ; } } return $ retval ; }
Gets a Medioteca by their ID . If the internal Medioteca List contains a instance with same ID returns this instance else if not exists tries to locate it in the storage and if exists then load it add into Medioteca List and returns their instance as result .
17,219
public function getMediotecaByKey ( string $ key ) { if ( strlen ( $ key ) === 0 ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$key' , print_r ( $ key , true ) ) ) ; } return $ this -> nb_medioteca_list -> getItem ( $ key , CNabuMediotecaList :: INDEX_KEY ) ; }
Gets a Medioteca instance using their key .
17,220
public function getSite ( $ nb_site ) { $ retval = false ; if ( is_object ( $ nb_site ) && ! ( $ nb_site instanceof CNabuDataObject ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_CLASS_TYPE , array ( '$nb_site' , get_class ( $ nb_site ) ) ) ; } if ( $ nb_site !== null ) { $ nb_site_id = nb_getMixedValue ( $ nb_site , NABU_SITE_FIELD_ID ) ; if ( is_numeric ( $ nb_site_id ) || nb_isValidGUID ( $ nb_site_id ) ) { $ retval = $ this -> nb_site_list -> getItem ( $ nb_site_id ) ; if ( $ retval instanceof CNabuSite ) { if ( ! $ retval -> validateCustomer ( $ this ) ) { $ this -> nb_site_list -> removeItem ( $ retval ) ; $ retval = false ; } else { $ retval -> setCustomer ( $ this ) ; } } } elseif ( $ nb_site_id !== null && $ nb_site_id !== false ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$nb_site' , print_r ( $ nb_site , true ) ) ) ; } } return $ retval ; }
Gets a Site by their ID . If the internal Site List contains a instance with same ID returns this instance else if not exists tries to locate it in the storage and if exists then load it add into Site List and returns their instance as result .
17,221
public function getSiteByKey ( string $ key ) { $ retval = false ; if ( strlen ( $ key ) === 0 ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$key' , print_r ( $ key , true ) ) ) ; } $ nb_site = $ this -> nb_site_list -> getItem ( $ key , CNabuSiteList :: INDEX_KEY ) ; if ( $ nb_site instanceof CNabuSite ) { $ nb_site -> setCustomer ( $ this ) ; $ retval = $ nb_site ; } return $ retval ; }
Gets a Site instance using their key .
17,222
public function getSiteByAlias ( string $ alias ) { $ retval = false ; if ( ! is_string ( $ alias ) || strlen ( $ alias ) === 0 ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$alias' , print_r ( $ alias , true ) ) ) ; } $ nb_site = CNabuSite :: findByAlias ( $ alias ) ; if ( $ nb_site instanceof CNabuSite && $ nb_site -> validateCustomer ( $ this ) ) { if ( ! $ this -> nb_site_list -> containsKey ( $ nb_site -> getId ( ) ) ) { $ this -> nb_site_list -> addItem ( $ nb_site ) ; } $ retval = $ nb_site ; } return $ retval ; }
Gets a Site instance using a possible alias .
17,223
public function getSites ( $ force = false ) { if ( $ force ) { $ this -> nb_site_list -> clear ( ) ; $ this -> nb_site_list -> merge ( CNabuSite :: getAllSites ( $ this ) ) ; } return $ this -> nb_site_list -> getItems ( ) ; }
Gets available Site instances in the list .
17,224
public function getCommerces ( $ force = false ) { if ( $ this -> nb_commerce_list -> isEmpty ( ) || $ force ) { $ this -> nb_commerce_list -> clear ( ) ; $ this -> nb_commerce_list -> merge ( CNabuCommerce :: getAllCommerces ( $ this ) ) ; } return $ this -> nb_commerce_list -> getItems ( ) ; }
Gets available Commerce instances in the list .
17,225
public function getCommerce ( $ nb_commerce ) { $ retval = false ; if ( is_object ( $ nb_commerce ) && ! ( $ nb_commerce instanceof CNabuDataObject ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_CLASS_TYPE , array ( '$nb_commerce' , get_class ( $ nb_commerce ) ) ) ; } if ( $ nb_commerce !== null ) { $ nb_commerce_id = nb_getMixedValue ( $ nb_commerce , NABU_COMMERCE_FIELD_ID ) ; if ( is_numeric ( $ nb_commerce_id ) || nb_isValidGUID ( $ nb_commerce_id ) ) { $ retval = $ this -> nb_commerce_list -> getItem ( $ nb_commerce_id ) ; } elseif ( $ nb_commerce_id !== null && $ nb_commerce_id !== false ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$nb_commerce' , print_r ( $ nb_commerce , true ) ) ) ; } } return $ retval ; }
Gets a Commerce by their ID . If the internal Commerce List contains a instance with same ID returns this instance else if not exists tries to locate it in the storage and if exists then load it add into Commerce List and returns their instance as result .
17,226
public function getCatalog ( $ nb_catalog ) { $ retval = false ; if ( is_object ( $ nb_catalog ) && ! ( $ nb_catalog instanceof CNabuDataObject ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_CLASS_TYPE , array ( '$nb_catalog' , get_class ( $ nb_catalog ) ) ) ; } if ( $ nb_catalog !== null ) { $ nb_catalog_id = nb_getMixedValue ( $ nb_catalog , NABU_CATALOG_FIELD_ID ) ; if ( is_numeric ( $ nb_catalog_id ) || nb_isValidGUID ( $ nb_catalog_id ) ) { $ retval = $ this -> nb_catalog_list -> getItem ( $ nb_catalog_id ) ; } elseif ( $ nb_catalog_id !== null && $ nb_catalog_id !== false ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$nb_catalog' , print_r ( $ nb_catalog , true ) ) ) ; } } return $ retval ; }
Gets a Catalog by their ID . If the internal Catalog List contains a instance with same ID returns this instance else if not exists tries to locate it in the storage and if exits the load it add into Catalog List and returns their instance as result .
17,227
public function getCatalogByKey ( $ key ) { if ( ! is_string ( $ key ) || strlen ( $ key ) === 0 ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$key' , print_r ( $ key , true ) ) ) ; } return $ this -> nb_catalog_list -> getItem ( $ key , CNabuCatalogList :: INDEX_KEY ) ; }
Gets a Catalog instance using their key .
17,228
public function getCatalogBySlug ( $ slug , $ nb_language = null ) { if ( ! is_string ( $ slug ) || strlen ( $ slug ) === 0 ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$slug' , print_r ( $ slug , true ) ) ) ; } $ nb_final_catalog = null ; $ nb_language_id = nb_getMixedValue ( $ nb_language , NABU_LANG_FIELD_ID ) ; $ this -> nb_catalog_list -> iterate ( function ( $ key , CNabuCatalog $ nb_catalog ) use ( $ slug , & $ nb_final_catalog , $ nb_language_id ) { if ( is_numeric ( $ nb_language_id ) ) { $ nb_translation = $ nb_catalog -> getTranslation ( $ nb_language_id ) ; if ( $ nb_translation instanceof CNabuCatalogLanguage && $ nb_translation -> getSlug ( ) === $ slug ) { $ nb_final_catalog = $ nb_catalog ; } } else { $ nb_catalog -> getTranslations ( true ) -> iterate ( function ( $ key , CNabuCatalogLanguage $ nb_catalog_language ) use ( $ slug , $ nb_catalog , & $ nb_final_catalog ) { if ( $ nb_catalog_language -> getSlug ( ) === $ slug ) { $ nb_final_catalog = $ nb_catalog ; } return ( $ nb_final_catalog === null ) ; } ) ; } return ( $ nb_final_catalog === null ) ; } ) ; return ( $ nb_final_catalog === null ? false : $ nb_final_catalog ) ; }
Gets a Catalog instance using their slug .
17,229
public function getCatalogs ( $ force = false ) { if ( $ this -> nb_catalog_list -> isEmpty ( ) || $ force ) { $ this -> nb_catalog_list -> clear ( ) ; $ this -> nb_catalog_list -> merge ( CNabuCatalog :: getAllCatalogs ( $ this ) ) ; } return $ this -> nb_catalog_list -> getItems ( ) ; }
Gets available Catalog instances in the list .
17,230
public function getMessagings ( $ force = false ) { if ( $ this -> nb_messaging_list -> isEmpty ( ) || $ force ) { $ this -> nb_messaging_list -> clear ( ) ; $ this -> nb_messaging_list -> merge ( CNabuMessaging :: getAllMessagings ( $ this ) ) ; } return $ this -> nb_messaging_list -> getItems ( ) ; }
Gets available Messaging instances in the list .
17,231
public function getMessaging ( $ nb_messaging ) { $ retval = false ; if ( is_object ( $ nb_messaging ) && ! ( $ nb_messaging instanceof CNabuDataObject ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_CLASS_TYPE , array ( '$nb_messaging' , get_class ( $ nb_messaging ) ) ) ; } if ( $ nb_messaging !== null ) { $ nb_messaging_id = nb_getMixedValue ( $ nb_messaging , NABU_MESSAGING_FIELD_ID ) ; if ( is_numeric ( $ nb_messaging_id ) || nb_isValidGUID ( $ nb_messaging_id ) ) { $ retval = $ this -> nb_messaging_list -> getItem ( $ nb_messaging_id ) ; } elseif ( $ nb_messaging_id !== null && $ nb_messaging_id !== false ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$nb_messaging' , print_r ( $ nb_messaging , true ) ) ) ; } } return $ retval ; }
Gets a Messaging by their ID . If the internal Messaging List contains a instance with same ID returns this instance else if not exists tries to locate it in the storage and if exits the load it add into Messaging List and returns their instance as result .
17,232
public function getProjects ( $ force = false ) { if ( $ this -> nb_project_list === null ) { $ this -> nb_project_list = new CNabuProjectList ( $ this ) ; } if ( $ force ) { $ this -> nb_role_list -> clear ( ) ; $ this -> nb_project_list -> merge ( CNabuProject :: getAllProjects ( $ this ) ) ; } return $ this -> nb_project_list -> getItems ( ) ; }
Gets available Project instances in the list .
17,233
public function getProject ( $ nb_project ) { $ retval = false ; if ( is_object ( $ nb_project ) && ! ( $ nb_project instanceof CNabuDataObject ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_CLASS_TYPE , array ( '$nb_project' , get_class ( $ nb_project ) ) ) ; } if ( $ nb_project !== null ) { $ nb_project_id = nb_getMixedValue ( $ nb_project , NABU_PROJECT_FIELD_ID ) ; if ( is_numeric ( $ nb_project_id ) || nb_isValidGUID ( $ nb_project_id ) ) { $ retval = $ this -> nb_project_list -> getItem ( $ nb_project_id ) ; } elseif ( $ nb_project_id !== null && $ nb_project_id !== false ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$nb_project' , print_r ( $ nb_project , true ) ) ) ; } } return $ retval ; }
Gets a Project by their ID . If the internal Project List contains a instance with same ID returns this instance else if not exists tries to locate it in the storage and if exits the load it add into Project List and returns their instance as result .
17,234
public function getUser ( $ nb_user ) { $ retval = null ; $ nb_user_id = nb_getMixedValue ( $ nb_user , NABU_USER_FIELD_ID ) ; if ( is_numeric ( $ nb_user_id ) ) { $ nb_new_user = new CNabuUser ( $ nb_user_id ) ; if ( $ nb_new_user -> isFetched ( ) && $ nb_new_user -> validateCustomer ( $ this ) ) { $ nb_new_user -> setCustomer ( $ this ) ; $ retval = $ nb_new_user ; } } return $ retval ; }
Gets a User instance owned by this Customer .
17,235
public function getUserByLogin ( string $ login ) { $ retval = null ; if ( strlen ( $ login ) > 0 ) { $ nb_user = CNabuUser :: findByLogin ( $ this , $ login ) ; if ( $ nb_user instanceof CNabuUser && $ nb_user -> validateCustomer ( $ this ) ) { $ nb_user -> setCustomer ( $ this ) ; $ retval = $ nb_user ; } } return $ retval ; }
Get a User instance owned by this Customer and identified by his login attribute .
17,236
public function getUserByEMail ( string $ email ) { $ retval = null ; if ( strlen ( $ email ) > 0 ) { $ nb_user = CNabuUser :: findByEMail ( $ this , $ email ) ; if ( $ nb_user instanceof CNabuUser && $ nb_user -> validateCustomer ( $ this ) ) { $ nb_user -> setCustomer ( $ this ) ; $ retval = $ nb_user ; } } return $ retval ; }
Get a User instance owned by this Customer and identified by his email attribute .
17,237
public function getRoles ( bool $ force = false ) { if ( $ this -> nb_role_list -> isEmpty ( ) || $ force ) { $ this -> nb_role_list -> clear ( ) ; $ this -> nb_role_list -> merge ( CNabuRole :: getAllRoles ( $ this ) ) ; } return $ this -> nb_role_list ; }
Gets a Role List of all roles owned by this Customer .
17,238
public function getRole ( $ nb_role ) { $ retval = false ; if ( is_object ( $ nb_role ) && ! ( $ nb_role instanceof CNabuDataObject ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_CLASS_TYPE , array ( '$nb_role' , get_class ( $ nb_role ) ) ) ; } if ( $ nb_role !== null ) { $ nb_role_id = nb_getMixedValue ( $ nb_role , NABU_ROLE_FIELD_ID ) ; if ( is_numeric ( $ nb_role_id ) || nb_isValidGUID ( $ nb_role_id ) ) { $ retval = $ this -> nb_role_list -> getItem ( $ nb_role_id ) ; if ( $ retval instanceof CNabuRole ) { if ( ! $ retval -> validateCustomer ( $ this ) ) { $ this -> nb_role_list -> removeItem ( $ retval ) ; $ retval = false ; } else { $ retval -> setCustomer ( $ this ) ; } } } elseif ( $ nb_role_id !== null && $ nb_role_id !== false ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( print_r ( $ nb_role , true ) , '$nb_role' ) ) ; } } return $ retval ; }
Gets a Role by their ID . If the internal Role List contains a instance with same ID returns this instance else if not exists tries to locate it in the storage and if exists then load it add into Role List and returns their instance as result .
17,239
public function getRoleByKey ( string $ key ) { if ( strlen ( $ key ) === 0 ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$key' , print_r ( $ key , true ) ) ) ; } return $ this -> nb_role_list -> getItem ( $ key , CNabuRoleList :: INDEX_KEY ) ; }
Gets a Role instance using their key .
17,240
public function getIContacts ( $ force = false ) { if ( $ this -> nb_icontact_list -> isEmpty ( ) || $ force ) { $ this -> nb_icontact_list -> clear ( ) ; $ this -> nb_icontact_list -> merge ( CNabuIContact :: getAlliContacts ( $ this ) ) ; } return $ this -> nb_icontact_list -> getItems ( ) ; }
Gets available i - Contact instances in the list .
17,241
public function getIContact ( $ nb_icontact ) { $ retval = false ; if ( is_object ( $ nb_icontact ) && ! ( $ nb_icontact instanceof CNabuDataObject ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_CLASS_TYPE , array ( '$nb_icontact' , get_class ( $ nb_icontact ) ) ) ; } if ( $ nb_icontact !== null ) { $ nb_icontact_id = nb_getMixedValue ( $ nb_icontact , NABU_ICONTACT_FIELD_ID ) ; if ( is_numeric ( $ nb_icontact_id ) || nb_isValidGUID ( $ nb_icontact_id ) ) { $ retval = $ this -> nb_icontact_list -> getItem ( $ nb_icontact_id ) ; } elseif ( $ nb_icontact_id !== null && $ nb_icontact_id !== false ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( print_r ( $ nb_icontact , true ) , '$nb_icontact' ) ) ; } } return $ retval ; }
Gets an i - Contact by their ID . If the internal i - Contact List contains a instance with same ID returns this instance else if not exists tries to locate it in the storage and if exits the load it add into i - Contact List and returns their instance as result .
17,242
public function getIContactByKey ( string $ key ) { if ( ! is_string ( $ key ) || strlen ( $ key ) === 0 ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_UNEXPECTED_PARAM_VALUE , array ( '$key' , print_r ( $ key , true ) ) ) ; } return $ this -> nb_icontact_list -> getItem ( $ key , CNabuIContactList :: INDEX_KEY ) ; }
Gets an i - Contact instance using their key .
17,243
public function getAll ( array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> origins ( ) -> types ( ) -> getAll ( $ queryParams ) ; return new TypesResponse ( $ response ) ; }
Get all types for origin
17,244
public function getById ( $ typeId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> origins ( ) -> types ( ) -> getById ( $ typeId , $ queryParams ) ; return new TypeResponse ( $ response ) ; }
Get type for origin by id
17,245
public function setGroupId ( int $ group_id ) : CNabuDataObject { if ( $ group_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$group_id" ) ) ; } $ this -> setValue ( 'nb_cluster_user_group_id' , $ group_id ) ; return $ this ; }
Sets the Cluster User Group Id attribute value .
17,246
public function setOSNick ( string $ os_nick ) : CNabuDataObject { if ( $ os_nick === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$os_nick" ) ) ; } $ this -> setValue ( 'nb_cluster_user_os_nick' , $ os_nick ) ; return $ this ; }
Sets the Cluster User OS Nick attribute value .
17,247
public function equals ( Result $ result ) : bool { if ( null !== $ this -> score xor null !== $ result -> score ) { return false ; } if ( null !== $ this -> score && ! $ this -> score -> equals ( $ result -> score ) ) { return false ; } if ( $ this -> success !== $ result -> success ) { return false ; } if ( $ this -> completion !== $ result -> completion ) { return false ; } if ( $ this -> response !== $ result -> response ) { return false ; } if ( $ this -> duration !== $ result -> duration ) { return false ; } if ( null !== $ this -> extensions xor null !== $ result -> extensions ) { return false ; } if ( null !== $ this -> extensions && null !== $ result -> extensions && ! $ this -> extensions -> equals ( $ result -> extensions ) ) { return false ; } return true ; }
Checks if another result is equal .
17,248
public function putFile ( string $ sourcefile ) { if ( file_exists ( $ sourcefile ) ) { if ( ( $ nb_icontact_prospect = $ this -> getIContactProspect ( ) ) instanceof CNabuIContactProspect && ( $ nb_icontact = $ nb_icontact_prospect -> getIContact ( ) ) instanceof CNabuIContact ) { $ this -> grantHash ( ) ; $ nb_icontact -> grantStorageFolder ( ) ; $ base_path = $ nb_icontact -> getBasePath ( ) ; move_uploaded_file ( $ sourcefile , $ base_path . DIRECTORY_SEPARATOR . $ this -> getFilename ( ) ) ; } else { throw new ENabuIContactException ( ENabuIContactException :: ERROR_ICONTACT_NOT_FOUND ) ; } } else { throw new ENabuCoreException ( ENabuCoreException :: ERROR_FILE_NOT_FOUND , array ( $ sourcefile ) ) ; } }
Put the file associated to this attachment in the iContact storage .
17,249
public function deleteFile ( ) { $ retval = false ; if ( ( $ nb_icontact_prospect = $ this -> getIContactProspect ( ) ) instanceof CNabuIContactProspect && ( $ nb_icontact = $ nb_icontact_prospect -> getIContact ( ) ) instanceof CNabuIContact ) { $ base_path = $ nb_icontact -> getBasePath ( ) ; $ filename = $ base_path . DIRECTORY_SEPARATOR . $ this -> getFilename ( ) ; if ( file_exists ( $ filename ) ) { unlink ( $ filename ) ; $ retval = ! file_exists ( $ filename ) ; } } return $ retval ; }
Delete the file of this attachment from the iContact storage .
17,250
public static function getAttachmentsForProspect ( $ nb_prospect ) { if ( is_numeric ( $ nb_prospect_id = nb_getMixedValue ( $ nb_prospect , NABU_ICONTACT_PROSPECT_FIELD_ID ) ) ) { $ retval = CNabuIContactProspectAttachment :: buildObjectListFromSQL ( NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID , 'SELECT ipa.* FROM nb_icontact_prospect_attachment ipa, nb_icontact_prospect ip WHERE ipa.nb_icontact_prospect_id=ip.nb_icontact_prospect_id AND ip.nb_icontact_prospect_id=%prospect_id$d ORDER BY ipa.nb_icontact_prospect_attachment_id' , array ( 'prospect_id' => $ nb_prospect_id ) , ( $ nb_prospect instanceof CNabuIContactProspect ? $ nb_prospect : null ) ) ; if ( $ nb_prospect instanceof CNabuIContactProspect ) { $ retval -> iterate ( function ( $ key , CNabuIContactProspectAttachment $ nb_attachment ) use ( $ nb_prospect ) { $ nb_attachment -> setIContactProspect ( $ nb_prospect ) ; return true ; } ) ; } } else { $ retval = new CNabuIContactProspectList ( ( $ nb_prospect instanceof CNabuIContactProspect ? $ nb_prospect : null ) ) ; } return $ retval ; }
Get a list of all attachments associated to an iContact Prospect instance .
17,251
public function trap ( CNabuHTTPRequest $ nb_request , CNabuHTTPResponse $ nb_response ) : bool { if ( ( $ this -> nb_request = $ nb_request ) === null || ( $ this -> nb_response = $ nb_response ) === null || ( $ this -> nb_engine = CNabuEngine :: getEngine ( ) ) === null || ( $ this -> nb_application = $ this -> nb_engine -> getApplication ( ) ) === null || ( $ this -> nb_session = CNabuHTTPSession :: getSession ( ) ) === null || ( $ this -> nb_server = $ this -> nb_engine -> getHTTPServer ( ) -> getServer ( ) ) === null || ( $ this -> nb_customer = $ this -> nb_engine -> getCustomer ( ) ) === null || ( $ this -> nb_site = $ this -> nb_request -> getSite ( ) ) === null || ( $ this -> nb_site_alias = $ this -> nb_request -> getSiteAlias ( ) ) === null || ( $ this -> nb_site_target = $ this -> nb_request -> getSiteTarget ( ) ) === null || ( $ this -> nb_language = $ this -> nb_request -> getLanguage ( ) ) === null ) { $ retval = false ; } else { $ this -> nb_work_customer = $ this -> nb_application -> getSecurityManager ( ) -> getWorkCustomer ( ) ; $ this -> nb_user = $ this -> nb_application -> getSecurityManager ( ) -> getUser ( ) ; $ this -> nb_role = $ this -> nb_application -> getSecurityManager ( ) -> getRole ( ) ; $ this -> nb_site_role = $ this -> nb_application -> getSecurityManager ( ) -> getSiteRole ( ) ; $ this -> nb_site_user = $ this -> nb_application -> getSecurityManager ( ) -> getSiteUser ( ) ; $ this -> nb_site_alias_role = $ this -> nb_request -> getSiteAliasRole ( ) ; $ this -> nb_commerce = $ this -> nb_request -> getCommerce ( ) ; $ retval = true ; } return $ retval ; }
This method is called just after the instantiation of plugin to set request and response objects . After called from the Engine all protected properties of this class are setted with proper values .
17,252
public function getAll ( $ applicationID , $ scanID , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> getAll ( $ applicationID , $ scanID , $ queryParams ) ; return new IssuesResponse ( $ response ) ; }
Get all issue for a scan
17,253
public function getStats ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> getStats ( $ appId , $ scanId , $ queryParams ) ; return new IssueStatsResponse ( $ response ) ; }
Get stats for all issues of scan
17,254
public function getById ( $ appId , $ scanId , $ issueId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> getById ( $ appId , $ scanId , $ issueId , $ queryParams ) ; return new IssueResponse ( $ response ) ; }
Get issue for scan by id
17,255
public function create ( $ appId , $ scanId , $ input , array $ queryParams = [ ] ) { if ( $ input instanceof IssueBuilder ) { $ inputArray = $ input -> toArray ( ) ; $ defaultInput = true ; } else { $ inputArray = [ ] ; foreach ( $ input as $ key => $ value ) { if ( $ value instanceof BaseBuilder ) { $ inputArray [ $ key ] = $ value -> toArray ( ) ; } else if ( is_array ( $ value ) ) { foreach ( $ value as $ key2 => $ value2 ) { if ( $ value2 instanceof BaseBuilder ) { $ inputArray [ $ key ] [ $ key2 ] = $ value2 -> toArray ( ) ; } else if ( is_string ( $ value2 ) ) { $ inputArray [ $ key ] [ $ key2 ] = $ value2 ; } } } } $ defaultInput = false ; } $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> create ( $ appId , $ scanId , $ inputArray , $ queryParams , $ defaultInput ) ; return new IssueResponse ( $ response ) ; }
Create a new issue for a scan
17,256
public function setSiteId ( int $ nb_site_id ) : CNabuDataObject { if ( $ nb_site_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_site_id" ) ) ; } $ this -> setValue ( 'nb_site_id' , $ nb_site_id ) ; return $ this ; }
Sets the Site Id attribute value .
17,257
public function setRoleId ( int $ nb_role_id ) : CNabuDataObject { if ( $ nb_role_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_role_id" ) ) ; } $ this -> setValue ( 'nb_role_id' , $ nb_role_id ) ; return $ this ; }
Sets the Role Id attribute value .
17,258
public function setLoginRedirectionTargetUseURI ( $ login_redirection_target_use_uri ) : CNabuDataObject { if ( $ login_redirection_target_use_uri === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$login_redirection_target_use_uri" ) ) ; } $ this -> setValue ( 'nb_site_role_login_redirection_target_use_uri' , $ login_redirection_target_use_uri ) ; return $ this ; }
Sets the Site Role Login Redirection Target Use URI attribute value .
17,259
public function setPoliciesTargetUseURI ( $ policies_target_use_uri ) : CNabuDataObject { if ( $ policies_target_use_uri === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$policies_target_use_uri" ) ) ; } $ this -> setValue ( 'nb_site_role_policies_target_use_uri' , $ policies_target_use_uri ) ; return $ this ; }
Sets the Site Role Policies Target Use URI attribute value .
17,260
public function setUserGroupId ( int $ nb_user_group_id ) : CNabuDataObject { if ( $ nb_user_group_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_user_group_id" ) ) ; } $ this -> setValue ( 'nb_user_group_id' , $ nb_user_group_id ) ; return $ this ; }
Sets the User Group Id attribute value .
17,261
public function setTitle ( string $ title ) : CNabuDataObject { if ( $ title === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$title" ) ) ; } $ this -> setValue ( 'nb_user_group_lang_title' , $ title ) ; return $ this ; }
Sets the User Group Lang Title attribute value .
17,262
static public function getProductsForCommerce ( $ nb_commerce ) { $ nb_commerce_id = nb_getMixedValue ( $ nb_commerce , NABU_COMMERCE_FIELD_ID ) ; if ( is_numeric ( $ nb_commerce_id ) ) { $ retval = CNabuCommerceProduct :: buildObjectListFromSQL ( 'nb_commerce_product_id' , 'SELECT * FROM nb_commerce_product WHERE nb_commerce_id=%commerce_id$d' , array ( 'commerce_id' => $ nb_commerce_id ) ) ; if ( $ nb_commerce instanceof CNabuCommerce ) { $ retval -> setCommerce ( $ nb_commerce ) ; } } else { $ retval = new CNabuCommerceProductCategoryList ( $ nb_commerce instanceof CNabuCommerce ? $ nb_commerce : null ) ; } return $ retval ; }
Get all Products of a Commerce .
17,263
static public function findBySKU ( $ nb_commerce , string $ sku ) { $ retval = false ; $ nb_commerce_id = nb_getMixedValue ( $ nb_commerce , NABU_COMMERCE_FIELD_ID ) ; if ( is_numeric ( $ nb_commerce_id ) ) { $ retval = CNabuCommerceProduct :: buildObjectFromSQL ( 'SELECT * from nb_commerce_product where nb_commerce_id=%commerce_id$d and nb_commerce_product_sku=\'%sku$s\' ' , array ( 'commerce_id' => $ nb_commerce_id , 'sku' => $ sku ) ) ; } return $ retval ; }
Find a product in a Commerce by its SKU .
17,264
public function setEmail ( string $ email ) : CNabuDataObject { $ value = parent :: setEmail ( strtolower ( $ email ) ) ; return $ value ; }
Overrides the method to convert to lowercase emails before store them in the object .
17,265
public function activate ( bool $ save = false ) : bool { $ retval = false ; $ current = $ this -> getValidationStatus ( ) ; if ( $ current === self :: USER_VALIDATION_PENDING || $ current === self :: USER_VALIDATION_PENDING_WITH_INVITATION ) { $ this -> setActivationDatetime ( date ( 'Y-m-d H:i:s' , time ( ) ) ) ; $ this -> setValidationStatus ( CNabuUser :: USER_ACTIVE ) ; $ retval = ( $ save ? $ this -> save ( ) : true ) ; } return $ retval ; }
Activates the User account .
17,266
public static function findByStaticEncodedId ( $ nb_customer , string $ key ) { $ retval = null ; if ( is_numeric ( $ nb_customer_id = nb_getMixedValue ( $ nb_customer , NABU_CUSTOMER_FIELD_ID ) ) && strlen ( $ key ) > 0 ) { $ retval = CNabuUser :: buildObjectFromSQL ( 'select * ' . 'from nb_user u, nb_customer c ' . 'where u.nb_customer_id=c.nb_customer_id ' . 'and c.nb_customer_id=%cust_id$d ' . "and md5(concat('%pref\$s', u.nb_user_id, '%suff\$s'))='%key\$s'" , array ( 'pref' => NABU_ENC_ID_PREF , 'suff' => NABU_ENC_ID_SUFF , 'cust_id' => $ nb_customer_id , 'key' => $ key ) ) ; if ( $ nb_customer instanceof CNabuCustomer && $ retval !== null ) { $ retval -> setCustomer ( $ nb_customer ) ; } } return $ retval ; }
Find a User by an static encoded key .
17,267
public static function findByStaticEncodedLogin ( $ nb_customer , string $ key ) { $ retval = null ; if ( is_numeric ( $ nb_customer_id = nb_getMixedValue ( $ nb_customer , NABU_CUSTOMER_FIELD_ID ) ) && strlen ( $ key ) > 0 ) { $ retval = CNabuUser :: buildObjectFromSQL ( 'select * ' . 'from nb_user u, nb_customer c ' . 'where u.nb_customer_id=c.nb_customer_id ' . 'and c.nb_customer_id=%cust_id$d ' . "and md5(concat('%pref\$s', u.nb_user_login, '%suff\$s'))='%key\$s'" , array ( 'pref' => self :: PASS_PREF , 'suff' => self :: PASS_SUFF , 'cust_id' => $ nb_customer_id , 'key' => $ key ) ) ; if ( $ nb_customer instanceof CNabuCustomer && $ retval !== null ) { $ retval -> setCustomer ( $ nb_customer ) ; } } return $ retval ; }
Find a User by an static encoded login .
17,268
public static function findByTemporalEncodedId ( $ nb_customer , string $ key , int $ expires = NABU_TEMP_ENC_ID_EXPIRATION_TIME ) { $ retval = null ; if ( is_numeric ( $ nb_customer_id = nb_getMixedValue ( $ nb_customer , NABU_CUSTOMER_FIELD_ID ) ) && strlen ( $ key ) > 0 ) { $ hash_left = $ hash_time = null ; sscanf ( $ key , "%32s%x" , $ hash_left , $ hash_time ) ; if ( $ hash_time >= time ( ) ) { $ retval = CNabuUser :: buildObjectFromSQL ( 'select * ' . 'from nb_user u, nb_customer c ' . 'where u.nb_customer_id=c.nb_customer_id ' . 'and c.nb_customer_id=%cust_id$d ' . "and md5(concat('%pref\$s', u.nb_user_id, '%suff\$s'))='%key\$s'" , array ( 'pref' => NABU_ENC_ID_PREF , 'suff' => NABU_ENC_ID_SUFF , 'cust_id' => $ nb_customer_id , 'key' => $ hash_left ) ) ; if ( $ nb_customer instanceof CNabuCustomer && $ retval !== null ) { $ retval -> setCustomer ( $ nb_customer ) ; } } } return $ retval ; }
Find a User by a temporal encoded key .
17,269
static public function findBySiteLogin ( $ nb_site , $ login , $ passwd , $ active = true ) { $ retval = null ; $ nb_site_id = nb_getMixedValue ( $ nb_site , 'nb_site_id' ) ; if ( is_numeric ( $ nb_site_id ) ) { $ retval = CNabuUser :: buildObjectFromSQL ( "select u.*, su.nb_role_id " . "from nb_user u, nb_site_user su " . "where (u.nb_user_login='%login\$s' or lower(u.nb_user_email)=lower('%login\$s')) " . "and u.nb_user_passwd='%passwd\$s' " . ( $ active ? "and u.nb_user_validation_status='T' " : '' ) . "and u.nb_user_id=su.nb_user_id " . "and su.nb_site_id=%site_id\$d" , array ( 'login' => $ login , 'passwd' => CNabuUser :: encodePassword ( $ passwd ) , 'site_id' => $ nb_site_id ) ) ; } return $ retval ; }
Find a user by his login data in a site .
17,270
static public function findByEMail ( $ nb_customer , string $ email ) { $ retval = null ; if ( is_numeric ( $ nb_customer_id = nb_getMixedValue ( $ nb_customer , NABU_CUSTOMER_FIELD_ID ) ) ) { $ retval = CNabuUser :: buildObjectFromSQL ( 'select u.* ' . 'from nb_user u, nb_customer c ' . 'where u.nb_customer_id=c.nb_customer_id ' . 'and c.nb_customer_id=%cust_id$d ' . 'and u.nb_user_email=\'%email$s\'' , array ( 'cust_id' => $ nb_customer_id , 'email' => $ email ) ) ; if ( $ retval instanceof CNabuUser && $ nb_customer instanceof CNabuCustomer ) { $ retval -> setCustomer ( $ nb_customer ) ; } } return $ retval ; }
Find a user by email .
17,271
public function getPrescriber ( bool $ force = false ) { if ( $ this -> nb_prescriber == NULL || $ this -> nb_prescriber -> getId ( ) != $ this -> getPrescriberId ( ) || $ force ) { $ nb_prescriber_id = $ this -> getPrescriberId ( ) ; if ( $ nb_prescriber_id === null || $ this -> getCustomer ( ) === null ) { $ this -> nb_prescriber = null ; } else { $ this -> nb_prescriber = $ this -> getCustomer ( ) -> getUser ( $ nb_prescriber_id ) ; } } return $ this -> nb_prescriber ; }
Gets the Prescriber instance .
17,272
public static function hydrateCollection ( array $ callbacks ) { $ hydrated = [ ] ; foreach ( $ callbacks as $ callback ) { $ hydrated [ ] = self :: hydrate ( $ callback ) ; } return $ hydrated ; }
Hydrate a collection of callback objects into a collection of CallbackEntity objects
17,273
public static function hydrate ( stdClass $ callback ) { $ hydrated = new CallbackEntity ( ) ; if ( isset ( $ callback -> id ) ) { $ hydrated -> setId ( $ callback -> id ) ; } if ( isset ( $ callback -> internal ) ) { $ hydrated -> setInternal ( $ callback -> internal ) ; } if ( isset ( $ callback -> observe_organization ) ) { $ hydrated -> setObserveOrganization ( $ callback -> observe_organization ) ; } if ( isset ( $ callback -> url ) ) { $ hydrated -> setUrl ( $ callback -> url ) ; } if ( isset ( $ callback -> reports ) && is_array ( $ callback -> reports ) ) { $ hydrated -> setReports ( $ callback -> reports ) ; } if ( isset ( $ callback -> created_at ) ) { $ hydrated -> setCreatedAt ( new DateTime ( $ callback -> created_at ) ) ; } if ( isset ( $ callback -> created_by ) ) { $ hydrated -> setCreatedBy ( UserHydrator :: hydrate ( $ callback -> created_by ) ) ; } if ( isset ( $ callback -> users ) && is_array ( $ callback -> users ) ) { $ hydrated -> setUsers ( UserHydrator :: hydrateCollection ( $ callback -> users ) ) ; } if ( isset ( $ callback -> applications ) && is_array ( $ callback -> applications ) ) { $ hydrated -> setApplications ( ApplicationHydrator :: hydrateCollection ( $ callback -> applications ) ) ; } if ( isset ( $ callback -> scans ) && is_array ( $ callback -> scans ) ) { $ hydrated -> setScans ( ScanHydrator :: hydrateCollection ( $ callback -> scans ) ) ; } return $ hydrated ; }
Hydrate a callback object into a CallbackEntity object
17,274
public function isForPublicZone ( bool $ strict = false ) { if ( ! method_exists ( $ this , 'getZone' ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_FEATURE_NOT_IMPLEMENTED ) ; } $ zone = $ this -> getZone ( ) ; return ( $ zone === CNabuSite :: ZONE_PUBLIC || ( ! $ strict && $ zone === CNabuSite :: ZONE_BOTH ) ) ; }
Check if the Role is applied to Public Zone .
17,275
public function isForPrivateZone ( bool $ strict = false ) { if ( ! method_exists ( $ this , 'getZone' ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_FEATURE_NOT_IMPLEMENTED ) ; } $ zone = $ this -> getZone ( ) ; return ( $ zone === CNabuSite :: ZONE_PRIVATE || ( ! $ strict && $ zone === CNabuSite :: ZONE_BOTH ) ) ; }
Check if the Role is applied to Private Zone .
17,276
public function isForBothZones ( ) { if ( ! method_exists ( $ this , 'getZone' ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_FEATURE_NOT_IMPLEMENTED ) ; } return $ this -> getZone ( ) === CNabuSite :: ZONE_BOTH ; }
Check if the Role is applied to both zones .
17,277
public function isZoneHidden ( ) { if ( ! method_exists ( $ this , 'getZone' ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_FEATURE_NOT_IMPLEMENTED ) ; } $ zone = $ this -> getZone ( ) ; return $ zone !== CNabuSite :: ZONE_PUBLIC && $ zone !== CNabuSite :: ZONE_PRIVATE && $ zone !== CNabuSite :: ZONE_HIDDEN ; }
Check it the Role is hidden .
17,278
public function grantHash ( bool $ save = false ) : string { if ( ! nb_isValidGUID ( $ hash = $ this -> getHash ( ) ) ) { $ this -> setHash ( $ hash = nb_generateGUID ( ) ) ; if ( $ save && $ this instanceof CNabuDBObject ) { $ this -> save ( ) ; } } return $ hash ; }
Grants that this object have a valid hash . Optionally can save the hash in the database .
17,279
public static function hydrateCollection ( array $ users ) { $ hydrated = [ ] ; foreach ( $ users as $ user ) { $ hydrated [ ] = self :: hydrate ( $ user ) ; } return $ hydrated ; }
Hydrate a collection of user objects into a collection of UserEntity objects
17,280
public static function hydrate ( stdClass $ user ) { $ hydrated = new UserEntity ( ) ; if ( isset ( $ user -> id ) ) { $ hydrated -> setId ( $ user -> id ) ; } if ( isset ( $ user -> email ) ) { $ hydrated -> setEmail ( $ user -> email ) ; } if ( isset ( $ user -> firstname ) ) { $ hydrated -> setFirstname ( $ user -> firstname ) ; } if ( isset ( $ user -> lastname ) ) { $ hydrated -> setLastname ( $ user -> lastname ) ; } if ( isset ( $ user -> valid_until ) ) { $ hydrated -> setValidUntil ( new DateTime ( $ user -> valid_until ) ) ; } if ( isset ( $ user -> organization ) ) { $ hydrated -> setOrganization ( OrgHydrator :: hydrate ( $ user -> organization ) ) ; } if ( isset ( $ user -> roles ) ) { $ hydrated -> setRoles ( $ user -> roles ) ; } if ( isset ( $ user -> root ) ) { $ hydrated -> setRoot ( $ user -> root ) ; } if ( isset ( $ user -> whitelisted_ips ) ) { $ hydrated -> setWhitelistedIps ( $ user -> whitelisted_ips ) ; } if ( isset ( $ user -> last_login ) ) { $ hydrated -> setLastLogin ( new DateTime ( $ user -> last_login ) ) ; } if ( isset ( $ user -> confirmation_token ) ) { $ hydrated -> setConfirmationToken ( $ user -> confirmation_token ) ; } if ( isset ( $ user -> reset_token ) ) { $ hydrated -> setResetToken ( $ user -> reset_token ) ; } return $ hydrated ; }
Hydrate a user object into a UserEntity object
17,281
protected function replaceRouteParameters ( $ route , & $ parameters = [ ] ) { return \ preg_replace_callback ( '/\{(.*?)(:.*?)?(\{[0-9,]+\})?\}/' , function ( $ m ) use ( & $ parameters ) { return isset ( $ parameters [ $ m [ 1 ] ] ) ? Arr :: pull ( $ parameters , $ m [ 1 ] ) : $ m [ 0 ] ; } , $ route ) ; }
Replace the route parameters with their parameter .
17,282
static public function getMapRolesForSite ( $ nb_site ) { $ nb_site_id = nb_getMixedValue ( $ nb_site , NABU_SITE_FIELD_ID ) ; if ( is_numeric ( $ nb_site_id ) ) { $ retval = CNabuEngine :: getEngine ( ) -> getMainDB ( ) -> getQueryAsObjectArray ( '\nabu\data\site\CNabuSiteMapRole' , null , 'select smr.* ' . 'from nb_site_map sm, nb_site_map_role smr ' . 'where sm.nb_site_map_id=smr.nb_site_map_id ' . 'and sm.nb_site_id=%site_id$d ' . 'order by sm.nb_site_map_order, smr.nb_role_id' , array ( 'site_id' => $ nb_site_id ) , null , true ) ; } else { $ retval = null ; } return $ retval ; }
Get all roles to be applied to all maps of a Site .
17,283
public static function hydrateCollection ( array $ comments ) { $ hydrated = [ ] ; foreach ( $ comments as $ comment ) { $ hydrated [ ] = self :: hydrate ( $ comment ) ; } return $ hydrated ; }
Hydrate a collection of comment objects into a collection of CommentEntity objects
17,284
public static function hydrate ( stdClass $ comment ) { $ hydrated = new CommentEntity ( ) ; if ( isset ( $ comment -> id ) ) { $ hydrated -> setId ( $ comment -> id ) ; } if ( isset ( $ comment -> comment ) ) { $ hydrated -> setComment ( $ comment -> comment ) ; } if ( isset ( $ comment -> created_at ) ) { $ hydrated -> setCreatedAt ( new DateTime ( $ comment -> created_at ) ) ; } if ( isset ( $ comment -> created_by ) ) { $ hydrated -> setCreatedBy ( UserHydrator :: hydrate ( $ comment -> created_by ) ) ; } if ( isset ( $ comment -> source ) ) { $ hydrated -> setSource ( $ comment -> source ) ; } if ( isset ( $ comment -> issue ) ) { $ hydrated -> setIssue ( IssueHydrator :: hydrate ( $ comment -> issue ) ) ; } return $ hydrated ; }
Hydrate a comment object into a CommentEntity object
17,285
public function setCatalogItemId ( int $ nb_catalog_item_id ) : CNabuDataObject { if ( $ nb_catalog_item_id === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$nb_catalog_item_id" ) ) ; } $ this -> setValue ( 'nb_catalog_item_id' , $ nb_catalog_item_id ) ; return $ this ; }
Sets the Catalog Item Id attribute value .
17,286
public function get ( array $ queryParams = [ ] ) { $ response = $ this -> api -> systems ( ) -> ldap ( ) -> get ( $ queryParams ) ; return new LdapResponse ( $ response ) ; }
Get LDAP settings
17,287
public function update ( LdapBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> systems ( ) -> ldap ( ) -> update ( $ input -> toArray ( ) , $ queryParams ) ; return new LdapResponse ( $ response ) ; }
Update LDAP settings
17,288
public function sync ( array $ queryParams = [ ] ) { $ response = $ this -> api -> systems ( ) -> ldap ( ) -> sync ( $ queryParams ) ; return new BaseResponse ( $ response ) ; }
Synchronize users with LDAP directory
17,289
public function getAll ( array $ queryParams = [ ] ) { $ response = $ this -> api -> settings ( ) -> getAll ( $ queryParams ) ; return new SettingsResponse ( $ response ) ; }
Get all settings
17,290
public function createOrUpdate ( $ key , SettingBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> settings ( ) -> createOrUpdate ( $ key , $ input -> toArray ( ) , $ queryParams ) ; return new SettingResponse ( $ response ) ; }
Create or update a quota
17,291
public function deleteAll ( array $ queryParams = [ ] ) { $ response = $ this -> api -> settings ( ) -> deleteAll ( $ queryParams ) ; return new BaseResponse ( $ response ) ; }
Delete all settings
17,292
public function errorHandler ( int $ errno , string $ errstr , string $ errfile , string $ errline , array $ errcontext ) { $ this -> dumpStack ( $ errstr , $ errno , $ errfile , $ errline , $ errcontext ) ; return true ; }
Error handler function . Dumps the error to errors log file and stores internally to send at the end of the dispatch method to a logs store .
17,293
public function dumpStack ( string $ message = null , string $ type = null , string $ errfile = null , int $ errline = null , $ errcontext = null , array $ stack = null ) { global $ NABU_MESSAGE_TYPE_NAME ; if ( ( $ errtype = nb_getArrayValueByKey ( $ type , $ NABU_MESSAGE_TYPE_NAME ) ) === null ) { $ this -> nb_engine -> errorLog ( "Unknow error type [$type]: $message in $errfile [line:$errline]" ) ; } else { $ this -> nb_engine -> errorLog ( "$errtype: $message in $errfile [line:$errline]" ) ; } if ( $ stack === null ) { $ stack = debug_backtrace ( true ) ; } $ count = - 1 ; do { foreach ( $ stack as $ line ) { if ( $ count < 0 && ( ! array_key_exists ( 'file' , $ line ) || ! array_key_exists ( 'line' , $ line ) || $ line [ 'file' ] !== $ errfile || $ line [ 'line' ] !== $ errline ) ) { continue ; } elseif ( array_key_exists ( 'file' , $ line ) && $ line [ 'file' ] === $ errfile && $ line [ 'line' ] === $ errline ) { $ count ++ ; continue ; } $ source = '' ; if ( array_key_exists ( self :: LINE_CLASS , $ line ) ) { $ source .= $ line [ self :: LINE_CLASS ] ; } if ( array_key_exists ( 'type' , $ line ) ) { $ source .= $ line [ 'type' ] ; } if ( array_key_exists ( self :: LINE_FUNCTION , $ line ) ) { $ source .= $ line [ self :: LINE_FUNCTION ] ; } if ( array_key_exists ( self :: LINE_CLASS , $ line ) && array_key_exists ( 'type' , $ line ) && array_key_exists ( self :: LINE_FUNCTION , $ line ) && array_key_exists ( 'args' , $ line ) && is_array ( $ line [ 'args' ] ) && count ( $ line [ 'args' ] ) > 0 && $ line [ self :: LINE_CLASS ] == 'nabu\\core\\CNabuPluginManager' && $ line [ self :: LINE_FUNCTION ] == 'invoqueCommand' ) { $ source .= ' calling command [' . $ line [ 'args' ] [ 0 ] . ']' ; } if ( array_key_exists ( 'file' , $ line ) ) { $ source .= ' in ' . $ line [ 'file' ] ; } if ( array_key_exists ( 'line' , $ line ) ) { $ source .= " [line:$line[line]]" ; } $ this -> nb_engine -> errorLog ( "#$count at $source" ) ; $ count ++ ; } $ count ++ ; } while ( $ count < 1 ) ; }
Analizes and creates a Stack sequence of call from the beginning of the execution until the point of error and log each step in the Engine Log store .
17,294
public function traceLog ( string $ key = null , $ message = null ) { if ( $ this -> trace_log_enabled ) { if ( is_array ( $ message ) || is_object ( $ message ) ) { $ text = print_r ( $ message , true ) ; } elseif ( $ message === null ) { $ text = "[null]" ; } elseif ( $ message === false ) { $ text = "[false]" ; } elseif ( $ message === true ) { $ text = "[true]" ; } else { $ text = $ message ; } error_log ( "=== " . ( $ key !== null ? "$key: " : '' ) . $ text ) ; } if ( $ key === null ) { if ( $ this -> trace_log_buffer === null ) { $ this -> trace_log_buffer = array ( ) ; } if ( array_key_exists ( self :: MESSAGES_STACK , $ this -> trace_log_buffer ) ) { $ this -> trace_log_buffer [ self :: MESSAGES_STACK ] [ ] = $ message ; } else { $ this -> trace_log_buffer [ self :: MESSAGES_STACK ] = array ( $ message ) ; } } else { $ this -> trace_log_buffer [ $ key ] = $ message ; } }
Traces a categorized data in the error log default system and stores it inside the instance to be transmited after to a logs analyzer database .
17,295
protected static function bootAutoUuid ( ) { static :: creating ( function ( $ model ) { foreach ( $ model -> getAutoUuids ( ) as $ autoUuid ) { if ( empty ( $ model -> { $ autoUuid } ) ) { $ model -> setAttribute ( $ autoUuid , $ model -> generateUuid ( ) -> getBytes ( ) ) ; } } } ) ; }
Boot the uuid trait for a model .
17,296
public function getById ( $ appId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> getById ( $ appId , $ queryParams ) ; return new ApplicationResponse ( $ response ) ; }
Get application by id
17,297
public function update ( $ appId , ApplicationBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> update ( $ appId , $ input -> toArray ( ) , $ queryParams ) ; return new ApplicationResponse ( $ response ) ; }
Update an existing application
17,298
public function deleteAll ( array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> deleteAll ( $ queryParams ) ; return new BaseResponse ( $ response ) ; }
Delete all applications
17,299
public function writeHistory ( $ action , $ title = null , array $ old = [ ] , array $ new = [ ] ) { $ data [ 'historable_id' ] = $ this -> getKey ( ) ; $ data [ 'historable_type' ] = get_class ( $ this ) ; $ data [ 'user_id' ] = auth ( ) -> id ( ) ; $ data [ 'title' ] = $ title ; $ data [ 'icon_class' ] = $ this -> iconClass ( $ action ) ; $ data [ 'historable_table' ] = $ this -> getTable ( ) ; $ data [ 'action' ] = $ action ; $ data [ 'old' ] = $ old ; $ data [ 'new' ] = $ new ; ( new EloquentHistory ( ) ) -> create ( $ data ) ; }
Write History row .