idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
12,100 | public function iShouldGet ( PyStringNode $ string ) { if ( $ this -> getOutput ( ) != trim ( $ string -> getRaw ( ) ) ) { throw new \ Exception ( "Actual output is:\n" . $ this -> getOutput ( ) ) ; } } | Verifies whether the output of an iRun When is equal to the given . |
12,101 | public function theExitCodeShouldBeZero ( ) { if ( $ this -> getReturnCode ( ) != 0 ) { throw new \ Exception ( 'Return code was ' . $ this -> getReturnCode ( ) . ' with output ' . $ this -> getOutput ( ) . $ this -> process -> getOutput ( ) ) ; } } | Verifies whether the return code was 0 and thus execution was a success . |
12,102 | protected function get_required ( \ WP_Post $ post = null ) { if ( current_user_can ( 'edit_posts' ) ) { $ url = admin_url ( 'post-new.php?post_type=' . $ this -> post_type ) ; $ post_type_obj = get_post_type_object ( $ this -> post_type ) ; $ tip = esc_html ( sprintf ( $ this -> __ ( 'Add new %s' ) , $ post_type_obj -... | Add button before requried |
12,103 | protected function get_prepopulates ( $ data ) { $ json = [ ] ; foreach ( $ data as $ post ) { $ json [ ] = [ 'id' => $ post -> ID , 'name' => $ post -> post_title , ] ; } return $ json ; } | Get prepopulated data |
12,104 | function mime ( $ file ) { if ( preg_match ( '/\w+$/' , $ file , $ ext ) ) { $ map = array ( 'au' => 'audio/basic' , 'avi' => 'video/avi' , 'bmp' => 'image/bmp' , 'bz2' => 'application/x-bzip2' , 'css' => 'text/css' , 'dtd' => 'application/xml-dtd' , 'doc' => 'application/msword' , 'gif' => 'image/gif' , 'gz' => 'appli... | Detect MIME type using file extension |
12,105 | public function actionIndex ( ) { $ searchModel = new MessageSearch ; $ dataProvider = $ searchModel -> search ( Yii :: $ app -> request -> getQueryParams ( ) ) ; return $ this -> render ( 'index' , compact ( 'dataProvider' , 'searchModel' ) ) ; } | Lists all Message models . |
12,106 | public function actionFastUpdate ( $ id ) { Message :: updateAll ( [ 'translation' => Yii :: $ app -> request -> post ( 'translation' ) ] , [ 'id' => $ id , 'language' => Yii :: $ app -> request -> post ( 'language' ) ] ) ; } | Fast translation update . |
12,107 | protected function findModel ( $ id ) { if ( ( $ model = Product :: findOne ( $ id ) ) !== null ) { return $ model ; } else { throw new NotFoundHttpException ( t ( 'app' , 'The requested page does not exist.' ) ) ; } } | Finds the Product model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . |
12,108 | protected function requestXml ( $ origin , $ path ) { $ xml = simplexml_load_string ( $ this -> requestContent ( $ origin , $ path ) , "SimpleXMLElement" , LIBXML_NOERROR ) ; if ( false == $ xml ) { $ url = rtrim ( $ origin , '/' ) . '/' . ltrim ( $ path , '/' ) ; throw new \ UnexpectedValueException ( sprintf ( 'The P... | Read xml content from remote filesystem |
12,109 | public function checkVars ( ) { $ http = eZHTTPTool :: instance ( ) ; $ user = eZUser :: currentUser ( ) ; $ isAnon = $ user -> isAnonymous ( ) ; $ status = true ; foreach ( $ this -> fields as $ field => $ fieldSetup ) { $ fieldPostName = $ fieldSetup [ self :: VARNAME ] ; $ this -> setFieldValue ( $ field , $ fieldPo... | check variable from client |
12,110 | public function fillObject ( $ comment , $ fieldNames = null ) { $ filledFields = $ this -> fields ; if ( ! is_null ( $ fieldNames ) && is_array ( $ fieldNames ) ) { $ filledFields = array ( ) ; foreach ( $ fieldNames as $ fieldName ) { $ filledFields [ $ fieldName ] = $ this -> fields [ $ fieldName ] ; } } foreach ( $... | Fill field to comment object |
12,111 | public function addListenerForEvent ( $ eventClassName , $ listener ) { if ( FALSE === array_key_exists ( $ eventClassName , $ this -> eventMap ) ) { $ this -> eventMap [ $ eventClassName ] = [ ] ; } $ this -> eventMap [ $ eventClassName ] [ ] = $ listener ; } | Adds a new listener for an event . |
12,112 | public function getListenersForEvent ( $ eventClassName ) { if ( FALSE === array_key_exists ( $ eventClassName , $ this -> eventMap ) ) { return [ ] ; } return $ this -> eventMap [ $ eventClassName ] ; } | Gets all listeners for an event . |
12,113 | public function view ( $ name , array $ context = [ ] ) { $ context += [ 'current_url' => $ this -> getRequest ( ) -> getUri ( ) ] ; if ( method_exists ( $ this , 'flash' ) ) { $ context += [ 'flash' => $ this -> flash ( ) ] ; } $ response = $ this -> getViewer ( ) -> render ( $ this -> getResponse ( ) , $ name , $ con... | View rendered template |
12,114 | public function getCellDataForColumnName ( $ columnName ) { return Extractor :: extract ( $ this -> _data , $ this -> _dataGrid -> getColumn ( $ columnName ) -> getCellAccessor ( ) ) ; } | Get the cell accessor from the DataGridColumn and extract the data from the row |
12,115 | public function matchIdentityRoles ( array $ roles ) : bool { $ identityRoles = $ this -> getIdentityRoles ( ) ; if ( empty ( $ identityRoles ) ) { return false ; } $ roleNames = [ ] ; foreach ( $ roles as $ role ) { $ roleNames [ ] = $ role instanceof RoleInterface ? $ role -> getName ( ) : ( string ) $ role ; } $ ide... | Check if the given roles match one of the identity roles |
12,116 | public function get_root_path ( $ repository ) { if ( \ is_string ( $ repository ) ) { $ repository = $ this -> repository ( $ repository ) ; } if ( ! empty ( $ repository ) && ! empty ( $ repository [ 'bbn_path' ] ) ) { $ repository_path = ! empty ( $ repository [ 'path' ] ) ? '/' . $ repository [ 'path' ] : '' ; $ pa... | Gets the real root path from a repository s id as recorded in the options . |
12,117 | public function repositories ( string $ code = '' ) { $ all = $ this -> options -> full_soptions ( $ this -> options -> from_code ( 'PATHS' , 'ide' , 'appui' ) ) ; $ cats = [ ] ; $ r = [ ] ; foreach ( $ all as $ a ) { if ( \ defined ( $ a [ 'bbn_path' ] ) ) { $ k = $ a [ 'bbn_path' ] . '/' . ( $ a [ 'code' ] === '/' ? ... | Makes the repositories configurations . |
12,118 | public function repository_from_url ( string $ url , bool $ obj = false ) { $ repository = '' ; $ repositories = $ this -> repositories ( ) ; foreach ( $ repositories as $ i => $ d ) { if ( ( strpos ( $ url , $ i ) === 0 ) && ( \ strlen ( $ i ) > \ strlen ( $ repository ) ) ) { $ repository = $ i ; } } if ( ! empty ( $... | Returns the repository s name or object from an URL . |
12,119 | public function real_to_url ( string $ file ) { foreach ( $ this -> repositories ( ) as $ i => $ d ) { if ( ( $ root = $ this -> get_root_path ( $ d ) ) && ( strpos ( $ file , $ root ) === 0 ) ) { $ res = $ i ; $ bits = explode ( '/' , substr ( $ file , \ strlen ( $ root ) ) ) ; if ( ! empty ( $ d [ 'tabs' ] ) ) { $ ta... | Returns the file s URL from the real file s path . |
12,120 | private function connection__predis ( ) { $ args = [ ] ; foreach ( array_keys ( $ this -> verified_params ) as $ key ) { if ( $ key == 'redistype' || ! $ this -> $ key ) continue ; $ args [ substr ( $ key , 5 ) ] = $ this -> $ key ; } try { $ this -> connection = new \ Predis \ Client ( $ args ) ; $ this -> connection ... | Open connection with predis . |
12,121 | private function connection__redis ( ) { $ this -> connection = new \ Redis ( ) ; if ( ! @ $ this -> connection -> connect ( $ this -> redishost , $ this -> redisport , $ this -> redistimeout ) ) return $ this -> connection_open_fail ( ) ; if ( $ this -> redispassword || $ this -> redisdatabase ) { try { if ( $ this ->... | Open connection with ext - redis . |
12,122 | private function connection_open_fail ( $ msg = '' ) { $ logline = sprintf ( 'Redis: %s connection failed' , $ this -> redistype ) ; if ( $ msg ) $ logline .= ': ' . $ msg ; $ logline .= ' <- ' . json_encode ( $ this -> verified_params ) ; self :: $ logger -> error ( $ logline ) ; throw new RedisError ( RedisError :: C... | Throw exception on failing connection . |
12,123 | public function parseString ( $ str ) { $ parser = ( new \ PhpParser \ ParserFactory ( ) ) -> create ( \ PhpParser \ ParserFactory :: PREFER_PHP7 ) ; $ this -> ast = $ parser -> parse ( $ str ) ; return $ this ; } | Parses a PHP string . |
12,124 | public function getExactlyOneClass ( $ fileSource ) { if ( count ( $ this -> ast ) !== 1 || $ this -> ast [ 0 ] -> getType ( ) !== "Stmt_Class" ) throw new PhpParserException ( "\"$fileSource\" does not define exactly one class" ) ; return $ this -> ast [ 0 ] ; } | Asserts that the code defines one class and returns it . |
12,125 | protected function buildResponse ( $ html , ResponseInterface $ response ) { $ body = new Stream ( 'php://memory' , 'w' ) ; $ body -> write ( $ html ) ; $ response = $ response -> withBody ( $ body ) ; return $ response ; } | Builds response instance with HTML body from HTML passed in . |
12,126 | protected function cacheResponse ( RequestInterface $ request , ResponseInterface $ response ) { $ cacheItem = $ this -> createCacheItem ( $ this -> createKeyFromRequest ( $ request ) ) ; $ value = $ response -> getBody ( ) -> __toString ( ) ; $ cacheItem -> set ( $ value ) ; $ this -> getCacheItemPool ( ) -> save ( $ ... | Caches a response by Request & Response . |
12,127 | public function addElementArray ( $ elementArray ) { if ( ! is_array ( $ elementArray ) ) { return ; } foreach ( $ elementArray as $ elementName => $ content ) { $ this -> addElement ( $ elementName , $ content ) ; } } | Set multiple feed elements from an array . Elements which have attributes cannot be added by this method |
12,128 | public function setDate ( $ date ) { if ( ! is_numeric ( $ date ) ) { $ date = strtotime ( $ date ) ; } if ( $ this -> version == Eresus_Feed_Writer :: ATOM ) { $ tag = 'updated' ; $ value = date ( DATE_ATOM , $ date ) ; } elseif ( $ this -> version == Eresus_Feed_Writer :: RSS2 ) { $ tag = 'pubDate' ; $ value = date (... | Set the date element of feed item |
12,129 | public function setEncloser ( $ url , $ length , $ type ) { $ attributes = array ( 'url' => $ url , 'length' => $ length , 'type' => $ type ) ; $ this -> addElement ( 'enclosure' , '' , $ attributes ) ; } | Set the encloser element of feed item For RSS 2 . 0 only |
12,130 | static function fetchNotificationList ( $ status = 1 , $ length = null , $ offset = 0 , $ sorts = null ) { $ cond = array ( ) ; if ( is_null ( $ status ) ) { $ cond = null ; } else { $ cond [ 'status' ] = $ status ; } $ limit = array ( ) ; if ( is_null ( $ length ) ) { $ limit = null ; } else { $ limit [ 'offset' ] = $... | Fetch the list of notification |
12,131 | public static function factory ( $ aOptions ) { if ( $ aOptions instanceof \ Traversable ) $ aOptions = \ Zend \ Stdlib \ ArrayUtils :: iteratorToArray ( $ aOptions ) ; elseif ( ! is_array ( $ aOptions ) ) throw new \ InvalidArgumentException ( __METHOD__ . ' expects an array or Traversable object; received "' . ( is_o... | Instantiate a Templating service |
12,132 | public function buildLayoutTemplate ( \ Zend \ Mvc \ MvcEvent $ oEvent ) { $ oRequest = $ oEvent -> getRequest ( ) ; if ( ! ( $ oRequest instanceof \ Zend \ Http \ Request ) || $ oRequest -> isXmlHttpRequest ( ) || ( ( $ oView = $ oEvent -> getResult ( ) ) instanceof \ Zend \ View \ Model \ ModelInterface && $ oView ->... | Define layout template |
12,133 | public static function fromPackageFile ( $ composerJson ) { if ( file_exists ( $ composerJson ) === false ) { throw new ComposerJsonNotFoundException ( "File {$composerJson} not found." ) ; } $ config = Config :: load ( $ composerJson ) ; $ autoload = $ config -> get ( 'autoload.psr-4' ) ; $ composerJsonDirectory = dir... | Create a new matcher package from composer . json |
12,134 | public function setClient ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Application \ API \ OAuth \ Client \ Client $ client = null ) { $ this -> client = $ client ; return $ this ; } | Set client . |
12,135 | private function check_controller_hash_tmp_file ( ) { if ( is_writable ( dirname ( $ this -> controllers_hash_file ) ) ) { App :: uses ( 'File' , 'Utility' ) ; $ file = new File ( $ this -> controllers_hash_file , true ) ; return $ file -> exists ( ) ; } else { $ this -> Session -> setFlash ( sprintf ( __d ( 'acl' , 't... | Check if the file containing the stored controllers hashes can be created and create it if it does not exist |
12,136 | public function set_display_name ( $ model_classname , $ field_expression ) { $ model_instance = $ this -> get_model_instance ( $ model_classname ) ; $ schema = $ model_instance -> schema ( ) ; if ( array_key_exists ( $ field_expression , $ schema ) || array_key_exists ( str_replace ( $ model_classname . '.' , '' , $ f... | Check if a given field_expression is an existing fieldname for the given model |
12,137 | private function get_model_instance ( $ model_classname ) { if ( ! isset ( $ this -> controller -> { $ model_classname } ) ) { $ model_instance = ClassRegistry :: init ( $ model_classname ) ; } else { $ model_instance = $ this -> controller -> { $ model_classname } ; } return $ model_instance ; } | Return an instance of the given model name |
12,138 | public function get_stored_controllers_hashes ( ) { $ file = new File ( $ this -> controllers_hash_file ) ; $ file_content = $ file -> read ( ) ; if ( ! empty ( $ file_content ) ) { $ stored_controller_hashes = unserialize ( $ file_content ) ; } else { $ stored_controller_hashes = array ( ) ; } return $ stored_controll... | return the stored array of controllers hashes |
12,139 | public function get_current_controllers_hashes ( ) { $ controllers = $ this -> AclReflector -> get_all_controllers ( ) ; $ current_controller_hashes = array ( ) ; foreach ( $ controllers as $ controller ) { $ ctler_file = new File ( $ controller [ 'file' ] ) ; $ current_controller_hashes [ $ controller [ 'name' ] ] = $... | return an array of all controllers hashes |
12,140 | public function get_missing_acos ( $ update_hash_file = true ) { if ( $ this -> check_controller_hash_tmp_file ( ) ) { $ missing_aco_nodes = array ( ) ; $ stored_controller_hashes = $ this -> get_stored_controllers_hashes ( ) ; $ current_controller_hashes = $ this -> get_current_controllers_hashes ( ) ; if ( $ update_h... | Get a list of plugins controllers and actions that don t have any corresponding ACO . To run faster the method only checks controllers that have not already been checked or that have been modified . |
12,141 | public function setStatus ( array $ params ) { if ( ! isset ( $ params [ 'identifier' ] ) ) { throw new MissingArgumentException ( 'identifier' ) ; } if ( ! isset ( $ params [ 'status' ] ) ) { throw new MissingArgumentException ( 'status' ) ; } return $ this -> post ( 'set_status' , $ params ) ; } | Updates the user status using the current signed in identity provider . |
12,142 | public function createTable ( ) { $ this -> getConnection ( ) ; switch ( $ this -> driver ) { case 'mysql' : $ sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->usernameCol VARBINARY(256) NOT NULL, $this->lastUsedCol INTEGER UNSIGNED NOT NULL, $this->expiredCol INTEGER UNSIGNED)... | Creates the table to store sessions which can be called once for setup . |
12,143 | public function connectToServer ( $ address , $ options = array ( ) ) { $ parameters = NULL ; if ( array_key_exists ( 'port' , $ options ) ) { $ parameters = ':' . $ options [ 'port' ] ; } if ( array_key_exists ( 'password' , $ options ) ) { $ parameters .= '/' . $ options [ 'password' ] ; } return $ this -> protocol .... | Generates a link to connecto the specified server |
12,144 | public function openSteamPage ( $ page , $ parameter = NULL ) { if ( in_array ( $ page , $ this -> steamPages ) ) { return $ this -> protocol . 'url/' . $ page . '/' . $ parameter ; } } | Generates a link to open the specified named page |
12,145 | protected function findSource ( ) { $ stack = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT ) ; $ sources = [ ] ; foreach ( $ stack as $ index => $ trace ) { $ sources [ ] = $ this -> parseTrace ( $ index , $ trace ) ; } return array_filter ( $ sources ) ; } | Use a backtrace to search for the origins of the query . |
12,146 | protected function parseTrace ( $ index , array $ trace ) { $ frame = ( object ) [ 'index' => $ index , 'namespace' => null , 'name' => null , 'line' => isset ( $ trace [ 'line' ] ) ? $ trace [ 'line' ] : '?' , ] ; if ( isset ( $ trace [ 'function' ] ) && $ trace [ 'function' ] == 'substituteBindings' ) { $ frame -> na... | Parse a trace element from the backtrace stack . |
12,147 | public function find ( $ key , $ default = null ) { $ key = $ this -> formatKey ( $ key ) ; $ headers = array_get ( $ this -> headers , $ key , $ default ) ; if ( is_array ( $ headers ) ) { $ headers = array_pop ( $ headers ) ; } return $ headers ; } | Find the last added header . |
12,148 | public function set ( $ key , $ value ) { $ key = $ this -> formatKey ( $ key ) ; array_set ( $ this -> headers , $ key , [ $ value ] ) ; } | Replace all previous headers with this one . |
12,149 | public function get ( $ key ) { $ key = $ this -> formatKey ( $ key ) ; return array_get ( $ this -> headers , $ key , [ ] ) ; } | Get all headers by key . |
12,150 | public function has ( $ key ) { $ key = $ this -> formatKey ( $ key ) ; return array_has ( $ this -> headers , $ key ) ; } | Check if there are any headers . |
12,151 | public function remove ( $ key ) { $ key = $ this -> formatKey ( $ key ) ; array_remove ( $ this -> headers , $ key ) ; } | Remove all registered headers . |
12,152 | public function toFlatArray ( ) { $ array = [ ] ; foreach ( $ this -> headers as $ key => $ headers ) { foreach ( $ headers as $ header ) { $ array [ ] = $ this -> formatHeader ( $ key , $ header ) ; } } return $ array ; } | Get a list of formatted header strings . |
12,153 | protected function toArray ( $ data ) { if ( is_array ( $ data ) ) { return $ data ; } if ( is_object ( $ data ) ) { if ( method_exists ( $ data , 'toArray' ) ) { return $ data -> toArray ( ) ; } if ( $ data instanceof \ Traversable ) { return iterator_to_array ( $ data ) ; } } return ( array ) $ data ; } | Convert a result set to an array |
12,154 | public static function parseCookieParts ( array $ cookieParts ) { $ cookie = '' ; foreach ( $ cookieParts as $ key => $ val ) { $ cookie .= $ key . '=' . rawurlencode ( $ val ) . ';' ; } $ cookie = trim ( $ cookie , ';' ) ; return $ cookie ; } | Takes an array of cookie parts and returns an urlencoded string ready to send |
12,155 | public function register ( Application $ app ) { $ config = $ app [ 'config' ] ; $ app [ 'translator.locale' ] = $ config -> getTranslator ( ) -> getLocale ( ) ; $ app [ 'translator' ] = $ app -> share ( function ( $ app ) { $ translator = new Translator ( ) ; $ translator -> setLocale ( $ app [ 'translator.locale' ] )... | Registers the translator using the currently active locale . |
12,156 | public function clientGetById ( $ clid ) { if ( ! array_key_exists ( $ clid , $ this -> clientList ( ) ) ) { throw new Exception ( "invalid clientID" , 0x200 ) ; } return $ this -> clientList [ intval ( $ clid ) ] ; } | Returns the Client object matching the given ID . |
12,157 | protected function lazyLoad ( $ eventName ) { if ( isset ( $ this -> listenerIds [ $ eventName ] ) ) { foreach ( $ this -> listenerIds [ $ eventName ] as $ args ) { list ( $ serviceId , $ method , $ priority ) = $ args ; $ listener = $ this -> container -> get ( $ serviceId ) ; $ key = $ serviceId . '.' . $ method ; if... | Lazily loads listeners for this event from the dependency injection container . |
12,158 | private function helpers ( $ handlebars ) { $ helpers = $ this -> default_helpers ( ) ; $ helpers = apply_filters ( 'caldera_metaplate_handlebars_helpers' , $ helpers , $ handlebars ) ; $ handlebars = new helper_loader ( $ handlebars , $ helpers ) ; if ( isset ( $ handlebars -> handlebars ) ) { $ handlebars = $ handleb... | Register helpers . |
12,159 | private function initTypes ( ) { $ this -> types = [ ] ; foreach ( $ this -> loadTypes ( ) as $ type ) { if ( ! $ type instanceof BlockTypeInterface ) { throw new Exception \ UnexpectedTypeException ( $ type , 'Oro\Component\Layout\BlockTypeInterface' ) ; } $ this -> types [ $ type -> getName ( ) ] = $ type ; } } | Initializes block types . |
12,160 | private function initTypeExtensions ( ) { $ this -> typeExtensions = [ ] ; foreach ( $ this -> loadTypeExtensions ( ) as $ extension ) { if ( ! $ extension instanceof BlockTypeExtensionInterface ) { throw new Exception \ UnexpectedTypeException ( $ extension , 'Oro\Component\Layout\BlockTypeExtensionInterface' ) ; } $ ... | Initializes block type extensions . |
12,161 | private function initLayoutUpdates ( ContextInterface $ context ) { $ loadedLayoutUpdates = $ this -> loadLayoutUpdates ( $ context ) ; foreach ( $ loadedLayoutUpdates as $ id => $ layoutUpdates ) { if ( ! is_string ( $ id ) ) { throw new Exception \ UnexpectedTypeException ( $ id , 'string' , 'layout item id' ) ; } if... | Initializes layout updates . |
12,162 | private function initContextConfigurators ( ) { $ this -> contextConfigurators = [ ] ; foreach ( $ this -> loadContextConfigurators ( ) as $ configurator ) { if ( ! $ configurator instanceof ContextConfiguratorInterface ) { throw new Exception \ UnexpectedTypeException ( $ configurator , 'Oro\Component\Layout\ContextCo... | Initializes layout context configurators . |
12,163 | private function initDataProviders ( ) { $ this -> dataProviders = [ ] ; foreach ( $ this -> loadDataProviders ( ) as $ name => $ dataProvider ) { $ this -> dataProviders [ $ name ] = $ dataProvider ; } } | Initializes data providers . |
12,164 | public function create ( $ schema ) { $ types = array_map ( function ( $ column ) { return $ column [ 'name' ] . ':' . $ column [ 'type' ] ; } , $ schema ) ; return implode ( ', ' , $ types ) ; } | Return the argument string to use for the migration command . |
12,165 | public function next ( ) { $ this -> is -> next ( ) ; if ( $ this -> is -> valid ( ) ) { if ( $ this -> debug ) fprintf ( STDOUT , "> %s\n" , $ this -> is -> current ( ) ) ; return $ this -> is -> current ( ) ; } return false ; } | Get the next character . |
12,166 | public function init ( ) { parent :: init ( ) ; if ( ! Permission :: check ( "USERS_MANAGE_ACCOUNT" ) ) { Security :: permissionFailure ( ) ; } $ member = Member :: currentUser ( ) ; if ( $ member instanceof Member ) { $ this -> member = $ member ; } } | Perorm setup when this controller is initialised |
12,167 | public function index ( ) { $ sections = ArrayList :: create ( ) ; $ sections -> push ( ArrayData :: create ( array ( "Title" => "" , "Content" => $ this -> renderWith ( "UsersProfileSummary" , array ( "CurrentUser" => Member :: currentUser ( ) ) ) ) ) ) ; $ this -> extend ( "updateIndexSections" , $ sections ) ; $ thi... | Display the currently outstanding orders for the current user |
12,168 | public function ChangePasswordForm ( ) { $ form = ChangePasswordForm :: create ( $ this , "ChangePasswordForm" ) ; $ form -> Actions ( ) -> find ( "name" , "action_doChangePassword" ) -> addExtraClass ( "btn" ) -> addExtraClass ( "btn-green" ) ; $ cancel_btn = LiteralField :: create ( "CancelLink" , '<a href="' . $ thi... | Factory for generating a change password form . The form can be expanded using an extension class and calling the updateChangePasswordForm method . |
12,169 | public function getAccountMenu ( ) { $ menu = ArrayList :: create ( ) ; $ curr_action = $ this -> request -> param ( "Action" ) ; $ menu -> add ( ArrayData :: create ( array ( "ID" => 0 , "Title" => _t ( 'Users.PROFILESUMMARY' , "Profile Summary" ) , "Link" => $ this -> Link ( ) , "LinkingMode" => ( ! $ curr_action ) ?... | Return a list of nav items for managing a users profile . You can add new items to this menu using the updateAccountMenu extension |
12,170 | public function getDataStructureIdentifierPreProcess ( array $ fieldTca , string $ tableName , string $ fieldName , array $ row ) : array { if ( $ tableName != 'tt_content' || $ fieldName != 'tx_column_layout_column_config' ) { return [ ] ; } return [ 'type' => 'tca' , 'tableName' => $ tableName , 'fieldName' => $ fiel... | Generates a DataStructureIdentifier for the flexform in column configuration field |
12,171 | public function transform ( ProjectDescriptor $ project , Transformation $ transformation ) { $ structure = $ this -> loadAst ( $ this -> getAstPath ( $ transformation ) ) ; $ proc = $ this -> getXslProcessor ( $ transformation ) ; $ proc -> registerPHPFunctions ( ) ; $ this -> registerDefaultVariables ( $ transformati... | This method combines the structure . xml and the given target template and creates a static html page at the artifact location . |
12,172 | protected function getXsltUriFromFilename ( $ filename ) { if ( strtoupper ( substr ( PHP_OS , 0 , 3 ) ) == 'WIN' && ! \ Phar :: running ( ) ) { $ filename = '/' . $ filename ; } return 'file://' . $ filename ; } | Takes the filename and converts it into a correct URI for XSLTProcessor . |
12,173 | public function create ( $ inbox = 'INBOX' ) { $ stream = imap_open ( $ this -> connectionString ( $ inbox ) , $ this -> user , $ this -> password ) ; return new Connection ( $ stream ) ; } | Create new IMAP connection |
12,174 | public function mailboxes ( $ mailboxSearch = '*' , $ withConnection = false ) { $ connectionString = $ this -> connectionString ( ) ; $ stream = imap_open ( $ connectionString , $ this -> user , $ this -> password ) ; $ mailboxes = imap_list ( $ stream , $ connectionString , $ mailboxSearch ) ; if ( $ withConnection )... | Get a list of mailboxes on the mail server . |
12,175 | protected function connectionString ( $ inbox = '' ) { return sprintf ( static :: $ connectionFormat , $ this -> host , $ this -> port , $ this -> service , $ this -> enc , $ inbox ) ; } | Make the IMAP connection string from configuration |
12,176 | public function read ( $ length = 4096 ) { $ data = false ; $ this -> _checkFileOpened ( ) ; if ( $ length > 0 ) { $ data = $ this -> _read ( $ length ) ; } return $ data ; } | Read data from file |
12,177 | protected function _open ( $ mode ) { $ this -> _fileHandler = @ fopen ( $ this -> _filePath , $ mode ) ; if ( false === $ this -> _fileHandler ) { throw new Mage_Exception ( 'Failed to open file ' . $ this -> _filePath ) ; } } | Implementation of file opening |
12,178 | protected function _write ( $ data ) { $ result = @ fwrite ( $ this -> _fileHandler , $ data ) ; if ( false === $ result ) { throw new Mage_Exception ( 'Failed to write data to ' . $ this -> _filePath ) ; } } | Implementation of writing data to file |
12,179 | protected function _read ( $ length ) { $ result = fread ( $ this -> _fileHandler , $ length ) ; if ( false === $ result ) { throw new Mage_Exception ( 'Failed to read data from ' . $ this -> _filePath ) ; } return $ result ; } | Implementation of file reading |
12,180 | public function generateBody ( ) { $ data = $ this -> noMimeMessage . ezcMailTools :: lineBreak ( ) ; foreach ( $ this -> parts as $ part ) { $ data .= ezcMailTools :: lineBreak ( ) . '--' . $ this -> boundary . ezcMailTools :: lineBreak ( ) ; $ data .= $ part -> generate ( ) ; } $ data .= ezcMailTools :: lineBreak ( )... | Returns the generated body for all multipart types . |
12,181 | public function hasResponsible ( $ user ) { return $ this -> users ( ) -> where ( 'user_id' , $ user -> id ) -> first ( ) -> pivot -> responsible ; } | Returns true if the event have the specified user as responsible . |
12,182 | public function startDatetime ( ) { $ date = explode ( '-' , $ this -> start_date ) ; $ time = explode ( ':' , $ this -> start_time ) ; $ start_datetime = Carbon :: create ( $ date [ 0 ] , $ date [ 1 ] , $ date [ 2 ] , $ time [ 0 ] , $ time [ 1 ] ) ; return $ start_datetime ; } | Get Carbon start datetime . |
12,183 | public function endDatetime ( ) { $ date = explode ( '-' , $ this -> end_date ) ; $ time = explode ( ':' , $ this -> end_time ) ; $ end_datetime = Carbon :: create ( $ date [ 0 ] , $ date [ 1 ] , $ date [ 2 ] , $ time [ 0 ] , $ time [ 1 ] ) ; return $ end_datetime ; } | Get Carbon end datetime . |
12,184 | protected function syn ( ) { $ this -> initTransport ( $ this -> options ) ; $ this -> transport -> setAdapter ( $ this ) ; Profiler :: init ( spl_object_hash ( $ this ) ) ; $ rdy = $ this -> getTransport ( ) -> readLine ( ) ; if ( ! $ rdy -> startsWith ( TeamSpeak3 :: TS3_PROTO_IDENT ) && ! $ rdy -> startsWith ( TeamS... | Connects the Transport object and performs initial actions on the remote server . |
12,185 | public function adjust ( Carrier $ carrier = null ) { if ( $ carrier !== null ) { $ this -> carrier = $ carrier ; } if ( ! isset ( $ this -> carrier ) ) { throw new MissingCarrier ( 'Carrier is required to adjust cost' ) ; } $ costs = $ this -> getPossibleCostsPerCarrier ( ) [ $ this -> carrier -> network ] ; foreach (... | Adjust cost amount for a given carrier |
12,186 | public function fix ( $ mobileOrCarrier ) { if ( $ mobileOrCarrier instanceof Carrier ) { $ this -> carrier = $ mobileOrCarrier ; } elseif ( $ mobileOrCarrier instanceof Mobile ) { $ this -> carrier = $ mobileOrCarrier -> carrier ; } else { $ this -> carrier = Loader :: mobile ( $ mobileOrCarrier ) -> carrier ; } retur... | Fix cost by mobile or carrier |
12,187 | public function apply ( Collection $ collection ) { $ this -> collection = $ collection ; foreach ( $ this -> filters ( ) as $ name => $ value ) { if ( ! method_exists ( $ this , $ name ) ) { continue ; } if ( is_array ( $ value ) or trim ( $ value ) ) { $ this -> collection = $ this -> $ name ( $ value ) ; } else { $ ... | Apply the filters to the collection . |
12,188 | private function getFileOrDirectorySettings ( $ settings , $ key ) { $ filesOrDirectories = $ settings -> getOptional ( $ key , array ( ) ) ; if ( ! is_array ( $ filesOrDirectories ) ) $ filesOrDirectories = array ( $ filesOrDirectories ) ; return $ filesOrDirectories ; } | Returns plain settings arrays with file or directory specifications . |
12,189 | protected function _generateFiles ( ) { foreach ( $ this -> selectedArtifacts as $ artifact ) { $ settings = $ artifact -> getGeneratorSettings ( static :: getKey ( ) ) ; foreach ( $ this -> getFileOrDirectorySettings ( $ settings , "files" ) as $ file ) $ this -> _processFileSpecification ( $ artifact , fphp \ Specifi... | Processes the files and directories . |
12,190 | private function _processFileSpecification ( $ artifact , $ fileSpecification ) { if ( ! in_array ( basename ( $ fileSpecification -> getSource ( ) ) , $ this -> exclude ) ) $ this -> processFileSpecification ( $ artifact , $ fileSpecification ) ; } | Processes a file from a specification . Considers globally excluded files . Only exact file names are supported . |
12,191 | public static function get ( $ name , $ call = true ) { if ( ! isset ( self :: $ services [ $ name ] ) ) { throw new \ RuntimeException ( "The service [$name] don't register." ) ; } $ service = self :: $ services [ $ name ] ; if ( \ is_object ( $ service ) && $ service instanceof \ Closure && $ call ) { if ( ! isset ( ... | get a app service by name if is a closure only run once . |
12,192 | public static function factory ( $ name ) { if ( ! isset ( self :: $ services [ $ name ] ) ) { throw new \ RuntimeException ( "The service [$name] don't register." ) ; } $ service = self :: $ services [ $ name ] ; if ( \ is_object ( $ service ) && method_exists ( $ service , '__invoke' ) ) { return $ service ( ) ; } re... | create a app service by name it always return a new instance . |
12,193 | public function addExtraClasses ( $ classes ) { if ( ! is_array ( $ classes ) ) { $ classes = explode ( " " , $ classes ) ; } $ this -> extra_classes = array_merge ( $ this -> extra_classes , $ classes ) ; return $ this ; } | Add additional css classes |
12,194 | public function removeExtraClasses ( $ classes ) { if ( ! is_array ( $ classes ) ) { $ classes = explode ( " " , $ classes ) ; } foreach ( $ classes as $ class ) { if ( isset ( $ this -> extra_classes [ $ class ] ) ) { unset ( $ this -> extra_classes [ $ class ] ) ; } } return $ this ; } | Remove provided CSS classes |
12,195 | public function build ( $ action , array $ data , CliInput $ input , Mapping $ mapping ) { $ payloadMeta = $ this -> mapper -> getPayloadMeta ( $ data ) ; if ( $ action === 'request' ) { return new RequestApi ( $ this -> logger -> getRequestLogger ( $ payloadMeta -> getId ( ) ) , $ this -> component , $ mapping , dirna... | Build a Request Api class instance |
12,196 | public function getAttribute ( $ key ) { if ( isset ( $ this -> mutations [ $ key ] ) ) { return $ this -> mutations [ $ key ] ; } if ( array_key_exists ( $ key , $ mutatables = static :: getMutatables ( ) ) ) { return $ this -> mutateExtensionAttribute ( $ key , $ mutatables [ $ key ] ) ; } return parent :: getAttribu... | Get an attribute from the model with custom accessor . |
12,197 | protected function mutateExtensionAttribute ( $ key , $ type ) { $ value = $ this -> getAttributeFromArray ( $ key ) ; $ mutation = $ this -> { 'make' . studly_case ( $ type ) . 'TypeMutation' } ( $ value ) ; $ this -> mutations [ $ key ] = $ mutation ; return $ mutation ; } | Mutates and stores an attribute in array |
12,198 | public function setLogger ( \ sb \ Logger \ Base $ logger , $ logname = '' ) { $ this -> logger = $ logger ; $ this -> log_name = $ logname ? $ logname : get_called_class ( ) ; $ this -> log_name = preg_replace ( "~[^\w+]~" , "_" , $ this -> log_name ) ; } | Set the logger that logs the full log message stream when the destructor runs |
12,199 | public function log ( $ message , $ type = "MESSAGE" , $ text_attributes = [ ] ) { $ type = strtoupper ( $ type ) ; switch ( $ type ) { case 'RAW' : break ; case 'ERROR' : $ this -> number_of_errors ++ ; $ this -> onError ( $ message ) ; default : $ message = $ type . ': ' . $ message ; } $ this -> logToFile ( $ messag... | Logs to std out |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.