idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
17,900
public function deleteById ( $ teamId , array $ queryParams = [ ] ) { $ response = $ this -> api -> teams ( ) -> deleteById ( $ teamId , $ queryParams ) ; return new BaseResponse ( $ response ) ; }
Delete team by id
17,901
public static function getAllCatalogItems ( CNabuCatalog $ nb_catalog ) { $ nb_catalog_id = nb_getMixedValue ( $ nb_catalog , 'nb_catalog_id' ) ; if ( is_numeric ( $ nb_catalog_id ) ) { $ retval = forward_static_call ( array ( get_called_class ( ) , 'buildObjectListFromSQL' ) , 'nb_catalog_item_id' , 'select * ' . 'from nb_catalog_item ' . 'where nb_catalog_id=%catalog_id$d' , array ( 'catalog_id' => $ nb_catalog_id ) , $ nb_catalog ) ; } else { $ retval = new CNabuCatalogItemList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_catalog_item_id is the index and each value is an instance of class CNabuCatalogItemBase .
17,902
public function setResponseTransform ( CNabuHTTPResponse $ nb_response , string $ interface_key = null ) { if ( $ interface_key === null ) { $ nb_response -> setTransformFactory ( null ) ; } else { $ nb_engine = CNabuEngine :: getEngine ( ) ; $ nb_descriptor = $ nb_engine -> getProviderInterfaceDescriptorByKey ( CNabuProviderFactory :: INTERFACE_RENDER_TRANSFORM , $ interface_key ) ; if ( $ nb_descriptor instanceof CNabuRenderTransformInterfaceDescriptor && ( $ nb_pool_manager = $ nb_engine -> getRenderPoolManager ( ) ) instanceof CNabuRenderPoolManager && ( $ nb_transform_factory = $ nb_pool_manager -> getTransformFactory ( $ nb_descriptor ) ) instanceof CNabuRenderTransformFactory ) { $ nb_response -> setTransformFactory ( $ nb_transform_factory ) ; } else { throw new ENabuRenderException ( ENabuRenderException :: ERROR_RENDER_TRANSFORM_NOT_FOUND , array ( $ interface_key ) ) ; } } return $ this ; }
Sets the Response Render Transform Interface using their Interface Name .
17,903
public function setForceDefaultLang ( string $ force_default_lang = "T" ) : CNabuDataObject { if ( $ force_default_lang === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$force_default_lang" ) ) ; } $ this -> setValue ( 'nb_site_user_force_default_lang' , $ force_default_lang ) ; return $ this ; }
Sets the Site User Force Default Lang attribute value .
17,904
public function getAll ( $ appId = null , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> getAll ( $ appId , $ queryParams ) ; return new ScansResponse ( $ response ) ; }
Get all Scans
17,905
public function getById ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> getById ( $ appId , $ scanId , $ queryParams ) ; return new ScanResponse ( $ response ) ; }
Get Scan by ID
17,906
public function create ( $ appId , $ input , array $ queryParams = [ ] ) { if ( $ input instanceof ScanBuilder ) { $ 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 ( ) -> create ( $ appId , $ inputArray , $ queryParams , $ defaultInput ) ; return new ScanResponse ( $ response ) ; }
Create a new scan
17,907
public function update ( $ appId , $ scanId , $ input , array $ queryParams = [ ] ) { if ( $ input instanceof ScanBuilder ) { $ inputArray = $ input -> toArray ( ) ; $ defaultInput = true ; } else { $ inputArray = [ ] ; foreach ( $ input as $ key => $ value ) { if ( $ value instanceof BaseBuilder ) { $ inputArray [ $ key ] = $ value -> toArray ( ) ; } } $ defaultInput = false ; } $ response = $ this -> api -> applications ( ) -> scans ( ) -> update ( $ appId , $ scanId , $ inputArray , $ queryParams , $ defaultInput ) ; return new ScanResponse ( $ response ) ; }
Update an existing scan by id
17,908
public function blockUntilDone ( $ appId , $ scanId , $ waitTime = 0 , $ sleepTime = 5 , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> blockUntilDone ( $ appId , $ scanId , $ waitTime , $ sleepTime , $ queryParams ) ; return new ScanResponse ( $ response ) ; }
Block until a scan is finished
17,909
protected function getCommands ( ) { return \ array_merge ( $ this -> commands , [ \ Illuminate \ Console \ Scheduling \ ScheduleRunCommand :: class , \ Laravel \ Lumen \ Console \ Commands \ ServeCommand :: class , ] ) ; }
Get the commands to add to the application .
17,910
public static function hydrateCollection ( array $ uploads ) { $ hydrated = [ ] ; foreach ( $ uploads as $ upload ) { $ hydrated [ ] = self :: hydrate ( $ upload ) ; } return $ hydrated ; }
Hydrate a collection of upload objects into a collection of UploadEntity objects
17,911
public static function hydrate ( stdClass $ upload ) { $ hydrated = new UploadEntity ; if ( isset ( $ upload -> id ) ) { $ hydrated -> setId ( $ upload -> id ) ; } if ( isset ( $ upload -> created_at ) ) { $ hydrated -> setCreatedAt ( new DateTime ( $ upload -> created_at ) ) ; } if ( isset ( $ upload -> name ) ) { $ hydrated -> setName ( $ upload -> name ) ; } if ( isset ( $ upload -> extension ) ) { $ hydrated -> setExtension ( $ upload -> extension ) ; } if ( isset ( $ upload -> size ) ) { $ hydrated -> setSize ( $ upload -> size ) ; } if ( isset ( $ upload -> file ) ) { $ hydrated -> setFile ( $ upload -> file ) ; } if ( isset ( $ upload -> created_by ) ) { $ hydrated -> setCreatedBy ( UserHydrator :: hydrate ( $ upload -> created_by ) ) ; } if ( isset ( $ upload -> application ) ) { $ hydrated -> setApplication ( ApplicationHydrator :: hydrate ( $ upload -> application ) ) ; } return $ hydrated ; }
Hydrate a upload object into a UploadEntity object
17,912
public static function hydrateCollection ( array $ activities ) { $ hydrated = [ ] ; foreach ( $ activities as $ activity ) { $ hydrated [ ] = self :: hydrate ( $ activity ) ; } return $ hydrated ; }
Hydrate a collection of activity objects into a collection of ActivityEntity objects
17,913
public static function hydrate ( stdClass $ activity ) { $ hydrated = new ActivityEntity ( ) ; if ( isset ( $ activity -> id ) ) { $ hydrated -> setId ( $ activity -> id ) ; } if ( isset ( $ activity -> type ) ) { $ hydrated -> setType ( $ activity -> type ) ; } if ( isset ( $ activity -> context ) ) { $ hydrated -> setContext ( json_decode ( json_encode ( $ activity -> context ) , true ) ) ; } if ( isset ( $ activity -> application ) ) { $ hydrated -> setApplication ( ApplicationHydrator :: hydrate ( $ activity -> application ) ) ; } if ( isset ( $ activity -> created_by ) ) { $ hydrated -> setCreatedBy ( UserHydrator :: hydrate ( $ activity -> created_by ) ) ; } if ( isset ( $ activity -> created_at ) ) { $ hydrated -> setCreatedAt ( new DateTime ( $ activity -> created_at ) ) ; } return $ hydrated ; }
Hydrate a activity object into a ActivityEntity object
17,914
public function setSiteMap ( CNabuSiteMap $ nb_site_map , $ field = NABU_SITE_MAP_FIELD_ID ) { $ this -> nb_site_map = $ nb_site_map ; if ( $ this instanceof CNabuDataObject ) { $ this -> transferValue ( $ nb_site_map , NABU_SITE_MAP_FIELD_ID , $ field ) ; } return $ this ; }
Sets the Site Map instance that owns this object and sets the field containing the site id .
17,915
public function getAll ( $ appId , $ scanId , $ issueId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> comments ( ) -> getAll ( $ appId , $ scanId , $ issueId , $ queryParams ) ; return new CommentsResponse ( $ response ) ; }
Get all comments for an issue
17,916
public function getById ( $ appId , $ scanId , $ issueId , $ commentId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> comments ( ) -> getById ( $ appId , $ scanId , $ issueId , $ commentId , $ queryParams ) ; return new CommentResponse ( $ response ) ; }
Get comment for an issue by id
17,917
public function create ( $ appId , $ scanId , $ issueId , CommentBuilder $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> comments ( ) -> create ( $ appId , $ scanId , $ issueId , $ input -> toArray ( ) , $ queryParams ) ; return new CommentResponse ( $ response ) ; }
Create a comment for an issue
17,918
public function deleteAll ( $ appId , $ scanId , $ issueId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> comments ( ) -> deleteAll ( $ appId , $ scanId , $ issueId , $ queryParams ) ; return new BaseResponse ( $ response ) ; }
Delete all comments for an issue
17,919
public function getCurrentStage ( string $ name ) : StageInterface { $ stageClass = $ this -> getStageClassName ( $ name ) ; do { $ useCurrentStage = false ; if ( ! isset ( $ currentStage ) ) { $ currentStage = $ this -> getStageInstance ( $ stageClass ) ; } $ this -> currentStageName = $ currentStage -> getName ( ) ; try { $ isNecessary = $ currentStage -> isNecessary ( ) ; } catch ( AbortStageException $ e ) { $ this -> warning = $ e -> getMessage ( ) ; $ isNecessary = true ; } if ( $ isNecessary ) { $ useCurrentStage = true ; } else { $ currentStage = $ this -> getNextStage ( ) ; } } while ( false === $ useCurrentStage ) ; return $ currentStage ; }
Get the stage that is the first necessary stage
17,920
private function getSequentialStage ( string $ direction ) : ? StageInterface { $ dir = in_array ( $ direction , [ 'prev' , 'next' ] ) ? $ direction : 'next' ; ksort ( $ this -> stageOrder ) ; while ( current ( $ this -> stageOrder ) !== $ this -> currentStageName && null !== key ( $ this -> stageOrder ) ) { next ( $ this -> stageOrder ) ; } $ key = $ dir ( $ this -> stageOrder ) ; if ( null !== $ key && false !== $ key ) { return $ this -> getStageInstance ( $ this -> stagesByName [ $ key ] ) ; } return null ; }
Get either previous or next stage
17,921
private function getStageInstance ( string $ stageClass ) : StageInterface { if ( ! class_exists ( $ stageClass ) ) { throw new RuntimeException ( 'Error: Could not find requested stage class.' ) ; } if ( in_array ( "Zikula\\Component\\Wizard\\InjectContainerInterface" , class_implements ( $ stageClass ) , true ) ) { return new $ stageClass ( $ this -> container ) ; } return new $ stageClass ( ) ; }
Factory class to instantiate a StageClass
17,922
private function getStageClassName ( string $ name ) : string { if ( ! empty ( $ this -> stagesByName [ $ name ] ) ) { return $ this -> stagesByName [ $ name ] ; } if ( ! empty ( $ this -> defaultStage ) && ! empty ( $ this -> stagesByName [ $ this -> defaultStage ] ) ) { return $ this -> stagesByName [ $ this -> defaultStage ] ; } throw new InvalidArgumentException ( 'The request stage could not be found and there is no default stage defined.' ) ; }
Match the stage and return the stage classname or default .
17,923
public function getAll ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> functions ( ) -> getAll ( $ appId , $ scanId , $ queryParams ) ; return new CustomFunctionsResponse ( $ response ) ; }
Get all custom functions for a scan
17,924
public function getById ( $ appId , $ scanId , $ functionId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> functions ( ) -> getById ( $ appId , $ scanId , $ functionId , $ queryParams ) ; return new CustomFunctionResponse ( $ response ) ; }
Get custom function for scan by id
17,925
public function create ( $ appId , $ scanId , $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> functions ( ) -> create ( $ appId , $ scanId , $ input -> toArray ( ) , $ queryParams ) ; return new CustomFunctionResponse ( $ response ) ; }
Create custom function for a scan
17,926
public function getAll ( $ appId , $ scanId , $ issueId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> summaries ( ) -> getAll ( $ appId , $ scanId , $ issueId , $ queryParams ) ; return new SummariesResponse ( $ response ) ; }
Get all summaries for an issue
17,927
public function getById ( $ appId , $ scanId , $ issueId , $ summaryId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> issues ( ) -> summaries ( ) -> getById ( $ appId , $ scanId , $ issueId , $ summaryId , $ queryParams ) ; return new SummaryResponse ( $ response ) ; }
Get summary for an issue by id
17,928
protected function registerRenderInterface ( INabuRenderInterface $ interface ) : bool { $ hash = $ interface -> getHash ( ) ; if ( is_array ( $ this -> render_interface_list ) && array_key_exists ( $ hash , $ this -> render_interface_list ) ) { throw new ENabuRenderException ( ENabuRenderException :: ERROR_RENDER_INSTANCE_ALREADY_REGISTERED , array ( get_class ( $ interface ) ) ) ; } if ( $ this -> render_interface_list === null ) { $ this -> render_interface_list = array ( $ hash => $ interface ) ; } else { $ this -> render_interface_list [ $ hash ] = $ interface ; } return $ interface -> init ( ) ; }
Register a new Render Interface instance .
17,929
protected function registerTransformInterface ( INabuRenderTransformInterface $ interface ) : bool { $ hash = $ interface -> getHash ( ) ; if ( is_array ( $ this -> render_transform_interface_list ) && array_key_exists ( $ hash , $ this -> render_transform_interface_list ) ) { throw new ENabuRenderException ( ENabuRenderException :: ERROR_RENDER_TRANSFORM_INSTANCE_ALREADY_REGISTERED , array ( get_class ( $ interface ) ) ) ; } if ( $ this -> render_transform_interface_list === null ) { $ this -> render_transform_interface_list = array ( $ hash => $ interface ) ; } else { $ this -> render_transform_interface_list [ $ hash ] = $ interface ; } return $ interface -> init ( ) ; }
Register a new Render Transform Interface instance .
17,930
public function hasValidSignature ( Request $ request ) { $ url = $ request -> url ( ) ; $ original = rtrim ( $ url . '?' . Arr :: query ( Arr :: except ( $ request -> query ( ) , 'signature' ) ) , '?' ) ; $ expires = $ request -> query ( ) [ 'expires' ] ?? null ; $ signature = \ hash_hmac ( 'sha256' , $ original , \ call_user_func ( $ this -> keyResolver ) ) ; return \ hash_equals ( $ signature , ( string ) $ request -> query ( 'signature' , '' ) ) && ! ( $ expires && Carbon :: now ( ) -> getTimestamp ( ) > $ expires ) ; }
Determine if the given request has a valid signature .
17,931
public function setTargetUseURI ( string $ target_use_uri = "N" ) : CNabuDataObject { if ( $ target_use_uri === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$target_use_uri" ) ) ; } $ this -> setValue ( 'nb_site_target_cta_target_use_uri' , $ target_use_uri ) ; return $ this ; }
Sets the Site Target CTA Target Use URI attribute value .
17,932
public static function getAllUsers ( 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_user_id' , 'select * ' . 'from nb_user ' . 'where nb_customer_id=%cust_id$d' , array ( 'cust_id' => $ nb_customer_id ) , $ nb_customer ) ; } else { $ retval = new CNabuUserList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_user_id is the index and each value is an instance of class CNabuUserBase .
17,933
public function setSearchVisibility ( string $ search_visibility = "N" ) : CNabuDataObject { if ( $ search_visibility === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$search_visibility" ) ) ; } $ this -> setValue ( 'nb_user_search_visibility' , $ search_visibility ) ; return $ this ; }
Sets the User Search Visibility attribute value .
17,934
public function setLogin ( string $ login ) : CNabuDataObject { if ( $ login === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$login" ) ) ; } $ this -> setValue ( 'nb_user_login' , $ login ) ; return $ this ; }
Sets the User Login attribute value .
17,935
public function setPassword ( string $ passwd ) : CNabuDataObject { if ( $ passwd === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$passwd" ) ) ; } $ this -> setValue ( 'nb_user_passwd' , $ passwd ) ; return $ this ; }
Sets the User Password attribute value .
17,936
public function setValidationStatus ( string $ validation_status = "F" ) : CNabuDataObject { if ( $ validation_status === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$validation_status" ) ) ; } $ this -> setValue ( 'nb_user_validation_status' , $ validation_status ) ; return $ this ; }
Sets the User Validation Status attribute value .
17,937
public function setPoliciesAccepted ( string $ policies_accepted = "F" ) : CNabuDataObject { if ( $ policies_accepted === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$policies_accepted" ) ) ; } $ this -> setValue ( 'nb_user_policies_accepted' , $ policies_accepted ) ; return $ this ; }
Sets the User Policies Accepted attribute value .
17,938
public function setCreationDatetime ( $ creation_datetime ) : CNabuDataObject { if ( $ creation_datetime === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$creation_datetime" ) ) ; } $ this -> setValue ( 'nb_user_creation_datetime' , $ creation_datetime ) ; return $ this ; }
Sets the User Creation Datetime attribute value .
17,939
public function setEmail ( string $ email ) : CNabuDataObject { if ( $ email === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$email" ) ) ; } $ this -> setValue ( 'nb_user_email' , $ email ) ; return $ this ; }
Sets the User Email attribute value .
17,940
public function setAllowNotification ( string $ allow_notification = "F" ) : CNabuDataObject { if ( $ allow_notification === null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_NULL_VALUE_NOT_ALLOWED_IN , array ( "\$allow_notification" ) ) ; } $ this -> setValue ( 'nb_user_allow_notification' , $ allow_notification ) ; return $ this ; }
Sets the User Allow Notification attribute value .
17,941
public function sort ( ) { return function ( \ SplFileInfo $ a , \ SplFileInfo $ b ) { preg_match ( self :: PATTERN , $ a -> getFileName ( ) , $ version_a ) ; preg_match ( self :: PATTERN , $ b -> getFileName ( ) , $ version_b ) ; return ( ( int ) $ version_a [ 1 ] < ( int ) $ version_b [ 1 ] ) ? - 1 : 1 ; } ; }
sort closure for Finder
17,942
public function getSqlFiles ( ) { $ sqlFinder = $ this -> getFinder ( ) ; $ files = $ sqlFinder -> files ( ) -> in ( $ this -> sqlFilesDir ) -> name ( self :: PATTERN ) -> sort ( $ this -> sort ( ) ) ; return $ files ; }
get sql files
17,943
public function getSqlFileByName ( $ fileName ) { $ sqlFinder = $ this -> getFinder ( ) ; $ files = $ sqlFinder -> files ( ) -> in ( $ this -> sqlFilesDir ) -> name ( $ fileName ) ; if ( $ files -> count ( ) !== 1 ) { throw new RuntimeException ( 'cannot find File:' . $ fileName ) ; } foreach ( $ files as $ file ) { return $ file ; } }
find sql file by the file name
17,944
public function getAppliedFiles ( ) { $ appliedFinder = $ this -> getFinder ( ) ; $ files = $ appliedFinder -> files ( ) -> in ( $ this -> appliedFilesDir ) -> name ( self :: PATTERN ) -> sort ( $ this -> sort ( ) ) ; return $ files ; }
get applied files
17,945
public function getStatuses ( ) { $ files = $ this -> getSqlFiles ( ) ; $ appliedFiles = $ this -> getAppliedFiles ( ) ; $ isApplied = function ( $ file ) use ( $ appliedFiles ) { foreach ( $ appliedFiles as $ appliedFile ) { if ( $ appliedFile -> getFileName ( ) === $ file -> getFileName ( ) ) { return true ; } } return false ; } ; $ statuses = [ ] ; foreach ( $ files as $ file ) { $ appliedAt = $ isApplied ( $ file ) ? date ( 'Y-m-d H:i:s' , $ file -> getMTime ( ) ) : "" ; $ statuses [ ] = new Status ( $ appliedAt , $ file ) ; } return $ statuses ; }
get migration status
17,946
public function getUpCandidates ( ) { $ statuses = $ this -> getStatuses ( ) ; $ latest = '' ; foreach ( $ statuses as $ status ) { if ( $ status -> appliedAt !== "" ) { $ latest = $ status -> file -> getFileName ( ) ; } } $ candidates = [ ] ; $ isSkipped = ( $ latest === '' ) ? false : true ; foreach ( $ statuses as $ status ) { if ( false === $ isSkipped ) { $ candidates [ ] = $ status ; } if ( $ status -> file -> getFileName ( ) !== $ latest ) { continue ; } else { $ isSkipped = false ; } } return $ candidates ; }
get up candidates sql files
17,947
public function copyToAppliedDir ( $ file ) { if ( false === @ copy ( $ file -> getPathName ( ) , $ this -> appliedFilesDir . '/' . $ file -> getFileName ( ) ) ) { throw new RuntimeException ( 'cannot copy the sql file to applied directory. check the <info>' . $ this -> appliedFilesDir . '</info> directory.' ) ; } }
copy applied sql file to the applied directory .
17,948
public function getProspect ( $ nb_prospect ) { $ retval = false ; if ( is_numeric ( $ nb_prospect_id = nb_getMixedValue ( $ nb_prospect , NABU_ICONTACT_PROSPECT_FIELD_ID ) ) ) { $ retval = $ this -> nb_icontact_prospect_list -> getItem ( $ nb_prospect_id ) ; } return $ retval ; }
Get a Prospect by his Id .
17,949
public function getProspectsOfUser ( $ nb_user , CNabuIContactProspectStatusType $ nb_status_type = null ) : CNabuIContactProspectList { $ this -> nb_icontact_prospect_list -> clear ( ) ; $ this -> nb_icontact_prospect_list -> merge ( CNabuIContactProspect :: getProspectsOfUser ( $ this , $ nb_user , $ nb_status_type ) ) ; return $ this -> nb_icontact_prospect_list ; }
Get a list with all Prospects owned by a User .
17,950
public function getCountProspectsOfUser ( $ nb_user , CNabuIContactProspectStatusType $ nb_status_type = null ) : int { return CNabuIContactProspect :: getCountProspectsOfUser ( $ this , $ nb_user , $ nb_status_type ) ; }
Get the number of Prospects owned by a User .
17,951
public function getProspects ( CNabuIContactProspectStatusType $ nb_status_type = null ) : CNabuIContactProspectList { $ this -> nb_icontact_prospect_list -> clear ( ) ; $ this -> nb_icontact_prospect_list -> merge ( CNabuIContactProspect :: getProspectsForIContact ( $ this , $ nb_status_type ) ) ; return $ this -> nb_icontact_prospect_list ; }
Get all prospects of an IContact .
17,952
public function getProspectStatusTypes ( bool $ force = false ) : CNabuIContactProspectStatusTypeList { if ( $ this -> nb_icontact_prospect_status_type_list -> isEmpty ( ) || $ force ) { $ this -> nb_icontact_prospect_status_type_list -> clear ( ) ; $ this -> nb_icontact_prospect_status_type_list -> merge ( CNabuIContactProspectStatusType :: getTypesForIContact ( $ this ) ) ; } return $ this -> nb_icontact_prospect_status_type_list ; }
Get Prospect Status Types of this instance .
17,953
public function getProspectStatusType ( $ nb_type ) { $ retval = false ; if ( is_numeric ( $ nb_type_id = nb_getMixedValue ( $ nb_type , 'nb_icontact_prospect_status_type_id' ) ) ) { $ retval = $ this -> nb_icontact_prospect_status_type_list -> getItem ( $ nb_type_id ) ; } return $ retval ; }
Get a specific Prospect Status Type of this instance .
17,954
public function getProspectStatusTypeByKey ( string $ key ) { $ retval = false ; if ( is_string ( $ key ) ) { $ this -> getProspectStatusTypes ( ) ; $ retval = $ this -> nb_icontact_prospect_status_type_list -> getItem ( $ key , CNabuIContactProspectStatusTypeList :: INDEX_KEY ) ; } return $ retval ; }
Get a specific Prospect Status Type of this instance identified by his key .
17,955
public function refresh ( bool $ force = false , bool $ cascade = false ) : bool { return parent :: refresh ( $ force , $ cascade ) && ( ! $ cascade || ( $ this -> getProspectStatusTypes ( $ force ) ) ) ; }
Overrides refresh method to allow iContact subentities to be refreshed .
17,956
public function grantStorageFolder ( bool $ save = true ) { $ base_path = $ this -> getBasePath ( ) ; if ( ! is_string ( $ base_path ) || strlen ( $ base_path ) === 0 || ! file_exists ( $ base_path ) ) { $ hash = mb_strtolower ( str_replace ( array ( '{' , '}' ) , '' , $ this -> grantHash ( ) ) ) ; $ base_path = NABU_ICONTACT_PATH . DIRECTORY_SEPARATOR . $ hash ; if ( ! file_exists ( $ base_path ) && ( ! mkdir ( $ base_path ) || ! file_exists ( $ base_path ) ) ) { throw new ENabuIContactException ( ENabuIContactException :: ERROR_MAIN_PATH_CANNOT_BE_CREATED , array ( $ base_path ) ) ; } $ this -> setBasePath ( $ base_path ) ; if ( $ save ) $ this -> save ( ) ; } }
Check if the main storage folder for this IContact exists and if not then create it .
17,957
protected function parseAction ( $ action ) { if ( \ is_string ( $ action ) ) { return [ 'uses' => $ action ] ; } elseif ( ! \ is_array ( $ action ) ) { return [ $ action ] ; } if ( isset ( $ action [ 'middleware' ] ) && \ is_string ( $ action [ 'middleware' ] ) ) { $ action [ 'middleware' ] = \ explode ( '|' , $ action [ 'middleware' ] ) ; } return $ action ; }
Parse the action into an array format .
17,958
public static function hydrateCollection ( array $ ldaps ) { $ hydrated = [ ] ; foreach ( $ ldaps as $ ldap ) { $ hydrated [ ] = self :: hydrate ( $ ldap ) ; } return $ hydrated ; }
Hydrate a collection of ldap objects into a collection of LdapEntity objects
17,959
public static function hydrate ( stdClass $ ldap ) { $ hydrated = new LdapEntity ( ) ; if ( isset ( $ ldap -> id ) ) { $ hydrated -> setId ( $ ldap -> id ) ; } if ( isset ( $ ldap -> enabled ) ) { $ hydrated -> setEnabled ( $ ldap -> enabled ) ; } if ( isset ( $ ldap -> search_dn ) ) { $ hydrated -> setSearchDn ( $ ldap -> search_dn ) ; } if ( isset ( $ ldap -> search_password ) ) { $ hydrated -> setSearchPassword ( $ ldap -> search_password ) ; } if ( isset ( $ ldap -> search_query ) ) { $ hydrated -> setSearchQuery ( $ ldap -> search_query ) ; } if ( isset ( $ ldap -> base_dn ) ) { $ hydrated -> setBaseDn ( $ ldap -> base_dn ) ; } if ( isset ( $ ldap -> email_key ) ) { $ hydrated -> setEmailKey ( $ ldap -> email_key ) ; } if ( isset ( $ ldap -> user_dn ) ) { $ hydrated -> setUserDn ( $ ldap -> user_dn ) ; } if ( isset ( $ ldap -> host ) ) { $ hydrated -> setHost ( $ ldap -> host ) ; } if ( isset ( $ ldap -> port ) ) { $ hydrated -> setPort ( $ ldap -> port ) ; } if ( isset ( $ ldap -> encryption ) ) { $ hydrated -> setEncryption ( $ ldap -> encryption ) ; } if ( isset ( $ ldap -> protocol_version ) ) { $ hydrated -> setProtocolVersion ( $ ldap -> protocol_version ) ; } if ( isset ( $ ldap -> expired_accounts ) ) { $ hydrated -> setExpiredAccounts ( $ ldap -> expired_accounts ) ; } if ( isset ( $ ldap -> last_sync_at ) ) { $ hydrated -> setLastSyncAt ( new DateTime ( $ ldap -> last_sync_at ) ) ; } return $ hydrated ; }
Hydrate a ldap object into a LdapEntity object
17,960
public function getData ( string $ table , $ name = "" ) { $ file = $ this -> base . '/' . $ table . '.json' ; if ( file_exists ( $ file ) ) { return json_decode ( file_get_contents ( $ file ) , true ) ; } else { throw new \ NonDB \ Exceptions \ DriverException ( 'Table Not Exists.' , 1002 ) ; } }
Get a table s data
17,961
public function setData ( string $ table , $ data ) { $ file = $ this -> base . '/' . $ table . '.json' ; if ( file_exists ( $ file ) ) { if ( file_put_contents ( $ file , json_encode ( $ data ) ) ) { $ status = true ; } else { $ status = false ; } return new \ NonDB \ Components \ Status ( $ status ) ; } else { throw new \ NonDB \ Exceptions \ DriverException ( 'Table Not Exists.' , 1002 ) ; } }
Set a table s data
17,962
public function newTable ( string $ name ) { $ status = file_put_contents ( $ file = $ this -> base . '/' . $ name . '.json' , "[]" ) ; return new \ NonDB \ Components \ Status ( $ status ) ; }
Add a table
17,963
public function removeTable ( string $ name ) { $ status = unlink ( $ file = $ this -> base . '/' . $ name . '.json' ) ; return new \ NonDB \ Components \ Status ( $ status ) ; }
Remove a table
17,964
public function initialize ( $ email , $ password , $ config ) { $ this -> api = new API ( $ email , $ password , $ config ) ; }
Initialize API instance
17,965
public static function hydrateCollection ( array $ processes ) { $ hydrated = [ ] ; foreach ( $ processes as $ process ) { $ hydrated [ ] = self :: hydrate ( $ process ) ; } return $ hydrated ; }
Hydrate a collection of process objects into a collection of ProcessEntity objects
17,966
public static function hydrate ( stdClass $ process ) { $ hydrated = new ProcessEntity ( ) ; if ( isset ( $ process -> id ) ) { $ hydrated -> setId ( $ process -> id ) ; } if ( isset ( $ process -> pid ) ) { $ hydrated -> setPid ( $ process -> pid ) ; } if ( isset ( $ process -> version ) ) { $ hydrated -> setVersion ( $ process -> version ) ; } if ( isset ( $ process -> name ) ) { $ hydrated -> setName ( $ process -> name ) ; } if ( isset ( $ process -> started_at ) ) { $ hydrated -> setStartedAt ( new DateTime ( $ process -> started_at ) ) ; } if ( isset ( $ process -> finished_at ) ) { $ hydrated -> setFinishedAt ( new DateTime ( $ process -> finished_at ) ) ; } if ( isset ( $ process -> finished ) ) { $ hydrated -> setFinished ( $ process -> finished ) ; } if ( isset ( $ process -> memory ) ) { $ hydrated -> setMemory ( $ process -> memory ) ; } if ( isset ( $ process -> phase ) ) { $ hydrated -> setPhase ( $ process -> phase ) ; } if ( isset ( $ process -> percent ) ) { $ hydrated -> setPercent ( $ process -> percent ) ; } if ( isset ( $ process -> weight ) ) { $ hydrated -> setWeight ( $ process -> weight ) ; } return $ hydrated ; }
Hydrate a process object into a ProcessEntity object
17,967
public static function hydrateCollection ( array $ extensions ) { $ hydrated = [ ] ; foreach ( $ extensions as $ extension ) { $ hydrated [ ] = self :: hydrate ( $ extension ) ; } return $ hydrated ; }
Hydrate a collection of extension objects into a collection of ExtensionEntity objects
17,968
public static function hydrate ( stdClass $ extension ) { $ hydrated = new ExtensionEntity ( ) ; if ( isset ( $ extension -> id ) ) { $ hydrated -> setId ( $ extension -> id ) ; } if ( isset ( $ extension -> extension ) ) { $ hydrated -> setExtension ( $ extension -> extension ) ; } return $ hydrated ; }
Hydrate a extension object into a ExtensionEntity object
17,969
public static function hydrateCollection ( array $ quotas ) { $ hydrated = [ ] ; foreach ( $ quotas as $ quota ) { $ hydrated [ ] = self :: hydrate ( $ quota ) ; } return $ hydrated ; }
Hydrate a collection of of quota objects into a collection of QuotaEntity objects
17,970
protected function createSecondaryIndexes ( ) { $ this -> addIndex ( new CNabuDataObjectListIndex ( $ this , 'nb_site_target_section_key' , 'nb_site_target_section_order' , self :: INDEX_KEY ) ) ; $ this -> addIndex ( new CNabuDataObjectListIndex ( $ this , 'nb_site_target_section_order' , 'nb_site_target_section_order' , self :: INDEX_ORDER ) ) ; }
Creates alternate indexes for this list .
17,971
public function acquireItem ( $ key , $ index = false ) { $ retval = false ; if ( $ index === false && CNabuEngine :: getEngine ( ) -> isMainDBAvailable ( ) ) { $ item = new CNabuSiteTargetSection ( $ key ) ; if ( $ item -> isFetched ( ) ) { $ retval = $ item ; } } return $ retval ; }
Acquires an instance of class CNabuSiteTargetSection from the database .
17,972
public static function getAllMessagings ( 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_messaging_id' , 'select * ' . 'from nb_messaging ' . 'where nb_customer_id=%cust_id$d' , array ( 'cust_id' => $ nb_customer_id ) , $ nb_customer ) ; } else { $ retval = new CNabuMessagingList ( ) ; } return $ retval ; }
Get all items in the storage as an associative array where the field nb_messaging_id is the index and each value is an instance of class CNabuMessagingBase .
17,973
public function getAll ( $ appId , $ scanId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> processes ( ) -> getAll ( $ appId , $ scanId , $ queryParams ) ; return new ProcessesResponse ( $ response ) ; }
Get all processes for a scan
17,974
public function getById ( $ appId , $ scanId , $ processId , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> processes ( ) -> getById ( $ appId , $ scanId , $ processId , $ queryParams ) ; return new ProcessResponse ( $ response ) ; }
Get process for scan by id
17,975
public function create ( $ appId , $ scanId , $ input , array $ queryParams = [ ] ) { $ response = $ this -> api -> applications ( ) -> scans ( ) -> processes ( ) -> create ( $ appId , $ scanId , $ input -> toArray ( ) , $ queryParams ) ; return new ProcessResponse ( $ response ) ; }
Create a process for a scan
17,976
public function clear ( ) { $ this -> list = null ; if ( is_array ( $ this -> secondary_indexes ) ) { foreach ( $ this -> secondary_indexes as $ index ) { $ index -> clear ( ) ; } } }
Empty the list and reset all indexes .
17,977
public function addIndex ( CNabuDataObjectListIndex $ index ) { $ name = $ index -> getName ( ) ; if ( is_array ( $ this -> secondary_indexes ) ) { $ this -> secondary_indexes [ $ name ] = $ index ; } else { $ this -> secondary_indexes = array ( $ name => $ index ) ; } return $ index ; }
Adds a new index to have alternate indexes of this list .
17,978
public function getIndex ( $ index ) { if ( is_string ( $ index ) && is_array ( $ this -> secondary_indexes ) && array_key_exists ( $ index , $ this -> secondary_indexes ) ) { return $ this -> secondary_indexes [ $ index ] ; } else { throw new ENabuCoreException ( ENabuCoreException :: ERROR_INVALID_INDEX , array ( print_r ( $ index , true ) ) ) ; } }
Gets a index instance of this list .
17,979
public function getKeys ( $ index = false ) { $ retval = null ; if ( $ index === false ) { $ retval = is_array ( $ this -> list ) ? array_keys ( $ this -> list ) : null ; } elseif ( is_string ( $ index ) && is_array ( $ this -> secondary_indexes ) && array_key_exists ( $ index , $ this -> secondary_indexes ) ) { $ retval = $ this -> secondary_indexes [ $ index ] -> getKeys ( ) ; } else { throw new ENabuCoreException ( ENabuCoreException :: ERROR_INVALID_INDEX , array ( print_r ( $ index , true ) ) ) ; } return $ retval ; }
Gets keys of this index as an array .
17,980
public function addItem ( CNabuDataObject $ item ) { $ retval = false ; if ( $ this -> index_field !== false ) { if ( $ item -> contains ( $ this -> index_field ) ) { if ( is_array ( $ this -> list ) ) { $ this -> list [ $ item -> getValue ( $ this -> index_field ) ] = $ item ; $ retval = $ item ; } else { $ this -> list = array ( $ item -> getValue ( $ this -> index_field ) => $ item ) ; $ retval = $ item ; } } } else { if ( is_array ( $ this -> list ) ) { $ this -> list [ ] = $ item ; $ retval = $ item ; } else { $ this -> list = array ( $ item ) ; $ retval = $ item ; } } $ this -> indexItem ( $ item ) ; return $ retval ; }
Adds a new item to the list .
17,981
protected function indexItem ( CNabuDataObject $ item ) { if ( is_array ( $ this -> secondary_indexes ) ) { foreach ( $ this -> secondary_indexes as $ index ) { $ index -> addItem ( $ item ) ; } } }
Puts an item in all indexes .
17,982
protected function removeItemIndex ( CNabuDataObject $ item ) { if ( is_array ( $ this -> secondary_indexes ) ) { foreach ( $ this -> secondary_indexes as $ index ) { $ index -> removeItem ( $ item -> getValue ( $ this -> index_field ) ) ; } } }
Removes and item in all indexes .
17,983
public function removeItem ( $ item ) { $ nb_index_id = nb_getMixedValue ( $ item , $ this -> index_field ) ; if ( ( is_numeric ( $ nb_index_id ) || nb_isValidGUID ( $ nb_index_id ) ) && $ this -> containsKey ( $ nb_index_id ) ) { unset ( $ this -> list [ $ nb_index_id ] ) ; $ this -> removeItemIndex ( $ item ) ; } }
Removes an item from the list .
17,984
public function mergeArray ( array $ array = null ) { $ count = 0 ; if ( is_array ( $ array ) ) { if ( count ( $ array ) > 0 ) { foreach ( $ array as $ key => $ item ) { if ( ! $ this -> containsKey ( $ key ) ) { $ this -> addItem ( $ item ) ; $ count ++ ; } } } } elseif ( $ array !== null ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_METHOD_PARAMETER_NOT_VALID , array ( '$array' , print_r ( $ array , true ) ) ) ; } return $ count ; }
Merges items included in an array .
17,985
public function compile ( $ stub , $ modelName , $ modelData , stdClass $ scaffolderConfig , $ hash , array $ extensions , $ extra = null ) { $ this -> date -> addSeconds ( 5 ) ; if ( File :: exists ( base_path ( 'scaffolder-config/cache/migration_' . $ hash . self :: CACHE_EXT ) ) ) { return $ this -> store ( $ modelName , $ scaffolderConfig , '' , new FileToCompile ( true , $ hash ) ) ; } else { $ this -> stub = $ stub ; $ this -> replaceClassName ( $ modelName ) -> replaceTableName ( $ scaffolderConfig , $ modelName ) -> addFields ( $ modelData ) ; foreach ( $ extensions as $ extension ) { $ this -> stub = $ extension -> runAfterMigrationIsCompiled ( $ this -> stub , $ modelData , $ scaffolderConfig ) ; } return $ this -> store ( $ modelName , $ scaffolderConfig , $ this -> stub , new FileToCompile ( false , $ hash ) ) ; } }
Compiles a migration .
17,986
private function replaceTableName ( stdClass $ scaffolderConfig , $ modelName ) { $ tableName = isset ( $ scaffolderConfig -> tableName ) && ! empty ( $ scaffolderConfig -> tableName ) ? $ scaffolderConfig -> tableName : $ modelName . 's' ; $ this -> stub = str_replace ( '{{table_name}}' , strtolower ( $ tableName ) , $ this -> stub ) ; return $ this ; }
Replace the table name .
17,987
private function addFields ( $ modelData ) { $ fields = $ this -> tab ( 3 ) . "\$table->increments('id');" . PHP_EOL . PHP_EOL ; foreach ( $ modelData -> fields as $ field ) { if ( $ field -> index == 'primary' ) { $ fields = '' ; break ; } } foreach ( $ modelData -> fields as $ field ) { $ parsedModifiers = '' ; if ( ! empty ( $ field -> modifiers ) ) { $ modifiersArray = explode ( ':' , $ field -> modifiers ) ; foreach ( $ modifiersArray as $ modifier ) { $ modifierAndValue = explode ( ',' , $ modifier ) ; if ( count ( $ modifierAndValue ) == 2 ) { $ parsedModifiers .= '->' . $ modifierAndValue [ 0 ] . '(' . $ modifierAndValue [ 1 ] . ')' ; } else { $ parsedModifiers .= '->' . $ modifierAndValue [ 0 ] . '()' ; } } } if ( $ field -> index != 'none' ) { $ fields .= sprintf ( $ this -> tab ( 3 ) . "\$table->%s('%s')%s->%s();" . PHP_EOL , $ field -> type -> db , $ field -> name , $ parsedModifiers , $ field -> index ) ; } else { $ fields .= sprintf ( $ this -> tab ( 3 ) . "\$table->%s('%s')%s;" . PHP_EOL , $ field -> type -> db , $ field -> name , $ parsedModifiers ) ; } if ( ! empty ( $ field -> foreignKey ) ) { $ foreignKey = explode ( ':' , $ field -> foreignKey ) ; $ fields .= sprintf ( $ this -> tab ( 3 ) . "\$table->foreign('%s')->references('%s')->on('%s');" . PHP_EOL . PHP_EOL , $ field -> name , $ foreignKey [ 0 ] , $ foreignKey [ 1 ] ) ; } } $ fields .= PHP_EOL . $ this -> tab ( 3 ) . "\$table->timestamps();" . PHP_EOL ; $ this -> stub = str_replace ( '{{fields}}' , $ fields , $ this -> stub ) ; return $ this ; }
Add fields .
17,988
public function getTaxonomies ( bool $ force = false ) { if ( $ this -> nb_catalog_taxonomy_list -> isEmpty ( ) || $ force ) { $ this -> nb_catalog_taxonomy_list -> clear ( ) ; $ this -> nb_catalog_taxonomy_list -> merge ( CNabuCatalogTaxonomy :: getAllCatalogTaxonomies ( $ this ) ) ; } return $ this -> nb_catalog_taxonomy_list ; }
Gets all taxonomy instances of the Catalog .
17,989
public function getTags ( bool $ force = false ) { if ( $ this -> nb_catalog_tag_list -> isEmpty ( ) || $ force ) { $ this -> nb_catalog_tag_list -> clear ( ) ; $ this -> nb_catalog_tag_list -> merge ( CNabuCatalogTag :: getAllCatalogTags ( $ this ) ) ; } return $ this -> nb_catalog_tag_list ; }
Gets all tag instances of the Catalog .
17,990
private function setTarget ( SimpleXMLElement $ element ) { $ target = $ element -> addChild ( 'target' ) ; switch ( $ this -> nb_data_object -> getUseURI ( ) ) { case 'T' : if ( ( $ nb_site = $ this -> nb_data_object -> getSite ( ) ) instanceof CNabuSite && ( $ nb_site_target = $ nb_site -> getTarget ( $ this -> nb_data_object -> getSiteTargetId ( ) ) ) instanceof CNabuSiteTarget ) { $ target -> addAttribute ( 'useURI' , 'T' ) ; $ target -> addAttribute ( 'target' , $ nb_site_target -> getHash ( ) ) ; } else { error_log ( "Target not exists" ) ; } break ; case 'U' : $ translations = $ this -> nb_data_object -> getTranslations ( ) ; $ urls = array ( ) ; $ translations -> iterate ( function ( $ lang , $ nb_translation ) use ( & $ urls ) { $ urls [ $ lang ] = array ( 'url' => $ nb_translation -> getURL ( ) , 'match' => $ nb_translation -> getMatchURLFragment ( ) ) ; return true ; } ) ; if ( count ( $ urls ) > 0 ) { $ target -> addAttribute ( 'useURI' , 'U' ) ; foreach ( $ urls as $ lang => $ url ) { if ( strlen ( $ url ) > 0 ) { $ nb_language = $ this -> nb_data_object -> getLanguage ( $ lang ) ; $ address = $ target -> addChild ( 'url' ) ; $ address -> addAttribute ( 'lang' , $ nb_language -> getHash ( ) ) ; $ address -> addAttribute ( 'url' , $ url [ 'url' ] ) ; $ address -> addAttribute ( 'match' , $ url [ 'match' ] ) ; } } } break ; default : } }
Set the target branch .
17,991
private function setSecurity ( SimpleXMLElement $ element ) { $ security = $ element -> addChild ( 'security' ) ; $ xml_roles = new CNabuXMLSiteMapRoleList ( $ this -> nb_data_object -> getRoles ( ) ) ; $ xml_roles -> build ( $ security ) ; }
Set the security branch .
17,992
private function setMapChilds ( SimpleXMLElement $ element ) { $ nb_map_list = $ this -> nb_data_object -> getChilds ( ) ; if ( $ nb_map_list -> getSize ( ) > 0 ) { $ xml_childs = new CNabuXMLSiteMapList ( $ nb_map_list ) ; $ xml_childs -> build ( $ element ) ; } }
Set the child maps of this node .
17,993
public static function checkImplement ( $ class , string $ interface ) { $ ref = new \ ReflectionClass ( $ class ) ; $ names = $ ref -> getInterfaceNames ( ) ; if ( in_array ( $ interface , $ names ) ) { return true ; } else { return false ; } }
Check the class implement
17,994
protected static function arrayToXML ( $ data , & $ xml = null ) { if ( $ xml === null ) $ xml = new \ SimpleXMLElement ( "<?xml version=\"1.0\"?><nondb></nondb>" ) ; foreach ( $ data as $ k => $ v ) { if ( is_array ( $ v ) ) { $ sub = $ xml -> addChild ( "$k" ) ; self :: arrayToXML ( $ v , $ sub ) ; } else { $ xml -> addChild ( "$k" , htmlspecialchars ( "$v" ) ) ; } } return $ xml -> asXML ( ) ; }
Turn array to XML
17,995
public static function hydrateCollection ( array $ profiles ) { $ hydrated = [ ] ; foreach ( $ profiles as $ profile ) { $ hydrated [ ] = self :: hydrate ( $ profile ) ; } return $ hydrated ; }
Hydrate a collection of profile objects into a collection of ProfileEntity objects
17,996
public static function hydrate ( stdClass $ profile ) { $ hydrated = new ProfileEntity ( ) ; if ( isset ( $ profile -> id ) ) { $ hydrated -> setId ( $ profile -> id ) ; } if ( isset ( $ profile -> name ) ) { $ hydrated -> setName ( $ profile -> name ) ; } if ( isset ( $ profile -> setting ) ) { $ hydrated -> setSetting ( SettingHydrator :: hydrate ( $ profile -> setting ) ) ; } if ( isset ( $ profile -> controllers ) && is_array ( $ profile -> controllers ) ) { $ hydrated -> setControllers ( ControllerHydrator :: hydrateCollection ( $ profile -> controllers ) ) ; } if ( isset ( $ profile -> sources ) && is_array ( $ profile -> sources ) ) { $ hydrated -> setSources ( SourceHydrator :: hydrateCollection ( $ profile -> sources ) ) ; } if ( isset ( $ profile -> sinks ) && is_array ( $ profile -> sinks ) ) { $ hydrated -> setSinks ( SinkHydrator :: hydrateCollection ( $ profile -> sinks ) ) ; } if ( isset ( $ profile -> validators ) && is_array ( $ profile -> validators ) ) { $ hydrated -> setValidators ( ValidatorHydrator :: hydrateCollection ( $ profile -> validators ) ) ; } if ( isset ( $ profile -> sanitizers ) && is_array ( $ profile -> sanitizers ) ) { $ hydrated -> setSanitizers ( SanitizerHydrator :: hydrateCollection ( $ profile -> sanitizers ) ) ; } if ( isset ( $ profile -> ignored_codes ) && is_array ( $ profile -> ignored_codes ) ) { $ hydrated -> setIgnoredCodes ( IgnoredCodeHydrator :: hydrateCollection ( $ profile -> ignored_codes ) ) ; } if ( isset ( $ profile -> ignored_locations ) && is_array ( $ profile -> ignored_locations ) ) { $ hydrated -> setIgnoredLocations ( IgnoredLocationHydrator :: hydrateCollection ( $ profile -> ignored_locations ) ) ; } if ( isset ( $ profile -> extensions ) && is_array ( $ profile -> extensions ) ) { $ hydrated -> setExtensions ( ExtensionHydrator :: hydrateCollection ( $ profile -> extensions ) ) ; } if ( isset ( $ profile -> application ) ) { $ hydrated -> setApplication ( ApplicationHydrator :: hydrate ( $ profile -> application ) ) ; } if ( isset ( $ profile -> created_by ) ) { $ hydrated -> setCreatedBy ( UserHydrator :: hydrate ( $ profile -> created_by ) ) ; } if ( isset ( $ profile -> default ) ) { $ hydrated -> setDefault ( $ profile -> default ) ; } return $ hydrated ; }
Hydrate a profile object into a ProfileEntity object
17,997
public function equals ( Verb $ verb ) : bool { if ( ! $ this -> id -> equals ( $ verb -> id ) ) { return false ; } if ( null === $ this -> display && null === $ verb -> display ) { return true ; } if ( null !== $ this -> display xor null !== $ verb -> display ) { return false ; } if ( count ( $ this -> display ) !== count ( $ verb -> getDisplay ( ) ) ) { return false ; } foreach ( $ this -> display as $ language => $ value ) { if ( ! isset ( $ verb -> display [ $ language ] ) ) { return false ; } if ( $ value !== $ verb -> display [ $ language ] ) { return false ; } } return true ; }
Checks if another verb is equal .
17,998
public static function hydrateCollection ( array $ javas ) { $ hydrated = [ ] ; foreach ( $ javas as $ java ) { $ hydrated [ ] = self :: hydrate ( $ java ) ; } return $ hydrated ; }
Hydrate a collection of java objects into a collection of JavaEntity objects
17,999
public static function hydrate ( stdClass $ java ) { $ hydrated = new JavaEntity ( ) ; if ( isset ( $ java -> id ) ) { $ hydrated -> setId ( $ java -> id ) ; } if ( isset ( $ java -> major_version ) ) { $ hydrated -> setMajorVersion ( $ java -> major_version ) ; } if ( isset ( $ java -> minor_version ) ) { $ hydrated -> setMinorVersion ( $ java -> minor_version ) ; } if ( isset ( $ java -> release_version ) ) { $ hydrated -> setReleaseVersion ( $ java -> release_version ) ; } if ( isset ( $ java -> implementation ) ) { $ hydrated -> setImplementation ( $ java -> implementation ) ; } if ( isset ( $ java -> setting ) ) { $ hydrated -> setSetting ( SettingHydrator :: hydrate ( $ java -> setting ) ) ; } return $ hydrated ; }
Hydrate a java object into a JavaEntity object