idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
5,100 | private function setOrderType ( $ data , ApiOrderInterface $ order , $ patch = false ) { $ type = $ this -> getProperty ( $ data , 'type' , $ order -> getType ( ) ) ; if ( isset ( $ data [ 'type' ] ) ) { if ( is_array ( $ type ) && isset ( $ type [ 'id' ] ) ) { $ typeId = $ type [ 'id' ] ; } elseif ( is_numeric ( $ typ... | Sets OrderType on an order |
5,101 | private function addContactRelation ( array $ data , $ key , $ addCallback ) { $ contact = null ; if ( array_key_exists ( $ key , $ data ) && is_array ( $ data [ $ key ] ) && array_key_exists ( 'id' , $ data [ $ key ] ) ) { $ contactId = $ data [ $ key ] [ 'id' ] ; $ contact = $ this -> em -> getRepository ( static :: ... | Searches for contact in specified data and calls callback function |
5,102 | private function setCustomerAccount ( $ data , Order $ order , $ patch = false ) { $ accountData = $ this -> getProperty ( $ data , 'customerAccount' ) ; if ( $ accountData ) { if ( ! array_key_exists ( 'id' , $ accountData ) ) { throw new MissingOrderAttributeException ( 'account.id' ) ; } $ account = $ this -> accoun... | Sets the customer account of an order |
5,103 | private function processItems ( $ data , Order $ order , $ locale , $ userId = null ) { $ result = true ; try { if ( $ this -> checkIfSet ( 'items' , $ data ) ) { if ( ! is_array ( $ data [ 'items' ] ) ) { throw new MissingOrderAttributeException ( 'items array' ) ; } $ items = $ data [ 'items' ] ; $ get = function ( $... | Processes items defined in an order and creates item entities |
5,104 | public static function create ( $ accessor , $ name , array $ arguments = [ ] ) { $ container = static :: getContainer ( ) ; $ object = $ container -> get ( $ accessor ) ; return call_user_func_array ( [ $ object , $ name ] , $ arguments ) ; } | Get provided accessor from container and call method |
5,105 | public function registerNamespace ( $ namespace , $ paths , $ type = 'psr-0' ) { switch ( $ type ) { case 'psr-0' : parent :: registerNamespace ( $ namespace , $ paths ) ; break ; case 'psr-4' : $ this -> psr4Loader -> addNamespace ( $ namespace , $ paths ) ; break ; default : throw new AutoloadException ( "$type is no... | Overridden to allow injecting psr - 4 into the mix . Also opens up doors for alternative formats to be used later . Either way it s a mess here right now |
5,106 | protected static function detectType ( array $ data ) { foreach ( [ self :: TYPE_TEXT , self :: TYPE_AUDIO , self :: TYPE_DOCUMENT , self :: TYPE_GAME , self :: TYPE_PHOTO , self :: TYPE_STICKER , self :: TYPE_VIDEO , self :: TYPE_VOICE , self :: TYPE_CONTACT , self :: TYPE_LOCATION , self :: TYPE_VENUE , self :: TYPE_... | Detects message type |
5,107 | public function add ( MiddlewareInterface $ middleware ) : self { $ pipe = clone $ this ; array_push ( $ pipe -> middlewares , $ middleware ) ; return $ pipe ; } | Creates a new pipe with the given middleware connected . |
5,108 | public static function word ( int $ num ) : string { $ numberWordMap = [ 1 => Yii :: t ( 'yuncms' , 'One' ) , 2 => Yii :: t ( 'yuncms' , 'Two' ) , 3 => Yii :: t ( 'yuncms' , 'Three' ) , 4 => Yii :: t ( 'yuncms' , 'Four' ) , 5 => Yii :: t ( 'yuncms' , 'Five' ) , 6 => Yii :: t ( 'yuncms' , 'Six' ) , 7 => Yii :: t ( 'yunc... | Returns the word version of a number |
5,109 | public function get ( $ columns = [ '*' ] ) { $ result = $ this -> getBuilder ( ) -> get ( $ columns ) ; $ this -> resetBuilder ( ) ; return $ result ; } | Execute the query and retrieve result . |
5,110 | public function count ( $ columns = '*' ) { $ result = $ this -> getBuilder ( ) -> count ( $ columns ) ; $ this -> resetBuilder ( ) ; return ( int ) $ result ; } | Execute query as a count statement . |
5,111 | public function max ( $ column ) { $ result = $ this -> getBuilder ( ) -> max ( $ column ) ; $ this -> resetBuilder ( ) ; return $ result ; } | Retrieve the maximum value of a given column . |
5,112 | public function update ( array $ values ) { $ result = $ this -> getBuilder ( ) -> update ( $ values ) ; $ this -> resetBuilder ( ) ; return ( int ) $ result ; } | Execute query as an update statement . |
5,113 | public function raw ( $ value ) { $ result = $ this -> getBuilder ( ) -> raw ( $ value ) ; $ this -> resetBuilder ( ) ; return $ result ; } | Create a raw database expression . |
5,114 | public function renderSql ( ) { $ result = vsprintf ( $ this -> getBuilder ( ) -> getQuery ( ) -> toSql ( ) , $ this -> getBuilder ( ) -> getQuery ( ) -> getBindings ( ) ) ; $ this -> resetBuilder ( ) ; return $ result ; } | Render repository s query SQL string . |
5,115 | public function withTrashed ( ) { if ( ! in_array ( IlluminateEloquentSoftDeletes :: class , class_uses ( $ this -> getModel ( ) ) ) ) { throw new ModelNotSoftDeletable ( 'Model [%s] is not using the Soft Delete trait' ) ; } $ this -> setBuilder ( $ this -> getModel ( ) -> withTrashed ( ) ) ; return $ this ; } | Include soft deleted entries in query . Note this will reset the build |
5,116 | public function onlyTrashed ( ) { if ( ! in_array ( IlluminateEloquentSoftDeletes :: class , class_uses ( $ this -> getModel ( ) ) ) ) { throw new ModelNotSoftDeletable ( 'Model [%s] is not using the Soft Delete trait' ) ; } $ this -> setBuilder ( $ this -> getModel ( ) -> onlyTrashed ( ) ) ; return $ this ; } | Only include soft deleted entries in query . Note this will reset the build |
5,117 | public function getByContinuously ( $ column , $ value , array $ columns = [ '*' ] , $ retries = 10 , $ delayMs = 100 , $ maxDelay = 2000 , $ maxRetries = 100 ) { $ maxDelay = ( $ maxDelay > 2000 ) ? 2000 : $ maxDelay ; $ maxRetries = ( $ maxRetries > 100 ) ? 100 : $ maxRetries ; if ( $ delayMs > $ maxDelay ) { throw n... | Retrieve entity by a specific column and value . Will retry with a delay until found . |
5,118 | public function getByIdContinuously ( $ id , array $ columns = [ '*' ] , $ retries = 10 , $ delayMs = 100 ) { return $ this -> getByContinuously ( 'id' , $ id , $ columns , $ retries , $ delayMs ) ; } | Retrieve entity by ID . Will retry with a delay until found . |
5,119 | public function getByIdContinuouslyOrFail ( $ id , array $ columns = [ '*' ] , $ retries = 10 , $ delayMs = 100 ) { $ result = $ this -> getByContinuously ( 'id' , $ id , $ columns , $ retries , $ delayMs ) ; if ( empty ( $ result ) ) { throw new EntityNotFoundException ( sprintf ( '%s not found continuously by Id with... | Retrieve entity by ID . Will retry with a delay until found or throw an exception . |
5,120 | public function deleteMorphsByEntity ( IlluminateEloquentModel $ entity , $ relationName , $ forceDelete = false ) { $ entities = $ this -> getBuilder ( ) -> select ( [ 'id' ] ) -> where ( function ( $ query ) use ( $ entity , $ relationName ) { $ query -> where ( $ relationName . '_type' , '=' , get_class ( $ entity )... | Delete morphed relations by entity . |
5,121 | public function restoreMorphsByEntity ( IlluminateEloquentModel $ entity , $ relationName ) { if ( ! in_array ( IlluminateEloquentSoftDeletes :: class , class_uses ( $ this -> getModel ( ) ) ) ) { throw new ModelNotSoftDeletable ( 'Model [%s] is not using the Soft Delete trait' ) ; } $ entities = $ this -> onlyTrashed ... | Restore morphed relations by entity . |
5,122 | public function setModel ( IlluminateEloquentModel $ model ) { $ this -> model = $ model ; $ this -> setBuilder ( $ model -> newQuery ( ) ) ; return $ this ; } | Set repository model . |
5,123 | public function setBuilder ( IlluminateEloquentBuilder $ builder = null ) { if ( empty ( $ builder ) ) { $ builder = $ this -> getModel ( ) -> newQuery ( ) ; } $ this -> builder = $ builder ; return $ this ; } | Set repository builder . |
5,124 | public function register ( ) { wp_register_script ( $ this -> handle , $ this -> url , $ this -> dependencies , $ this -> version , $ this -> footer ) ; if ( ! empty ( $ this -> localize [ 'data' ] ) && ! empty ( $ this -> localize [ 'data' ] ) ) { wp_localize_script ( $ this -> handle , $ this -> localize [ 'name' ] ,... | Enqueue the script and localize the data as needed |
5,125 | public static function erase ( $ name ) { try { $ class = get_called_class ( ) ; $ cookie = new $ class ( $ name ) ; return $ cookie -> delete ( ) ; } catch ( CookieException $ ce ) { throw $ ce ; } } | Static method to quickly delete a cookie |
5,126 | private function isPerfectCache ( ) { if ( $ this -> cacheMap [ $ this -> hash ] + 0x93a80 > time ( ) ) { $ this -> cacheData = json_decode ( file_get_contents ( $ this -> cacheFile ) , true ) ; return is_array ( $ this -> cacheData ) ; } return false ; } | Check the current cache is perfect or not . |
5,127 | private function _exec ( ) { if ( $ this -> isCached ( ) && $ this -> isPerfectCache ( ) ) { return $ this -> getCache ( ) ; } else { return $ this -> fixer ( $ this -> search ( $ this -> query , $ this -> limit ) ) ; } } | Search data . |
5,128 | private function fixer ( $ data , $ noWrite = false ) { if ( $ noWrite or $ this -> writeCache ( $ data ) ) { $ data = $ noWrite ? $ data : json_decode ( $ data , true ) ; if ( $ data [ 'success' ] === true ) { if ( isset ( $ data [ 'data' ] [ 'tasks' ] [ 'items' ] ) ) { $ r = [ ] ; foreach ( $ data [ 'data' ] [ 'tasks... | Fix raw data . |
5,129 | private function writeCache ( $ data ) { $ this -> cacheMap [ $ this -> hash ] = time ( ) ; $ handle = fopen ( $ this -> cacheMapFile , "w" ) ; flock ( $ handle , LOCK_EX ) ; $ write1 = fwrite ( $ handle , json_encode ( $ this -> cacheMap , JSON_UNESCAPED_SLASHES ) ) ; fclose ( $ handle ) ; $ handle = fopen ( $ this ->... | Write cache . |
5,130 | public function unbind ( ) { if ( $ this -> isBinded ( ) ) { $ this -> getSocket ( ) -> unbind ( $ this -> dsn ) ; $ this -> dsn = null ; } return $ this ; } | Unbinds socket from current binded dsn |
5,131 | public function receiveRequest ( $ wait = self :: WAIT ) { return $ this -> getSocket ( ) -> recv ( ( $ wait ? 0 : \ ZMQ :: MODE_DONTWAIT ) ) ; } | Getting next request from socket . |
5,132 | public function sendReply ( $ reply , $ wait = self :: WAIT ) { $ this -> getSocket ( ) -> send ( $ reply , ( $ wait ? 0 : \ ZMQ :: MODE_DONTWAIT ) ) ; return $ this ; } | Sending reply to ZMQ socket . |
5,133 | public function analyzeBlob ( $ text ) { $ config = Config :: getInstance ( ) ; $ url = $ config -> getParams ( ) [ 'credentials' ] [ 'url' ] . '/v2/profile' ; return $ this -> _worker -> post ( $ url , array ( 'body' => $ text , 'headers' => array ( 'Content-Type' => 'text/plain' ) , ) ) ; } | Analayze a blob of text . |
5,134 | public function getWorker ( ) { if ( $ this -> _worker === null ) { $ config = Config :: getInstance ( ) ; $ this -> setupWorker ( $ config ) ; } return $ this -> _worker ; } | Get the current worker . |
5,135 | public function setupWorker ( Config $ config ) { $ credentials = $ config -> getParams ( ) [ 'credentials' ] ; $ this -> _worker = new \ GuzzleHttp \ Client ( array ( 'defaults' => array ( 'auth' => array ( $ credentials [ 'username' ] , $ credentials [ 'password' ] ) , ) , ) ) ; } | Constructs the middleware REST client library . |
5,136 | public function setExpression ( $ expression ) { $ definitions = array ( '@yearly' => '0 0 1 1 *' , '@annually' => '0 0 1 1 *' , '@monthly' => '0 0 1 * *' , '@weekly' => '0 0 * * 0' , '@daily' => '0 0 * * *' , '@hourly' => '0 * * * *' ) ; if ( isset ( $ definitions [ $ expression ] ) ) { $ expression = $ definitions [ ... | Set CRON expression . |
5,137 | public function matches ( \ DateTime $ date ) { foreach ( $ this -> fields as $ field ) { if ( ! $ field -> matches ( $ date ) ) { return false ; } } return true ; } | Checks if the CRON expression matches the given date . |
5,138 | private function getField ( $ position , $ value ) { switch ( $ position ) { case 0 : return new MinuteField ( $ value ) ; case 1 : return new HourField ( $ value ) ; case 2 : return new DayOfMonthField ( $ value ) ; case 3 : return new MonthField ( $ value ) ; case 4 : return new DayOfWeekField ( $ value ) ; case 5 : ... | Get the field object for the given position with the given value . |
5,139 | protected function configure ( ) { $ this -> setName ( 'scan' ) -> setDescription ( 'scan phpunit test files for static code analysis' ) -> setHelp ( $ this -> getHelpOutput ( ) ) -> addArgument ( 'phpunit-config' , InputArgument :: OPTIONAL , 'the source path of your corresponding phpunit xml config file (e.g. ./tests... | additional options and arguments for our cli application |
5,140 | protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ this -> showExecTitle ( $ input , $ output ) ; $ this -> prepareExecute ( $ input ) ; $ cliOptions = array ( 'sys_phpunit_config' => $ input -> getArgument ( 'phpunit-config' ) , 'sys_phpunit_config_test_suite' => $ input -> getOption ... | exec command scan |
5,141 | public function prepareExecute ( InputInterface $ input ) { $ this -> coverFishHelper = new CoverFishHelper ( ) ; $ phpUnitConfigFile = $ input -> getArgument ( 'phpunit-config' ) ; if ( false === empty ( $ phpUnitConfigFile ) && false === $ this -> coverFishHelper -> checkFileOrPath ( $ phpUnitConfigFile ) ) { throw n... | prepare exec of command scan |
5,142 | public function migrate ( $ request ) { $ migrationTarget = isset ( $ request [ 'MigrationTarget' ] ) ? $ request [ 'MigrationTarget' ] : '' ; $ fileMigrationTarget = isset ( $ request [ 'FileMigrationTarget' ] ) ? $ request [ 'FileMigrationTarget' ] : '' ; $ includeSelected = isset ( $ request [ 'IncludeSelected' ] ) ... | Action to migrate a selected object through to SS |
5,143 | public function getRecord ( $ id ) { if ( is_numeric ( $ id ) ) { return parent :: getRecord ( $ id ) ; } else { return ExternalContent :: getDataObjectFor ( $ id ) ; } } | Return the record corresponding to the given ID . |
5,144 | public function EditForm ( $ request = null ) { HtmlEditorField :: include_js ( ) ; $ cur = $ this -> getCurrentPageID ( ) ; if ( $ cur ) { $ record = $ this -> currentPage ( ) ; if ( ! $ record ) return false ; if ( $ record && ! $ record -> canView ( ) ) return Security :: permissionFailure ( $ this ) ; } if ( $ this... | Return the edit form |
5,145 | public function AddForm ( ) { $ classes = ClassInfo :: subclassesFor ( self :: $ tree_class ) ; array_shift ( $ classes ) ; foreach ( $ classes as $ key => $ class ) { if ( ! singleton ( $ class ) -> canCreate ( ) ) unset ( $ classes [ $ key ] ) ; $ classes [ $ key ] = FormField :: name_to_label ( $ class ) ; } $ field... | Get the form used to create a new provider |
5,146 | function DeleteItemsForm ( ) { $ form = new Form ( $ this , 'DeleteItemsForm' , new FieldList ( new LiteralField ( 'SelectedPagesNote' , sprintf ( '<p>%s</p>' , _t ( 'ExternalContentAdmin.SELECT_CONNECTORS' , 'Select the connectors that you want to delete and then click the button below' ) ) ) , new HiddenField ( 'csvI... | Copied from AssetAdmin ... |
5,147 | public function deleteprovider ( ) { $ script = '' ; $ ids = split ( ' *, *' , $ _REQUEST [ 'csvIDs' ] ) ; $ script = '' ; if ( ! $ ids ) return false ; foreach ( $ ids as $ id ) { if ( is_numeric ( $ id ) ) { $ record = ExternalContent :: getDataObjectFor ( $ id ) ; if ( $ record ) { $ script .= $ this -> deleteTreeNo... | Delete a folder |
5,148 | public static function calculateHashOfArray ( array $ data ) : string { return self :: calculateHash ( ( string ) json_encode ( $ data , JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ) ; } | Calculates the hash of the specified data array . |
5,149 | protected function setPostcode ( string $ postcode ) : void { if ( ! preg_match ( self :: POSTCODE_FORMAT , $ postcode ) ) { throw new InvalidArgumentException ( 'Postcode must match the expected format: ' . self :: POSTCODE_FORMAT ) ; } $ this -> postcode = $ postcode ; } | Set postcode . |
5,150 | public function merge ( $ entity ) { if ( ! $ this -> merged -> contains ( $ entity ) ) { $ this -> merged -> add ( $ entity ) ; } if ( $ this -> removed -> contains ( $ entity ) ) { $ this -> removed -> removeElement ( $ entity ) ; } if ( $ this -> detached -> contains ( $ entity ) ) { $ this -> detached -> removeElem... | Der Parameter von merge wird nicht im EntityManager persisted |
5,151 | protected function substituteVars ( Config $ config , $ prefix = '{' , $ suffix = '}' ) { $ arrayConfig = $ config -> toArray ( ) ; if ( isset ( $ arrayConfig [ 'variables' ] ) ) { $ vars = array_map ( function ( $ x ) use ( $ prefix , $ suffix ) { return $ prefix . $ x . $ suffix ; } , array_keys ( $ arrayConfig [ 'va... | Substitute defined variables if any found and return the new configuration object |
5,152 | protected function getCommandConfig ( Config $ config , $ command ) { $ string = '' ; if ( isset ( $ config [ $ command ] ) ) { $ config = $ config [ $ command ] ; if ( $ config -> count ( ) > 0 ) { $ config = $ config -> toArray ( ) ; $ string .= $ this -> commands [ $ command ] . PHP_EOL . '{' . PHP_EOL . "\t" ; $ st... | Creates the config part of the specified command |
5,153 | private function getValuesString ( array $ values , $ tab = true ) { $ glue = $ tab ? PHP_EOL . "\t" : PHP_EOL ; return implode ( $ glue , array_map ( function ( $ key ) use ( $ values , $ glue ) { if ( ! is_array ( $ values [ $ key ] ) ) { $ return = $ key . ' = ' . $ values [ $ key ] ; } else { $ return = implode ( $... | Construct a string representation from configuration associative values |
5,154 | protected function getSectionConfig ( Config $ config , $ section ) { $ string = '' ; if ( isset ( $ config [ $ section ] ) ) { $ config = $ config [ $ section ] ; if ( $ config -> count ( ) > 0 ) { foreach ( $ config as $ name => $ values ) { if ( $ values -> count ( ) > 0 ) { $ string .= $ this -> sections [ $ sectio... | Creates the config parts of the specified section |
5,155 | protected function _arrayInclude ( $ path , array $ options = [ ] , $ type = 'css' ) { $ doc = $ this -> Document ; if ( is_array ( $ path ) ) { $ out = '' ; foreach ( $ path as $ i ) { $ out .= $ this -> { $ type } ( $ i , $ options ) ; } if ( empty ( $ options [ 'block' ] ) ) { return $ out . $ doc -> eol ; } return ... | Include array paths . |
5,156 | protected function _getCssOutput ( array $ options , $ url ) { if ( $ options [ 'rel' ] === 'import' ) { return $ this -> formatTemplate ( 'style' , [ 'attrs' => $ this -> templater ( ) -> formatAttributes ( $ options , [ 'rel' , 'block' , 'weight' , 'alias' ] ) , 'content' => '@import url(' . $ url . ');' , ] ) ; } re... | Get current css output . |
5,157 | protected function _getCurrentUrlAndOptions ( $ path , array $ options , $ type , $ external ) { if ( strpos ( $ path , '//' ) !== false ) { $ url = $ path ; $ external = true ; unset ( $ options [ 'fullBase' ] ) ; } else { $ url = $ this -> Url -> { $ type } ( $ path , $ options ) ; $ options = array_diff_key ( $ opti... | Get current options and url asset . |
5,158 | protected function _getScriptOutput ( array $ options , $ url ) { return $ this -> formatTemplate ( 'javascriptlink' , [ 'url' => $ url , 'attrs' => $ this -> templater ( ) -> formatAttributes ( $ options , [ 'block' , 'once' , 'weight' , 'alias' ] ) , ] ) ; } | Get current script output . |
5,159 | protected function _getTypeOutput ( array $ options , $ url , $ type ) { $ type = Str :: low ( $ type ) ; if ( $ type === 'css' ) { return $ this -> _getCssOutput ( $ options , $ url ) ; } return $ this -> _getScriptOutput ( $ options , $ url ) ; } | Get current output by type . |
5,160 | protected function _hasAsset ( $ path , $ type , $ external ) { return ! $ this -> Url -> assetPath ( $ path , $ this -> _getAssetType ( $ type ) ) && $ external === false ; } | Check has asset . |
5,161 | protected function _include ( $ path , array $ options = [ ] , $ type = 'css' ) { $ doc = $ this -> Document ; $ options += [ 'once' => true , 'block' => null , 'fullBase' => true , 'weight' => 10 ] ; $ external = false ; $ assetArray = $ this -> _arrayInclude ( $ path , $ options , $ type ) ; if ( $ assetArray ) { ret... | Include asset . |
5,162 | protected function _isOnceIncluded ( $ path , $ type , array $ options = [ ] ) { return $ options [ 'once' ] && isset ( $ this -> _includedAssets [ $ type ] [ $ path ] ) ; } | Check asset on once include . |
5,163 | public function finish ( ) { $ response = $ this -> client -> post ( "{$this->uriImport}fullimport/finish" , [ 'query' => [ 'key' => $ this -> config [ 'data' ] [ 'key' ] , ] , ] ) ; $ response = json_decode ( $ response -> getBody ( ) , true ) ; return isset ( $ response [ 'status' ] ) && $ response [ 'status' ] === '... | Close import queue . |
5,164 | public static function send ( Swift_Message $ message , Swift_SmtpTransport $ transport = NULL , Swift_Mailer $ mailer = NULL ) { if ( ! isset ( $ transport ) && ! isset ( $ mailer ) ) { if ( Config :: req ( 'mail.smtp.user' ) != NULL ) { $ transport = Swift_SmtpTransport :: newInstance ( 'smtprelaypool.ispgateway.de' ... | Sendet die Message |
5,165 | protected function allowHighlightTag ( BladeCompiler $ compiler ) { $ compiler -> directive ( 'highlight' , function ( $ expression ) { if ( is_null ( $ expression ) ) { $ expression = "('php')" ; } return "<?php \$__env->startSection{$expression}; ?>" ; } ) ; $ compiler -> directive ( 'endhighlight' , function ( ) { r... | Add basic syntax highlighting . |
5,166 | protected function getAdapter ( $ context ) { return $ this -> context === $ context || $ context === NULL ? $ this : new static ( $ this -> entityMeta , $ context ) ; } | Erstellt einen neuen MetaAdapter im richtigen Context |
5,167 | public function getHashtagMessages ( $ name , $ offset = 0 , $ length = 10 ) { if ( ! $ name ) { throw new Exception ( 'Please specify a tag name' ) ; } return $ this -> execute ( 'GET' , '/maniaflash/hashtags/%s/messages/?offset=%d&length=%d' , array ( $ name , $ offset , $ length ) ) ; } | Return latest messages of an hashtag |
5,168 | public function getMessages ( $ id , $ offset = 0 , $ length = 10 ) { if ( ! $ id ) { throw new Exception ( 'Invalid id' ) ; } return $ this -> execute ( 'GET' , '/maniaflash/channels/%s/messages/?offset=%d&length=%d' , array ( $ id , $ offset , $ length ) ) ; } | Return latest messages of a channel |
5,169 | public function postMessage ( $ channelId , $ message , $ longMessage = null , $ mediaURL = null ) { return $ this -> execute ( 'POST' , '/maniaflash/channels/%s/' , array ( $ channelId , array ( 'message' => $ message , 'longMessage' => $ longMessage , 'mediaURL' => $ mediaURL ) ) ) ; } | Publish a message on a maniaflash channel |
5,170 | private function data ( $ view ) { $ data [ 'var' ] = $ this -> module -> get ( 'var' ) ; if ( isset ( $ view [ 'with' ] ) ) { foreach ( ( array ) $ view [ 'with' ] as $ name => $ value ) { $ data [ 'var' ] [ $ name ] = $ value ; } } $ data [ 'file' ] = $ this -> getPath ( $ view , $ this -> module -> get ( 'module' ) ... | Prepare the data path for the requested view |
5,171 | private function load ( $ view ) { $ data = $ this -> data ( $ view ) ; if ( file_exists ( $ data [ 'file' ] ) ) { extract ( $ data [ 'var' ] ) ; require $ data [ 'file' ] ; } } | View the file to the controller |
5,172 | private function getPath ( $ view , $ module ) { if ( isset ( $ module ) ) { if ( isset ( $ view [ 'from' ] ) ) { return realpath ( dirname ( $ module [ 'path' ] ) . '/' . $ view [ 'from' ] . '/Views/' . $ view [ 'name' ] . '.php' ) ; } else { return realpath ( $ module [ 'path' ] . '/Views/' . $ view [ 'name' ] . '.ph... | Get file path for the requested view name |
5,173 | public static function has_action ( $ path , $ action = null ) { $ path = CCStr :: cut ( $ path , '@' ) ; $ path = CCStr :: cut ( $ path , '?' ) ; if ( ! is_string ( $ path ) ) { return false ; } if ( is_null ( $ action ) ) { $ action = static :: $ _default_action ; } if ( ! $ controller = static :: create ( $ path ) )... | check if a controller implements an action |
5,174 | public function checkContainerForWrite ( $ container ) { $ container = static :: addContainerToName ( $ container , '' ) ; if ( ! is_dir ( $ container ) ) { if ( ! mkdir ( $ container , 0777 , true ) ) { throw new InternalServerErrorException ( 'Failed to create container.' ) ; } } } | Creates the container for this file management if it does not already exist |
5,175 | public function createContainer ( $ properties = [ ] , $ check_exist = false ) { $ container = array_get ( $ properties , 'name' , array_get ( $ properties , 'path' ) ) ; if ( empty ( $ container ) ) { throw new BadRequestException ( 'No name found for container in create request.' ) ; } if ( $ this -> folderExists ( $... | Create a container using properties where at least name is required |
5,176 | public function createContainers ( $ containers = [ ] , $ check_exist = false ) { if ( empty ( $ containers ) ) { return [ ] ; } $ out = [ ] ; foreach ( $ containers as $ key => $ folder ) { try { $ out [ $ key ] = $ this -> createContainer ( $ folder , $ check_exist ) ; } catch ( \ Exception $ ex ) { $ out [ $ key ] [... | Create multiple containers using array of properties where at least name is required |
5,177 | public static function listTree ( $ root , $ prefix = '' , $ delimiter = '' ) { $ dir = $ root . ( ( ! empty ( $ prefix ) ) ? $ prefix : '' ) ; $ out = [ ] ; if ( is_dir ( $ dir ) ) { $ files = array_diff ( scandir ( $ dir ) , [ '.' , '..' ] ) ; foreach ( $ files as $ file ) { $ key = $ dir . $ file ; $ local = ( ( ! e... | List folders and files |
5,178 | public static function install ( Compiler $ parser ) { $ me = new static ( $ parser ) ; $ callback = array ( $ me , 'macroGettext' ) ; $ me -> addMacro ( '_' , $ callback ) ; $ me -> addMacro ( '_n' , $ callback ) ; $ me -> addMacro ( '_p' , $ callback ) ; $ me -> addMacro ( '_np' , $ callback ) ; } | Add gettext macros |
5,179 | public static function registerHelpers ( Template $ template , ITranslator $ translator ) { $ template -> registerHelper ( 'gettext' , array ( $ translator , 'gettext' ) ) ; $ template -> registerHelper ( 'ngettext' , array ( $ translator , 'ngettext' ) ) ; $ template -> registerHelper ( 'pgettext' , array ( $ translat... | Add gettext helpers to template . |
5,180 | public static function doSelectJoinAll ( Criteria $ criteria , $ con = null , $ join_behavior = Criteria :: LEFT_JOIN ) { $ criteria = clone $ criteria ; if ( $ criteria -> getDbName ( ) == Propel :: getDefaultDB ( ) ) { $ criteria -> setDbName ( UserRolePeer :: DATABASE_NAME ) ; } UserRolePeer :: addSelectColumns ( $ ... | Selects a collection of UserRole objects pre - filled with all related objects . |
5,181 | public static function doUpdate ( $ values , PropelPDO $ con = null ) { if ( $ con === null ) { $ con = Propel :: getConnection ( UserRolePeer :: DATABASE_NAME , Propel :: CONNECTION_WRITE ) ; } $ selectCriteria = new Criteria ( UserRolePeer :: DATABASE_NAME ) ; if ( $ values instanceof Criteria ) { $ criteria = clone ... | Performs an UPDATE on the database given a UserRole or Criteria object . |
5,182 | public static function retrieveByPK ( $ user_id , $ role_id , PropelPDO $ con = null ) { $ _instancePoolKey = serialize ( array ( ( string ) $ user_id , ( string ) $ role_id ) ) ; if ( null !== ( $ obj = UserRolePeer :: getInstanceFromPool ( $ _instancePoolKey ) ) ) { return $ obj ; } if ( $ con === null ) { $ con = Pr... | Retrieve object using using composite pkey values . |
5,183 | public function ddl ( Collection $ collection ) { if ( ! empty ( $ this -> options [ 'autoddl' ] ) ) { $ sql = $ this -> dialect -> grammarDDL ( $ collection , $ this -> options [ 'autoddl' ] ) ; $ this -> execute ( $ sql ) ; } } | DDL runner for collection |
5,184 | public function write ( $ path , $ contents , Config $ config ) { $ tempfile = tmpfile ( ) ; fwrite ( $ tempfile , $ contents ) ; $ uploaded_metadata = $ this -> writeStream ( $ path , $ tempfile , $ config ) ; return $ uploaded_metadata ; } | Write a new file . Create temporary stream with content . Pass to writeStream . |
5,185 | public function rename ( $ path , $ newpath ) { $ pathinfo = pathinfo ( $ path ) ; if ( $ pathinfo [ 'dirname' ] != '.' ) { $ path_remote = $ pathinfo [ 'dirname' ] . '/' . $ pathinfo [ 'filename' ] ; } else { $ path_remote = $ pathinfo [ 'filename' ] ; } $ newpathinfo = pathinfo ( $ newpath ) ; if ( $ newpathinfo [ 'd... | Rename a file . Paths without extensions . |
5,186 | public function copy ( $ path , $ newpath ) { $ url = cloudinary_url_internal ( $ path ) ; $ result = Uploader :: upload ( $ url , [ 'public_id' => $ newpath ] ) ; return is_array ( $ result ) ? $ result [ 'public_id' ] == $ newpath : false ; } | Copy a file . Copy content from existing url . |
5,187 | public function has ( $ path ) { try { $ this -> api -> resource ( $ path ) ; } catch ( Exception $ e ) { return false ; } return true ; } | Check whether a file exists . Using url to check response headers . Maybe I should use api resource? |
5,188 | protected function prepareResourceMetadata ( $ resource ) { $ resource [ 'type' ] = 'file' ; $ resource [ 'path' ] = $ resource [ 'public_id' ] ; $ resource = array_merge ( $ resource , $ this -> prepareSize ( $ resource ) ) ; $ resource = array_merge ( $ resource , $ this -> prepareTimestamp ( $ resource ) ) ; $ resou... | Prepare apropriate metadata for resource metadata given from cloudinary . |
5,189 | public function init ( ) { $ this -> assets = array ( 'js' => YII_DEBUG ? 'foundation/foundation.section.js' : 'foundation.min.js' ) ; Html :: addCssClass ( $ this -> htmlOptions , Enum :: SECTION_CONTAINER ) ; Html :: addCssClass ( $ this -> htmlOptions , $ this -> style ) ; ArrayHelper :: addValue ( 'data-section' , ... | Initilizes the widget |
5,190 | public function renderSection ( ) { $ sections = array ( ) ; foreach ( $ this -> items as $ item ) { $ sections [ ] = $ this -> renderItem ( $ item ) ; } return \ CHtml :: tag ( 'div' , $ this -> htmlOptions , implode ( "\n" , $ sections ) ) ; } | Renders the section |
5,191 | public function renderItem ( $ item ) { $ sectionItem = array ( ) ; $ sectionItem [ ] = \ CHtml :: tag ( 'p' , array ( 'class' => 'title' , 'data-section-title' => 'data-section-title' ) , \ CHtml :: link ( ArrayHelper :: getValue ( $ item , 'label' , 'Section Title' ) , '#' ) ) ; $ options = ArrayHelper :: getValue ( ... | Renders a section item |
5,192 | public function camelToSnake ( ) : Manipulator { $ modifiedString = '' ; foreach ( str_split ( $ this -> string , 1 ) as $ character ) { $ modifiedString .= ctype_upper ( $ character ) ? '_' . $ character : $ character ; } return new static ( mb_strtolower ( $ modifiedString ) ) ; } | Convert a camel - case string to snake - case . |
5,193 | public function eachCharacter ( \ Closure $ closure ) : Manipulator { $ modifiedString = '' ; foreach ( str_split ( $ this -> string ) as $ character ) { $ modifiedString .= $ closure ( $ character ) ; } return new static ( $ modifiedString ) ; } | Perform an action on each character in the string . |
5,194 | public function eachWord ( \ Closure $ closure , bool $ preserveSpaces = false ) : Manipulator { $ modifiedString = '' ; foreach ( explode ( ' ' , $ this -> string ) as $ word ) { $ modifiedString .= $ closure ( $ word ) ; $ modifiedString .= $ preserveSpaces ? ' ' : '' ; } return new static ( trim ( $ modifiedString )... | Perform an action on each word in the string . |
5,195 | public function getPossessive ( ) : Manipulator { $ modifiedString = $ this -> trimEnd ( ) ; if ( mb_substr ( $ modifiedString , - 1 ) === 's' ) { $ modifiedString .= '\'' ; } else { $ modifiedString .= '\'s' ; } return new static ( $ modifiedString ) ; } | Get Possessive Version of String |
5,196 | public function htmlEntitiesDecode ( $ flags = ENT_HTML5 , string $ encoding = 'UTF-8' ) : Manipulator { return new static ( html_entity_decode ( $ this -> string , $ flags , $ encoding ) ) ; } | Decode HTML Entities |
5,197 | public function htmlSpecialCharacters ( $ flags = ENT_HTML5 , string $ encoding = 'UTF-8' , bool $ doubleEncode = true ) : Manipulator { return new static ( htmlspecialchars ( $ this -> string , $ flags , $ encoding , $ doubleEncode ) ) ; } | HTML Special Characters |
5,198 | public function nthCharacter ( int $ nth , \ Closure $ closure ) : Manipulator { $ count = 1 ; $ modifiedString = '' ; foreach ( str_split ( $ this -> string ) as $ character ) { $ modifiedString .= $ count === $ nth ? $ closure ( $ character ) : $ character ; $ count ++ ; } return new static ( $ modifiedString ) ; } | Perfrom an action on the nth character . |
5,199 | public function nthWord ( int $ nth , \ Closure $ closure , bool $ preserveSpaces = true ) : Manipulator { $ count = 1 ; $ modifiedString = '' ; foreach ( explode ( ' ' , $ this -> string ) as $ word ) { $ modifiedString .= $ count === $ nth ? $ closure ( $ word ) : $ word ; $ modifiedString .= $ preserveSpaces ? ' ' :... | Perform an action on the nth word . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.