idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
16,700 | public function editAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'EcommerceBundle:Tax' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Tax entity.' ) ; } $ editForm = $ this -> createForm ( new TaxType ( ) , ... | Displays a form to edit an existing Feature entity . |
16,701 | public function deleteAction ( Request $ request , $ id ) { $ form = $ this -> createDeleteForm ( $ id ) ; $ form -> bind ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'EcommerceBundle:Tax' ) -> find ( $ id ) ; if ( ! $ entity ) { ... | Deletes a Family entity . |
16,702 | public function authenticate ( ) { $ this -> _authenticateSetup ( ) ; $ dqlQuery = $ this -> _authenticateCreateSelect ( ) ; $ resultIdentities = $ this -> _authenticateQueryDql ( $ dqlQuery ) ; if ( ( $ authResult = $ this -> _authenticateValidateResultset ( $ resultIdentities ) ) instanceof \ Zend_Auth_Result ) { ret... | Defined by Zend_Auth_Adapter_Interface . This method is called to attempt an authentication . Previous to this call this adapter would have already been configured with all necessary information to successfully connect to a database table and attempt to find a record matching the provided identity . |
16,703 | protected function _authenticateCreateSelect ( ) { if ( $ this -> credentialTreatment === null ) { $ this -> credentialTreatment = '?' ; } $ select = sprintf ( '(CASE WHEN e.%s = %s THEN 1 ELSE 0 END) as zend_auth_credential_match' , $ this -> credentialColumn , str_replace ( '?' , $ this -> getEm ( ) -> getConnection ... | Construct the Doctrine query . |
16,704 | protected function _authenticateQueryDql ( \ Doctrine \ ORM \ Query $ dqlQuery ) { try { $ resultIdentities = $ dqlQuery -> getResult ( ) ; } catch ( \ Exception $ e ) { throw new \ Zend_Auth_Adapter_Exception ( 'The supplied parameters to Extlib\Auth\Adapter\Doctrine2 failed to ' . 'produce a valid sql statement, plea... | Get result identities |
16,705 | public function takeScreenshotAfterFailedStep ( AfterStepScope $ event ) { if ( ! $ event -> getTestResult ( ) -> isPassed ( ) ) { if ( $ this -> getSession ( ) -> getDriver ( ) instanceof Selenium2Driver ) { $ stepLine = $ event -> getStep ( ) -> getLine ( ) ; $ time = time ( ) ; $ fileName = "./step-{$stepLine}-{$tim... | If using the Selenium2Driver will automatically screenshot any failed steps and save them in the current directory . |
16,706 | public function waitForSelectorExistence ( $ cssSelector , $ attempts = 10 , $ waitInterval = 1 ) { $ this -> waitFor ( function ( $ context ) use ( $ cssSelector ) { try { $ context -> assertElementExists ( $ cssSelector ) ; } catch ( ElementNotFoundException $ e ) { return false ; } return true ; } , $ attempts , $ w... | Runs a wait for until an cssSelector exists on the page . This will pass even if the cssSelector is not visible on the page . It only needs to exist in the DOM . |
16,707 | public function waitForSelectorVisibility ( $ cssSelector , $ attempts = 10 , $ waitInterval = 1 ) { $ this -> waitFor ( function ( $ context ) use ( $ cssSelector ) { try { $ context -> assertIsVisible ( $ cssSelector ) ; } catch ( ExpectationException $ e ) { return false ; } return true ; } , $ attempts , $ waitInte... | Passes when the given css selector is visible on the page . |
16,708 | public function waitForAtLeastOneVisibleElementOfType ( $ selectorString ) { $ this -> waitFor ( function ( $ context ) use ( $ selectorString ) { $ page = $ context -> getSession ( ) -> getPage ( ) ; $ nodes = $ page -> findAll ( 'css' , $ selectorString ) ; foreach ( $ nodes as $ node ) { if ( $ node -> isVisible ( )... | Passes when at least one element with the given selector is visible on the page . |
16,709 | public function click ( $ cssSelector ) { $ element = $ this -> getElementByCssSelector ( $ cssSelector ) ; $ this -> assert ( $ element != null , "{$cssSelector} not found on the page" ) ; $ element -> click ( ) ; } | Click the first element matching the given css selector . |
16,710 | public function doubleclick ( $ cssSelector ) { $ element = $ this -> getElementByCssSelector ( $ cssSelector ) ; $ this -> assert ( $ element != null , "{$cssSelector} not found on the page" ) ; $ element -> doubleClick ( ) ; } | Doubleclick the first element matching the given css selector . |
16,711 | public function selectOptionInDropdownByPosition ( $ dropdownSelectorString , $ position ) { $ select = $ this -> getElementByCssSelector ( $ dropdownSelectorString ) ; $ firstOption = $ this -> getElementByCssSelector ( $ dropdownSelectorString . " option:nth-of-type({$position})" ) ; $ select -> selectOption ( $ firs... | Select the first option in a dropdown whatever it may be . |
16,712 | public function clickFirstVisibleElementOfType ( $ selectorString ) { $ page = $ this -> getSession ( ) -> getPage ( ) ; $ nodes = $ page -> findAll ( 'css' , $ selectorString ) ; foreach ( $ nodes as $ node ) { if ( $ node -> isVisible ( ) ) { $ node -> click ( ) ; return ; } } throw new ExpectationException ( "No vis... | Click the first visible element matching the css selector . |
16,713 | public function isVisible ( $ cssSelector ) { $ session = $ this -> getSession ( ) ; $ page = $ session -> getPage ( ) ; $ pageElement = $ page -> find ( 'css' , $ cssSelector ) ; return $ pageElement == null ? false : $ pageElement -> isVisible ( ) ; } | Determine if the specified css selector is visible on the page . |
16,714 | public function assertHtmlContentMatches ( $ selectorString , $ expected ) { $ this -> assertEqual ( trim ( $ this -> getHtmlContent ( $ selectorString ) ) , $ expected ) ; } | Given a selector verifies that its content matches the expected . |
16,715 | public function mapElements ( $ cssSelector , callable $ function ) { $ elements = $ this -> getElementByCssSelector ( $ cssSelector ) ; $ result = array ( ) ; if ( ! empty ( $ elements ) ) { $ result = $ this -> map ( $ elements , $ function ) ; } return $ result ; } | Call a function on all elements matching the given selector . |
16,716 | public function addChoiceSite ( SiteFormEvent $ event ) { $ builder = $ event -> getBuilder ( ) ; $ subGroupRender = $ builder -> getAttribute ( 'sub_group_render' ) ; $ subGroupRender = array_merge ( $ subGroupRender , array ( 'media' => array ( 'rank' => 2 , 'label' => 'open_orchestra_media_admin.form.site.sub_group.... | add choice site to site form |
16,717 | public function createDatabase ( $ name , $ charSet = null ) { if ( $ charSet === null ) { $ charSet = self :: DEFAULT_CHARACTER_SET ; } $ stmt = StringUtils :: format ( self :: CREATE_DB_STMT , [ 'name' => $ name , 'charSet' => $ charSet ] ) ; $ this -> db -> exec ( $ stmt ) ; } | Create a database with the give name . For now character set is ignored . |
16,718 | private static function _load ( $ flat ) { if ( is_array ( $ flat ) && ! is_array ( $ _SESSION [ 'ACL_INFO' ] ) && count ( $ flat ) > 0 ) { $ _SESSION [ 'ACL_INFO' ] = array ( ) ; } ; foreach ( $ flat as $ row ) { if ( ! array_key_exists ( $ row [ 'action' ] , $ _SESSION [ 'ACL_INFO' ] ) ) { $ _SESSION [ 'ACL_INFO' ] [... | Load a block of ACL rules to in - memory tree |
16,719 | public static function reload ( ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ _SESSION [ 'ACL_INFO' ] = null ; if ( ! array_key_exists ( 'id' , $ _SESSION [ 'user' ] ) ) { return ; } ; $ userId = $ _SESSION [ 'user' ] [ 'id' ] ; $ flat = $ db -> selectArray ( " SELECT action, objectType, objectId ... | Re - create in - memory rights tree based on session s current user |
16,720 | public static function hasRole ( $ role ) { if ( ! isset ( $ _SESSION [ 'user' ] ) ) { return false ; } ; if ( ! isset ( $ _SESSION [ 'ACL_ROLES' ] ) ) { return false ; } ; return in_array ( $ role , $ _SESSION [ 'ACL_ROLES' ] ) ; } | Tests whether current user is a member of specified role |
16,721 | public static function can ( $ action , $ objectType = null , $ objectId = null ) { if ( ! isset ( $ _SESSION [ 'ACL_INFO' ] ) ) { return false ; } ; $ acl = $ _SESSION [ 'ACL_INFO' ] ; foreach ( array ( '*' , $ action ) as $ act ) { if ( array_key_exists ( $ act , $ acl ) ) { $ acl2 = $ acl [ $ act ] ; foreach ( array... | Test whether current user is allowed an action |
16,722 | public static function sqlCondition ( $ columnName , $ action , $ objectType = null ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ sqlTRUE = '(1=1)' ; $ sqlFALSE = '(1=2)' ; if ( ! isset ( $ _SESSION [ 'ACL_INFO' ] ) ) { return $ db -> query ( $ sqlFALSE ) ; } ; $ acl = $ _SESSION [ 'ACL_INFO' ] ; $ granted = array ( )... | Get SQL condition for matching objectIds user has right to |
16,723 | public static function grant ( $ userId = null , $ role = null , $ action = null , $ objectType = '*' , $ objectId = 0 ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ success = false ; if ( $ objectId === '' ) { $ objectId = 0 ; } ; if ( $ userId !== null && $ role !== null ) { $ success = $ db -> insert ( 'users_roles'... | Grant new right or role membership |
16,724 | public static function revoke ( $ userId = null , $ role = null , $ action = null , $ objectType = '*' , $ objectId = 0 ) { global $ PPHP ; $ success = $ db = $ PPHP [ 'db' ] ; if ( $ objectId === '' ) { $ objectId = 0 ; } ; if ( $ userId !== null && $ role !== null ) { $ success = $ db -> exec ( " DELET... | Revoke existing right or role membership |
16,725 | public static function getRoles ( $ userId ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ roles = $ db -> selectList ( "SELECT role FROM users_roles WHERE userId=? ORDER BY role ASC" , array ( $ userId ) ) ; return $ roles !== false ? $ roles : array ( ) ; } | Get roles for a user |
16,726 | public static function getRoleACL ( $ role ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ flat = $ db -> selectArray ( " SELECT action, objectType, objectId FROM acl_roles WHERE role=? " , array ( $ role ) ) ; return is_array ( $ flat ) ? $ flat : array ( ) ; } | Get permissions associated with a role |
16,727 | public static function getUserACL ( $ userId ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ flat = $ db -> selectArray ( " SELECT action, objectType, objectId FROM acl_users WHERE userId=? " , array ( $ userId ) ) ; return is_array ( $ flat ) ? $ flat : array ( ) ; } | Get permissions associated with a user |
16,728 | public static function getRoleUsers ( $ role ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ out = $ db -> selectList ( " SELECT userId FROM users_roles WHERE role=? ORDER BY userId ASC " , array ( $ role ) ) ; return ( is_array ( $ out ) ? $ out : array ( ) ) ; } | List users which have a given role |
16,729 | public static function getObjectUsers ( $ action , $ objectType , $ objectId ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ out = $ db -> selectList ( " SELECT userId FROM acl_users WHERE action=? AND objectType=? AND objectId=? ORDER BY userId ASC " , array ( $ action , $ ob... | List users which have a specific right |
16,730 | public static function banUser ( $ id ) { global $ PPHP ; $ db = $ PPHP [ 'db' ] ; $ db -> exec ( "DELETE FROM acl_users WHERE userId=?" , array ( $ id ) ) ; $ db -> exec ( "DELETE FROM users_roles WHERE userId=?" , array ( $ id ) ) ; return true ; } | When a user is banned remove it from all ACL tables |
16,731 | public static function resolveParams ( Container $ container , $ params ) { $ resolvedParams = array ( ) ; foreach ( $ params as $ key => $ param ) { $ resolvedParam = null ; if ( is_array ( $ param ) ) { $ resolvedParam = self :: resolveParams ( $ container , $ param ) ; } else if ( is_string ( $ param ) ) { $ resolve... | Resolve the params of an array |
16,732 | function destroy ( ) { foreach ( $ this as $ k => $ v ) $ this -> _setCookieParam ( $ k , null , - 2628000 ) ; parent :: destroy ( ) ; } | Destroy Current Realm Data Source |
16,733 | protected function _assertCookieRestriction ( ) { $ stat = false ; if ( php_sapi_name ( ) !== 'cli' ) { if ( headers_sent ( ) ) throw new \ Exception ( 'Headers was sent, cookies must be sent before any output from your script.' ) ; $ stat = true ; } if ( false === $ stat ) throw new \ Exception ( 'Session Cant Be Init... | Check Cookie Protocol Restriction |
16,734 | public function doActivity ( ) { $ context = [ 'activityArn' => $ this -> arn , 'workerName' => $ this -> name ] ; $ this -> cpeLogger -> logOut ( "INFO" , basename ( __FILE__ ) , "Starting '$this->name' activity tasks polling" ) ; do { try { if ( $ this -> debug ) $ this -> cpeLogger -> logOut ( "DEBUG" , basename ( _... | This must be called fro your activity to start listening for task Perform Sfn long polling and call user callback function when receiving new activity |
16,735 | private function doInputValidation ( $ input ) { if ( ! ( $ this -> input = json_decode ( $ input ) ) ) throw new \ SA \ CpeSdk \ CpeException ( "JSON input is invalid!" , self :: INPUT_INVALID ) ; } | Perform JSON input validation Decode JSON to Associative array |
16,736 | public function activityFail ( $ error = "" , $ cause = "" ) { $ context = [ 'error' => $ error , 'cause' => $ cause , 'taskToken' => $ this -> token ] ; try { $ this -> cpeLogger -> logOut ( "ERROR" , basename ( __FILE__ ) , "\033[1m[$error]\033[0m $cause" , $ this -> logKey ) ; $ this -> cpeSfnHandler -> sfn -> sendT... | Activity failed Called by parent Activity when something went wrong Notifies Sfn that the activity has failed |
16,737 | public function activitySuccess ( $ output = '{}' ) { $ context = [ 'output' => $ output , 'taskToken' => $ this -> token ] ; try { $ this -> cpeLogger -> logOut ( "INFO" , basename ( __FILE__ ) , "\033[1mNotify Sfn that activity has completed!\033[0m" , $ this -> logKey ) ; $ this -> cpeSfnHandler -> sfn -> sendTaskSu... | Activity Success and completed Notifies Sfn that the activity has succeeded Call this from your activity logic once the process is successful . If return false then the call to Sfn sndTaskSuccess failed Try again or throw an exception to mark the Activity as failed |
16,738 | public function activityHeartbeat ( $ data = null ) { $ context = [ 'taskToken' => $ this -> token ] ; try { $ this -> cpeLogger -> logOut ( "INFO" , basename ( __FILE__ ) , "\033[1mSending heartbeat to Sfn ...\033[0m" , $ this -> logKey ) ; $ this -> cpeSfnHandler -> sfn -> sendTaskHeartbeat ( $ context ) ; if ( $ thi... | Send heartbeat to Sfn to keep the task alive . Call this from your activity logic . If return false then the heartbeat was not sent Try again or throw an exception to mark the Activity as failed |
16,739 | public function has_shipping ( $ order ) { $ virtual = true ; foreach ( $ this -> get_all_products_in ( $ order ) as $ product ) { if ( ! $ product -> is_virtual ( ) ) { $ virtual = false ; break ; } } return ! $ virtual ; } | Detect if order has shipping product |
16,740 | public function get_all_products_in ( $ order ) { $ order = wc_get_order ( $ order ) ; if ( ! $ order ) { return [ ] ; } $ products = [ ] ; foreach ( $ order -> get_items ( ) as $ item ) { $ products [ ] = $ order -> get_product_from_item ( $ item ) ; } return $ products ; } | Get all product in order |
16,741 | public function card_icons ( ) { $ icons = [ ] ; $ base_url = WC ( ) -> plugin_url ( ) . '/assets/images/icons/credit-cards/' ; $ base_dir = WC ( ) -> plugin_path ( ) . '/assets/images/icons/credit-cards/' ; if ( is_dir ( $ base_dir ) ) { foreach ( scandir ( $ base_dir ) as $ icon ) { if ( preg_match ( '#(.*)\.svg$#' ,... | Get card icon URL . |
16,742 | public function card_css ( $ selector = '.wc-credit-card-form-card-number' ) { $ css = <<<CSS{$selector}{ background-repeat: no-repeat; background-position: right .6180469716em center; background-size: 31px 20px;}CSS ; foreach ( $ this -> card_icons ( ) as $ icon => $ url ) { $ css .= <<<CSS{$selector}.{$ico... | Get style sheet for card input . |
16,743 | public function getFilePath ( $ filename ) { if ( ! strpos ( $ filename , '.' ) ) { $ filename .= ".phtml" ; } foreach ( $ this -> config -> getPaths ( ) as $ path ) { $ file = "$path/$filename" ; if ( file_exists ( $ file ) ) { return $ file ; } } throw new FileNotFoundException ( 'File \'' . $ filename . '\' was not ... | Returns the path for the given filename . |
16,744 | public function setData ( array $ data ) { foreach ( $ this -> getData ( ) -> toArray ( ) as $ key => $ value ) { $ this -> getData ( ) -> offsetUnset ( $ key ) ; } $ this -> addData ( $ data ) ; return $ this ; } | Sets the renderer data |
16,745 | public function Build ( ) { $ left_menu_output = "<ul class=\"content_left nav-sidebar\">" ; $ main_menus = $ this -> _LoadXml ( ) ; $ left_menu_output .= $ this -> ProcessMainMenus ( $ main_menus ) ; $ left_menu_output .= "</ul>" ; return $ left_menu_output ; } | Returns a string representing the left menu |
16,746 | private function _LoadXml ( ) { $ xml = new \ DOMDocument ; $ filename = "APP_ROOT_DIR" . \ Puzzlout \ Framework \ Enums \ ApplicationFolderName :: AppsFolderName . $ this -> app -> name ( ) . '/Config/menus.xml' ; if ( file_exists ( $ filename ) ) { $ xml -> load ( $ filename ) ; } else { throw new \ Exception ( "In "... | Load the left menu from xml and returns the data to process The list of DOMElementNode is the list of main menus to display |
16,747 | public function isFirstnameSurname ( $ firstName , $ surname ) { $ result = $ this -> model -> where ( 'first_name' , $ firstName ) -> where ( 'surname' , $ surname ) -> first ( ) ; if ( $ result ) { return $ result -> id ; } return false ; } | Does a record exist with the given first_name and surname ? |
16,748 | public function createNewRecord ( $ data ) { $ people = new $ this -> model ; $ people [ 'user_id' ] = $ data [ 'user_id' ] ; $ people [ 'title' ] = $ data [ 'title' ] ; $ people [ 'salutation' ] = $ data [ 'salutation' ] ; $ people [ 'first_name' ] = $ data [ 'first_name' ] ; $ people [ 'middle_name' ] = $ data [ 'mid... | INSERT INTO peoples |
16,749 | public function loadClass ( $ className ) { foreach ( $ this -> definitions as $ def ) { $ nameSpace = $ def -> getNameSpace ( ) ; $ path = $ def -> getPath ( ) ; $ name = $ className ; if ( $ nameSpace ) { $ ns = rtrim ( $ nameSpace , '\\' ) . '\\' ; $ nameLen = strlen ( $ className ) ; $ nsLen = strlen ( $ ns ) ; if ... | Loads a class based on its class name . |
16,750 | public static function findTemplate ( \ Twig_Loader_Filesystem $ filesystem , $ name ) { $ name = self :: normalizeName ( $ name ) ; self :: validateName ( $ name ) ; list ( $ namespace , $ shortname ) = self :: parseName ( $ name ) ; $ paths = $ filesystem -> getPaths ( $ namespace ) ; if ( empty ( $ paths ) ) { throw... | Determine the path of a template based on its name |
16,751 | public function create ( \ SplFileInfo $ file ) { $ extension = $ file -> getExtension ( ) ; switch ( $ extension ) { case 'css' : return new StylesheetDocument ( ) ; case 'js' : return new JavascriptDocument ( ) ; default : if ( strstr ( $ this -> getMimeType ( $ file ) , 'image' ) ) { return new ImageDocument ( ) ; }... | Returns a new instance of the Document that matches the type of the file passed in |
16,752 | public function getMimeType ( \ SplFileInfo $ file ) { $ fileInfo = finfo_open ( FILEINFO_MIME_TYPE ) ; $ mimeType = finfo_file ( $ fileInfo , $ file -> getPathname ( ) ) ; finfo_close ( $ fileInfo ) ; return $ mimeType ; } | Returns the mime - type of the given file |
16,753 | public static function to ( $ type , $ value , $ argNum = 0 , $ pseudoTypes = [ ] ) { try { return lib \ Type :: to ( $ type , $ value , $ pseudoTypes ) ; } catch ( \ LogicException $ exception ) { $ callerInfomation = self :: getCallerInfomation ( ) ; $ errorMessage = $ callerInfomation [ 'function' ] === '__set' ? sp... | Converts a given value in accordance with a given IDL type . |
16,754 | public function requestLine ( ) { $ uri = $ this -> url -> path ( ) ; if ( $ this -> url -> query ( ) ) { $ uri .= '?' . $ this -> url -> query ( ) ; } return sprintf ( '%s %s HTTP/%s' , $ this -> method , $ uri , $ this -> version ) ; } | Get request line |
16,755 | public function key ( $ key = '' , $ is_option = false ) { return $ this -> get_key ( $ this -> validate_length ( $ key ) , $ is_option ) ; } | Returns a Unique Key . |
16,756 | public function get_key ( $ key = '' , $ is_option = false ) { if ( true === $ is_option ) { return $ this -> option_prefix . $ key . $ this -> option_surfix ; } return $ this -> transient_prefix . $ key . $ this -> transient_surfix ; } | Returns Key Based on Requirement . |
16,757 | protected function validate_length ( $ key = '' ) { if ( $ this -> check_length ( $ key ) === false ) { return $ this -> validate_length ( md5 ( $ key ) ) ; } return $ key ; } | Validates Key Length if key lenght exceeds it will md5 or returns the orginal key |
16,758 | protected function validate_version ( $ value , $ type = '' ) { if ( false === $ value || empty ( $ value ) || is_null ( $ value ) ) { return false ; } if ( 'option' === $ type ) { return version_compare ( $ this -> option_version , $ value , '=' ) ; } return version_compare ( $ this -> transient_version , $ value , '=... | Validates If Saved Version is same as in the class version . |
16,759 | protected function delete_version_issue ( $ key , $ type = '' ) { if ( true === $ this -> option_auto_delete && 'option' === $ type ) { $ this -> delete_option ( $ key ) ; } if ( true === $ this -> transient_auto_delete ) { return $ this -> delete_transient ( $ key ) ; } return false ; } | Deletes if cache has any issues . |
16,760 | public function getAttribute ( $ name ) { $ result = null ; if ( $ this -> attributeExists ( $ name ) ) { $ result = $ this -> attributes [ $ name ] ; } return $ result ; } | Get attribute by name |
16,761 | public function getDirtyAttribute ( $ name ) { $ result = null ; if ( $ this -> dirtyAttributeExists ( $ name ) ) { $ result = $ this -> dirtyAttributes [ $ name ] ; } return $ result ; } | Get dirty attribute |
16,762 | public function propertyExists ( $ name ) { $ properties = $ this -> getProperties ( ) ; return empty ( $ properties ) || in_array ( $ name , $ properties ) ; } | Check property exists |
16,763 | public function merge ( ValidationException $ object , $ hasMany = false ) { $ alias = $ object -> alias ( ) ; $ this -> _objects [ $ alias ] [ '_hasMany' ] = ( false !== $ hasMany ) ; if ( true === $ hasMany ) { $ this -> _objects [ $ alias ] [ ] = $ object -> objects ( ) ; } elseif ( $ hasMany ) { $ this -> _objects ... | Merges an ValidationException object into the current exception Useful when you want to combine errors into one array |
16,764 | protected function generateErrors ( $ alias , array $ array , $ directory , $ translate ) { $ errors = [ ] ; foreach ( $ array as $ key => $ object ) { if ( is_array ( $ object ) ) { $ errors [ $ key ] = ( $ key === '_external' ) ? $ this -> generateErrors ( $ alias . '/' . $ key , $ object , $ directory , $ translate ... | Recursive method to fetch all the errors in this exception |
16,765 | public function set ( $ variable , $ value = '' , $ export = false ) { $ line = $ this -> composeLine ( $ variable , $ value , $ export ) ; $ number = $ this -> has ( $ variable ) ? $ this -> line_numbers [ $ variable ] : null ; $ this -> writeLine ( $ line , $ number ) ; $ this -> load ( ) ; return $ line ; } | Set an environment variable to a value . |
16,766 | protected function writeLine ( $ line , $ number = null ) { $ this -> ensureFileIsWritable ( ) ; if ( is_null ( $ number ) ) { return file_put_contents ( $ this -> filePath , $ line . PHP_EOL , FILE_APPEND ) ; } $ lines = $ this -> readLinesFromFile ( $ this -> filePath ) ; $ lines [ $ number ] = $ line ; return file_p... | Write a line to the dotenv file . |
16,767 | protected function ensureFileIsWritable ( ) { if ( ( ! is_writable ( $ this -> filePath ) || ! is_file ( $ this -> filePath ) ) && ( ! is_dir ( dirname ( $ this -> filePath ) ) || ! is_writable ( dirname ( $ this -> filePath ) ) ) ) { throw new InvalidPathException ( sprintf ( 'Unable to write the environment file at %... | Ensures the given filePath is writable . |
16,768 | protected function composeLine ( $ name , $ value , $ export = false ) { return sprintf ( '%s%s="%s"' , ( $ export ? 'export ' : '' ) , $ name , addcslashes ( $ value , '"\\' ) ) ; } | Compose the dotenv line from given input |
16,769 | public function Comment ( $ CommentID , $ Verify = TRUE , $ AutoParent = TRUE ) { $ Regarding = $ this -> Regarding ( 'Comment' , $ CommentID , $ Verify ) ; if ( $ Verify && $ AutoParent ) $ Regarding -> AutoParent ( 'discussion' ) ; return $ Regarding ; } | Start a RegardingEntity for a comment |
16,770 | public function Message ( $ MessageID , $ Verify = TRUE , $ AutoParent = TRUE ) { $ Regarding = $ this -> Regarding ( 'ConversationMessage' , $ MessageID , $ Verify ) ; if ( $ Verify && $ AutoParent ) $ Regarding -> AutoParent ( 'conversation' ) ; return $ Regarding ; } | Start a RegardingEntity for a conversation message |
16,771 | public function That ( ) { $ Args = func_get_args ( ) ; $ ThingType = array_shift ( $ Args ) ; return call_user_func_array ( array ( $ this , $ ThingType ) , $ Args ) ; } | Transparent forwarder to built - in starter methods |
16,772 | public function queryHandler ( ) { $ materialIds = array ( ) ; $ matIdQuery = dbQuery ( NavigationMaterial :: class ) ; if ( ! empty ( $ this -> nav ) ) { $ childStructures = array ( $ this -> nav -> id ) ; $ stepChildren = array ( $ this -> nav -> id ) ; while ( dbQuery ( 'structure_relation' ) -> cond ( 'parent_id' ,... | Function to add query conditions |
16,773 | public function setPagerPrefix ( ) { return 'samsoncms_input_material_application/table/' . ( isset ( $ this -> nav ) ? $ this -> nav -> id : '0' ) . '/' . ( isset ( $ this -> search { 0 } ) ? $ this -> search : '0' ) . '/' ; } | Function to form pager prefix |
16,774 | public function row ( & $ material , \ samson \ pager \ Pager & $ pager = null , $ module = null ) { m ( ) -> view ( $ this -> row_tmpl ) ; return m ( ) -> set ( $ material , 'material' ) -> set ( 'pager' , $ this -> pager ) -> set ( 'structureId' , isset ( $ this -> nav ) ? $ this -> nav -> id : '0' ) -> output ( ) ; ... | Function to render rows of the table |
16,775 | protected function initialize ( ) { $ this -> log ( 'initialisatie' , LOG_DEBUG ) ; $ remote_host = is_array ( $ this -> remote_host ) ? $ this -> remote_host [ 0 ] : $ this -> remote_host ; $ this -> timestamp = time ( ) ; $ this -> remote_target_dir = strtr ( $ this -> remote_dir_format , array ( '%project_name%' => ... | Determines the timestamp of the new deployment and those of the latest two |
16,776 | protected function check ( $ action ) { $ this -> log ( 'check' , LOG_DEBUG ) ; if ( is_array ( $ this -> remote_host ) ) { foreach ( $ this -> remote_host as $ key => $ remote_host ) { if ( $ key == 0 ) continue ; $ this -> prepareRemoteDirectory ( $ remote_host , $ this -> remote_dir ) ; } } if ( $ action == 'update'... | Run a dry - run to the remote server to show the changes to be made |
16,777 | public function rollback ( ) { $ this -> log ( 'rollback' , LOG_DEBUG ) ; if ( ! $ this -> previous_remote_target_dir ) { $ this -> log ( 'Rollback impossible, no previous deployment found !' ) ; return ; } if ( ! $ this -> check ( 'rollback' ) ) return ; if ( is_array ( $ this -> remote_host ) ) { foreach ( $ this -> ... | Draait de laatste deployment terug |
16,778 | public function cleanup ( ) { $ this -> log ( 'cleanup' , LOG_DEBUG ) ; $ past_deployments = array ( ) ; if ( is_array ( $ this -> remote_host ) ) { foreach ( $ this -> remote_host as $ remote_host ) { if ( $ past_dirs = $ this -> collectPastDeployments ( $ remote_host , $ this -> remote_dir ) ) { $ past_deployments [ ... | Deletes obsolete deployment directories |
16,779 | protected function updateFiles ( $ remote_host , $ remote_dir , $ target_dir ) { $ this -> log ( 'updateFiles' , LOG_DEBUG ) ; $ this -> rsyncExec ( $ this -> rsync_path . ' --rsh="ssh -p ' . $ this -> remote_port . '" -azcO --force --delete --progress ' . $ this -> prepareExcludes ( ) . ' ' . $ this -> prepareLinkDest... | Uploads files to the new directory on the remote server |
16,780 | protected function fixDatadirSymlinks ( $ remote_host , $ remote_dir , $ target_dir ) { $ this -> log ( 'fixDatadirSymlinks' , LOG_DEBUG ) ; if ( empty ( $ this -> data_dirs ) ) return ; $ this -> log ( 'Creating data dir symlinks:' , LOG_DEBUG ) ; $ cmd = "cd $remote_dir/{$target_dir}; php {$this->datadir_patcher} --d... | Executes the datadir patcher to create symlinks to the data dirs . |
16,781 | protected function restartGearmanWorkers ( $ remote_host , $ remote_dir , $ target_dir ) { $ this -> log ( "restartGearmanWorkers($remote_host, $remote_dir, $target_dir)" , LOG_DEBUG ) ; if ( ! isset ( $ this -> gearman [ 'workers' ] ) || empty ( $ this -> gearman [ 'workers' ] ) ) return ; $ cmd = "cd $remote_dir/{$ta... | Gearman workers herstarten |
16,782 | protected function rollbackFiles ( $ remote_host , $ remote_dir , $ target_dir ) { $ this -> log ( 'rollbackFiles' , LOG_DEBUG ) ; $ output = array ( ) ; $ return = null ; $ this -> sshExec ( $ remote_host , 'cd ' . $ remote_dir . '; rm -rf ' . $ target_dir , $ output , $ return ) ; } | Verwijdert de laatst geuploadde directory |
16,783 | protected function listFilesToRename ( $ remote_host , $ remote_dir ) { if ( ! isset ( $ this -> files_to_rename [ "$remote_host-$remote_dir" ] ) ) { $ target_files_to_move = array ( ) ; if ( ! empty ( $ this -> target_specific_files ) ) { foreach ( $ this -> target_specific_files as $ filepath ) { $ ext = pathinfo ( $... | Maakt een lijst van de files die specifiek zijn voor een clusterrol of doel en op de doelserver hernoemd moeten worden |
16,784 | protected function prepareExcludes ( ) { $ this -> log ( 'prepareExcludes' , LOG_DEBUG ) ; chdir ( $ this -> basedir ) ; $ exclude_param = '' ; if ( count ( $ this -> rsync_excludes ) > 0 ) { foreach ( $ this -> rsync_excludes as $ exclude ) { if ( ! file_exists ( $ exclude ) ) { throw new DeployException ( 'Rsync excl... | Zet het array van rsync excludes om in een lijst rsync parameters |
16,785 | protected function prepareRemoteDirectory ( $ remote_host , $ remote_dir ) { $ this -> log ( 'Initialize remote directory: ' . $ remote_host . ':' . $ remote_dir , LOG_INFO , true ) ; $ output = array ( ) ; $ return = null ; $ this -> sshExec ( $ remote_host , "mkdir -p $remote_dir" , $ output , $ return , '' , '' , LO... | Initializes the remote project and data directories . |
16,786 | protected function findPastDeploymentTimestamps ( $ remote_host , $ remote_dir ) { $ this -> log ( 'findPastDeploymentTimestamps' , LOG_DEBUG ) ; $ this -> prepareRemoteDirectory ( $ remote_host , $ remote_dir ) ; if ( $ remote_dir === null ) $ remote_dir = $ this -> remote_dir ; $ dirs = array ( ) ; $ return = null ; ... | Returns the timestamps of the second latest and latest deployments |
16,787 | protected function collectPastDeployments ( $ remote_host , $ remote_dir ) { $ this -> log ( 'collectPastDeployments' , LOG_DEBUG ) ; $ dirs = array ( ) ; $ return = null ; $ this -> sshExec ( $ remote_host , "ls -1 $remote_dir" , $ dirs , $ return ) ; if ( $ return !== 0 ) { throw new DeployException ( 'ssh initialize... | Returns all obsolete deployments that can be deleted . |
16,788 | protected function deletePastDeployments ( $ past_deployments ) { foreach ( $ past_deployments as $ past_deployment ) { $ this -> rollbackFiles ( $ past_deployment [ 'remote_host' ] , $ past_deployment [ 'remote_dir' ] , implode ( ' ' , $ past_deployment [ 'dirs' ] ) ) ; } } | Deletes obsolete deployments as collected by collectPastDeployments |
16,789 | protected function sshExec ( $ remote_host , $ command , & $ output , & $ return , $ hide_pattern = '' , $ hide_replacement = '' , $ ouput_loglevel = LOG_INFO ) { $ cmd = $ this -> ssh_path . ' -p ' . $ this -> remote_port . ' ' . $ this -> remote_user . '@' . $ remote_host . ' "' . str_replace ( '"' , '\"' , $ command... | Wrapper for SSH command s |
16,790 | protected function rsyncExec ( $ command , $ error_msg = 'Rsync has failed' ) { $ this -> log ( 'execRSync: ' . $ command , LOG_DEBUG ) ; chdir ( $ this -> basedir ) ; passthru ( $ command , $ return ) ; $ this -> log ( '' ) ; if ( $ return !== 0 ) { throw new DeployException ( $ error_msg ) ; } } | Wrapper for rsync command s |
16,791 | static protected function inputPrompt ( $ message , $ default = '' , $ isPassword = false ) { fwrite ( STDOUT , $ message ) ; if ( ! $ isPassword ) { $ input = trim ( fgets ( STDIN ) ) ; } else { $ input = self :: getPassword ( false ) ; echo PHP_EOL ; } if ( $ input == '' ) $ input = $ default ; return $ input ; } | Asks the user for input |
16,792 | public function create ( $ model = null , $ options = [ ] ) { $ defaults = [ 'inputDefaults' => [ 'div' => [ 'class' => 'form-group' , ] , 'label' => [ 'class' => 'control-label' , ] , 'class' => 'form-control' , 'error' => [ 'attributes' => [ 'wrap' => 'p' , 'class' => 'text-danger' , ] , ] , ] , 'class' => null , 'ro... | Starts a new form with input defaults . |
16,793 | public function btnReset ( $ title = '' , $ options = [ ] ) { $ title = empty ( $ title ) ? __ ( 'Reset' ) : $ title ; $ options = array_merge ( [ 'class' => 'btn btn-success' , 'type' => 'reset' , ] , $ options ) ; return parent :: button ( $ title , $ options ) ; } | Creates a reset button for a form |
16,794 | public function btnSubmit ( $ title = '' , $ options = [ ] ) { $ title = empty ( $ title ) ? __ ( 'Submit' ) : $ title ; $ options = array_merge ( [ 'class' => 'btn btn-success' , 'type' => 'submit' , ] , $ options ) ; return parent :: button ( $ title , $ options ) ; } | Creates a submit button for a form |
16,795 | public function btnCancel ( $ title = '' , $ options = [ ] ) { $ title = empty ( $ title ) ? __ ( 'Cancel' ) : $ title ; $ options = array_merge ( [ 'class' => 'btn btn-danger' , 'type' => 'reset' , 'data-dismiss' => 'modal' , ] , $ options ) ; return parent :: button ( $ title , $ options ) ; } | Creates a cancel button . Used to dismiss modals |
16,796 | public function end ( $ options = null , $ secureAttributes = [ ] ) { if ( ! empty ( $ options ) ) { if ( ! is_array ( $ options ) ) { $ options = [ 'label' => $ options ] ; } $ defaults = [ 'class' => 'btn btn-success' , ] ; $ options = array_merge ( $ defaults , $ options ) ; } return parent :: end ( $ options , $ se... | Add divs and classes necessary for bootstrap to end form . |
16,797 | protected function handleCharacter47 ( ) { if ( $ this -> inQuotes || $ this -> inSingleQuotes || $ this -> inCondition ) return true ; return parent :: handleCharacter47 ( ) ; } | Handle javascript matches |
16,798 | protected function handleCharacter32 ( ) { $ this -> lastSpace = $ this -> currentIndex ; if ( ! empty ( $ this -> keywordHashMap [ $ this -> buildingWord ] ) ) { return true ; } if ( ( chr ( $ this -> nextCharacter ) . $ this -> input [ $ this -> currentIndex + 2 ] ) == 'in' ) { return true ; } if ( $ this -> inCondit... | Handle un - quoted spaces |
16,799 | public function load ( Repo $ repo ) { $ scrutinizerRepo = $ this -> client -> fetchRepository ( new Repository ( $ repo -> getSlug ( ) , $ repo -> getType ( ) ) ) ; if ( $ scrutinizerRepo ) { $ repo -> setMetrics ( $ scrutinizerRepo -> getMetrics ( ) ) ; $ repo -> setPdependMetrics ( $ scrutinizerRepo -> getPdependMet... | Load scruinitzer infos for repository |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.