idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
16,500 | public function deleteGroup ( EventInterface $ event ) { $ accessControl = $ event -> getAccessControl ( ) ; if ( ! ( $ accessControl instanceof MutableAdapterInterface ) ) { throw new ResourceException ( 'Access control adapter is immutable' , 405 ) ; } $ route = $ event -> getRequest ( ) -> getRoute ( ) ; $ groupName... | Delete a resource group |
16,501 | public function readImageBlob ( EventInterface $ event ) { $ eventName = $ event -> getName ( ) ; $ config = $ event -> getConfig ( ) ; $ jpegSizeHintEnabled = $ config [ 'optimizations' ] [ 'jpegSizeHint' ] ; if ( $ event -> hasArgument ( 'image' ) ) { $ image = $ event -> getArgument ( 'image' ) ; } else if ( $ event... | Inject the image blob from the image model into the shared imagick instance |
16,502 | public function updateModelBeforeStoring ( EventInterface $ event ) { $ image = $ event -> getRequest ( ) -> getImage ( ) ; if ( $ image -> hasBeenTransformed ( ) ) { $ image -> setBlob ( $ this -> imagick -> getImageBlob ( ) ) ; } } | Update the image model blob before storing it in case an event listener has changed the image |
16,503 | public function updateModel ( EventInterface $ event ) { $ image = $ event -> getArgument ( 'image' ) ; if ( $ image -> hasBeenTransformed ( ) ) { $ image -> setBlob ( $ this -> imagick -> getImageBlob ( ) ) ; } } | Update the model data if the image has been changed |
16,504 | public static function createFromException ( Exception $ exception , Request $ request ) { $ date = new DateTime ( 'now' , new DateTimeZone ( 'UTC' ) ) ; $ model = new self ( ) ; $ model -> setHttpCode ( $ exception -> getCode ( ) ) -> setErrorMessage ( $ exception -> getMessage ( ) ) -> setDate ( $ date ) -> setImboEr... | Create an error based on an exception instance |
16,505 | public function deleteShortUrl ( EventInterface $ event ) { $ database = $ event -> getDatabase ( ) ; $ request = $ event -> getRequest ( ) ; $ user = $ request -> getUser ( ) ; $ imageIdentifier = $ request -> getImageIdentifier ( ) ; $ shortUrlId = $ request -> getRoute ( ) -> get ( 'shortUrlId' ) ; if ( ! $ params =... | Delete a single short URL |
16,506 | public function getKey ( EventInterface $ event ) { $ acl = $ event -> getAccessControl ( ) ; $ publicKey = $ event -> getRequest ( ) -> getRoute ( ) -> get ( 'publickey' ) ; if ( ! $ acl -> publicKeyExists ( $ publicKey ) ) { throw new RuntimeException ( 'Public key not found' , 404 ) ; } } | Get a public key but return only status code not private key information |
16,507 | public function setKey ( EventInterface $ event ) { $ acl = $ event -> getAccessControl ( ) ; if ( ! ( $ acl instanceof MutableAdapterInterface ) ) { throw new ResourceException ( 'Access control adapter is immutable' , 405 ) ; } $ request = $ event -> getRequest ( ) ; $ data = json_decode ( $ request -> getContent ( )... | Add or update public key |
16,508 | public function deleteKey ( EventInterface $ event ) { $ acl = $ event -> getAccessControl ( ) ; if ( ! ( $ acl instanceof MutableAdapterInterface ) ) { throw new ResourceException ( 'Access control adapter is immutable' , 405 ) ; } $ request = $ event -> getRequest ( ) ; $ publicKey = $ request -> getRoute ( ) -> get ... | Delete public key |
16,509 | public function map ( array $ configuration ) { $ sqliteConfig = [ 'driver' => 'pdo_sqlite' , 'user' => @ $ configuration [ 'username' ] , 'password' => @ $ configuration [ 'password' ] , 'prefix' => @ $ configuration [ 'prefix' ] ? $ configuration [ 'prefix' ] : null ] ; $ this -> databaseLocation ( $ configuration , ... | Map the L4 configuration array to a sqlite - friendly doctrine configuration . |
16,510 | public function map ( $ configuration ) { foreach ( $ this -> mappers as $ mapper ) if ( $ mapper -> isAppropriateFor ( $ configuration ) ) return $ mapper -> map ( $ configuration ) ; throw new Exception ( "Driver {$configuration['driver']} unsupported by package at this time." ) ; } | Map the Laravel configuration to a configuration driver return the result . |
16,511 | public function sendHeaders ( $ archiveName = 'archive.zip' , $ contentType = 'application/zip' ) { $ headerFile = null ; $ headerLine = null ; if ( ! headers_sent ( $ headerFile , $ headerLine ) or die ( "<p><strong>Error:</strong> Unable to send file " . "$archiveName. HTML Headers have already been sent from " . "<s... | Send appropriate http headers before streaming the zip file and disable output buffering . This method if used has to be called before adding anything to the zip file . |
16,512 | public function addEmptyDir ( $ directoryPath , $ options = NULL ) { if ( $ this -> isFinalized ) { return false ; } $ defaultOptions = array ( 'timestamp' => NULL , 'comment' => NULL , ) ; if ( is_null ( $ options ) ) { $ options = array ( ) ; } $ options = array_merge ( $ defaultOptions , $ options ) ; $ directoryPat... | Add an empty directory entry to the zip archive . |
16,513 | public function finalize ( ) { if ( ! $ this -> isFinalized ) { $ cd = implode ( '' , $ this -> cdRec ) ; $ this -> write ( $ cd ) ; if ( $ this -> zip64 ) { $ this -> write ( $ this -> buildZip64EndOfCentralDirectoryRecord ( strlen ( $ cd ) ) ) ; $ this -> write ( $ this -> buildZip64EndOfCentralDirectoryLocator ( str... | Close the archive . A closed archive can no longer have new files added to it . After closing the zip file is completely written to the output stream . |
16,514 | public function map ( array $ configuration ) { return [ 'driver' => $ this -> driver ( $ configuration [ 'driver' ] ) , 'host' => $ configuration [ 'host' ] , 'dbname' => $ configuration [ 'database' ] , 'user' => $ configuration [ 'username' ] , 'password' => $ configuration [ 'password' ] , 'charset' => $ configurat... | Creates the configuration mapping for SQL database engines including SQL server MySQL and PostgreSQL . |
16,515 | private function registerConfigurationMapper ( ) { $ this -> app -> bind ( DriverMapper :: class , function ( ) { $ mapper = new DriverMapper ; $ mapper -> registerMapper ( new SqlMapper ) ; $ mapper -> registerMapper ( new SqliteMapper ) ; $ mapper -> registerMapper ( new OCIMapper ) ; return $ mapper ; } ) ; } | The driver mapper s instance needs to be accessible from anywhere in the application for registering new mapping configurations or other storage libraries . |
16,516 | private function mapLaravelToDoctrineConfig ( $ config ) { $ default = $ config [ 'database.default' ] ; $ connection = $ config [ "database.connections.{$default}" ] ; return App :: make ( DriverMapper :: class ) -> map ( $ connection ) ; } | Map Laravel s to Doctrine s database configuration requirements . |
16,517 | public function map ( array $ configuration ) { $ defaults = [ 'pooled' => false ] ; $ optional = [ 'servicename' , 'instancename' ] ; foreach ( $ optional as $ opt ) { if ( isset ( $ configuration [ $ opt ] ) ) $ defaults [ $ opt ] = $ configuration [ $ opt ] ; } return array_merge ( $ defaults , [ 'driver' => $ this ... | Creates the configuration mapping for Oracle databases |
16,518 | private function createQueryFrom ( array $ queryParts = [ ] ) { $ rsm = new ResultSetMapping ( ) ; return $ this -> entityManager -> createNativeQuery ( implode ( ' ' , $ queryParts ) , $ rsm ) ; } | Creates a new Doctrine native query based on the query parts array . |
16,519 | static function transform ( $ modelOrCollection , $ options = [ ] ) { $ static = new static ( $ options ) ; if ( $ modelOrCollection instanceof Collection ) { return $ modelOrCollection -> map ( [ $ static , 'transformModel' ] ) -> toArray ( ) ; } return $ static -> transformModel ( $ modelOrCollection ) ; } | Transform a Model or a Collection . |
16,520 | protected function isLoadedFromPivotTable ( Model $ item , $ tableName ) { return $ item -> pivot && $ item -> pivot -> getTable ( ) == $ tableName ; } | Check if the model instance is loaded from the provided pivot table . |
16,521 | protected function processRowsHeads ( ) { $ cols = $ this -> getCols ( ) ; $ this -> data = $ this -> rows ; if ( ! empty ( $ cols ) ) { array_unshift ( $ this -> data , $ cols ) ; } return $ this -> data ; } | processing rows and there heads |
16,522 | public function render ( ) { $ this -> setId ( ) ; $ id = $ this -> id ; $ this -> processRowsHeads ( ) ; return view ( 'LaravelGoogleChart::' . $ this -> getChartType ( ) ) -> with ( [ 'options' => $ this -> options , 'id' => $ this -> id , 'data' => $ this -> data ] ) -> render ( ) ; } | genrate Google chart |
16,523 | protected function navButton ( $ button_type , $ step , $ button_id ) { $ options = [ 'id' => $ button_id . $ button_type ] ; if ( isset ( $ this -> default_buttons [ $ button_type ] [ 'options' ] ) ) { $ options = array_merge ( $ options , $ this -> default_buttons [ $ button_type ] [ 'options' ] ) ; } if ( isset ( $ ... | Generate navigation button |
16,524 | public function loginUsingId ( $ userId ) { $ guard = config ( 'autologin.guard' ) ; if ( $ user = Auth :: guard ( $ guard ) -> getProvider ( ) -> retrieveById ( $ userId ) ) { Auth :: guard ( $ guard ) -> login ( $ user ) ; return $ user ; } return null ; } | Log a user in through the Laravel Auth facade through their user id . |
16,525 | public function autologin ( $ token ) { if ( $ autologin = $ this -> autologin -> validate ( $ token ) ) { if ( $ user = $ this -> authProvider -> loginUsingId ( $ autologin -> getUserId ( ) ) ) { return redirect ( $ autologin -> getPath ( ) ) ; } } return redirect ( '/' ) ; } | Process the autologin token and perform the redirect . |
16,526 | public function to ( Authenticatable $ user , $ path , $ extra = [ ] , $ secure = null ) { $ path = $ this -> generator -> to ( $ path , $ extra , $ secure ) ; return $ this -> getAutologinLink ( $ user , $ path ) ; } | Generate a link that will automatically login a user and then redirect them to a hard - coded path as generated by the URL generator . |
16,527 | public function route ( Authenticatable $ user , $ name , $ parameters = [ ] , $ absolute = true , $ route = null ) { $ path = $ this -> generator -> route ( $ name , $ parameters , $ absolute , $ route ) ; return $ this -> getAutologinLink ( $ user , $ path ) ; } | Generate a link that will automatically login a user and then redirect them to a named route as generated by the URL generator . |
16,528 | public function validate ( $ token ) { $ autologin = $ this -> provider -> findByToken ( $ token ) ; if ( $ autologin && $ this -> autologinValid ( $ autologin ) ) { if ( config ( 'autologin.count' ) ) { $ autologin -> incrementCount ( ) ; } return $ autologin ; } return null ; } | Validate a token from storage and return the row . |
16,529 | public function deleteExpiredTokens ( ) { $ lifetime = config ( 'autologin.lifetime' ) ; $ expiry = Carbon :: now ( ) -> subMinutes ( $ lifetime ) ; return $ this -> provider -> deleteExpiredTokens ( $ expiry ) ; } | Remove tokens that have expired from storage . |
16,530 | protected function getAutologinLink ( Authenticatable $ user , $ path = null ) { if ( $ this -> shouldDeleteExpiredTokens ( ) ) { $ this -> deleteExpiredTokens ( ) ; } $ userId = $ user -> getAuthIdentifier ( ) ; $ token = $ this -> getAutologinToken ( ) ; $ this -> provider -> create ( [ 'user_id' => $ userId , 'token... | Get the link that can be used to automatically login a user to the application . |
16,531 | protected function getAutologinToken ( ) { $ length = config ( 'autologin.length' ) ; do { $ token = Str :: random ( $ length ) ; } while ( $ this -> provider -> findByToken ( $ token ) ) ; return $ token ; } | Generate a random unique token using the length that is provided in the configuration file . |
16,532 | protected function autologinValid ( AutologinInterface $ autologin ) { if ( config ( 'autologin.remove_expired' ) ) { $ lifetime = config ( 'autologin.lifetime' ) ; if ( $ autologin -> created_at <= Carbon :: now ( ) -> subMinutes ( $ lifetime ) ) { $ autologin -> delete ( ) ; return false ; } } return true ; } | Determine whether the autologin token provided is valid and remove it if not . |
16,533 | public function loginUsingId ( $ userId ) { try { $ user = Sentry :: findUserById ( $ userId ) ; Sentry :: login ( $ user ) ; return $ user ; } catch ( UserNotFoundException $ e ) { return null ; } } | Log a user in through the Sentry facade through their user id . |
16,534 | protected function publishConfig ( ) { $ path = __DIR__ . '/../config/disqus.php' ; $ this -> mergeConfigFrom ( $ path , 'disqus' ) ; $ this -> publishes ( [ $ path => config_path ( 'disqus.php' ) , ] , 'disqus' ) ; } | Register and publish the config . |
16,535 | private function getPagination ( ) { $ this -> pagination [ 'page' ] = 1 ; $ this -> pagination [ 'per_page' ] = Utils :: findKey ( $ this -> options , 'limit' , 50 ) ; $ this -> pagination [ 'padding' ] = Utils :: findKey ( $ this -> options , 'padding' , 0 ) ; $ this -> pagination [ 'offset' ] = Utils :: findKey ( $ ... | Add requested pagination parameters to the payload |
16,536 | private function getHighlight ( ) { if ( Utils :: findKey ( $ this -> options , 'highlight' , false ) ) { foreach ( $ this -> fields as $ field ) { $ this -> payload [ 'highlight' ] [ 'fields' ] [ $ field ] = new StdClass ( ) ; } if ( $ tag = Utils :: findKey ( $ this -> options [ 'highlight' ] , 'tag' , false ) ) { $ ... | Add requested highlights to the payload |
16,537 | private function getSuggest ( ) { if ( $ suggestions = Utils :: findKey ( $ this -> options , 'suggest' , false ) ) { $ suggest_fields = Utils :: findKey ( $ this -> proxy -> getConfig ( ) , 'suggest' , [ ] ) ; if ( $ fields = Utils :: findKey ( $ this -> options , 'fields' , false ) ) { $ suggest_fields = array_inters... | Add requested suggestions to the payload |
16,538 | private function getSort ( ) { if ( $ sort = Utils :: findKey ( $ this -> options , 'sort' , false ) ) { $ this -> payload [ 'sort' ] = $ sort ; } } | Allow sorting of results |
16,539 | public function execute ( ) { $ this -> getFields ( ) ; $ this -> getPagination ( ) ; $ this -> getHighlight ( ) ; $ this -> getSuggest ( ) ; $ this -> getAggregations ( ) ; $ this -> getSort ( ) ; $ this -> getPayload ( ) ; $ params = [ 'index' => Utils :: findKey ( $ this -> options , 'index' , false ) ? : $ this -> ... | Execute the query and return the response in a rich wrapper class |
16,540 | public function searchByQuery ( $ query , $ options = [ ] ) { $ options = array_merge ( [ 'query' => $ query ] , $ options ) ; return App :: make ( 'iverberk.larasearch.query' , [ 'proxy' => $ this , 'term' => null , 'options' => $ options ] ) -> execute ( ) ; } | Performs a search based on a custom Elasticsearch query |
16,541 | public function searchById ( $ id ) { return App :: make ( 'iverberk.larasearch.response.result' , $ this -> config [ 'client' ] -> get ( [ 'index' => $ this -> getIndex ( ) -> getName ( ) , 'type' => $ this -> getType ( ) , 'id' => $ id ] ) ) ; } | Retrieves a single document by identifier |
16,542 | public function refreshDoc ( $ model ) { $ this -> config [ 'client' ] -> index ( [ 'id' => $ model -> getEsId ( ) , 'index' => $ this -> getIndex ( ) -> getName ( ) , 'type' => $ this -> getType ( ) , 'body' => $ model -> transform ( true ) ] ) ; } | Reindex a specific database record to Elasticsearch |
16,543 | public function deleteDoc ( $ id ) { $ this -> config [ 'client' ] -> delete ( [ 'id' => $ id , 'index' => $ this -> getIndex ( ) -> getName ( ) , 'type' => $ this -> getType ( ) ] ) ; } | Delete a specific database record within Elasticsearch |
16,544 | protected function checkDocHints ( $ docComment , $ model ) { if ( preg_match ( '/@follow\s+NEVER/' , $ docComment ) ) return false ; if ( preg_match ( '/@follow\s+UNLESS\s+' . str_replace ( '\\' , '\\\\' , get_class ( $ model ) ) . '\b/' , $ docComment ) ) { return false ; } if ( preg_match ( '/@follow\s+FROM\b/' , $ ... | Inspect the relation method annotations to see if we need to follow the relation |
16,545 | protected function getRelatedModels ( Model $ model ) { $ modelClass = get_class ( $ model ) ; if ( ! isset ( $ this -> relatedModels [ $ modelClass ] ) ) { $ relatedModels = [ ] ; $ methods = with ( new \ ReflectionClass ( $ model ) ) -> getMethods ( ) ; foreach ( $ methods as $ method ) { if ( $ method -> class == $ ... | Find related models from a base model |
16,546 | private function writeConfig ( ) { if ( $ this -> option ( 'write-config' ) ) { $ configFile = base_path ( ) . '/config/larasearch.php' ; if ( $ this -> getLaravel ( ) ) { if ( ! File :: exists ( $ configFile ) ) { if ( $ this -> confirm ( 'It appears that you have not yet published the larasearch config. Would you lik... | Write the paths config to a file or to standard output |
16,547 | protected function reindexModel ( Model $ model ) { $ mapping = $ this -> option ( 'mapping' ) ? json_decode ( File :: get ( $ this -> option ( 'mapping' ) ) , true ) : null ; $ this -> info ( '- . get_class ( $ model ) ) ; $ model -> reindex ( $ this -> option ( 'relations' ) , $ this -> option ( 'batch' ) , $ mapping... | Reindex a model to Elasticsearch |
16,548 | public function import ( Model $ model , $ relations = [ ] , $ batchSize = 750 , Callable $ callback = null ) { $ batch = 0 ; while ( true ) { $ batch += 1 ; $ records = $ model -> with ( $ relations ) -> skip ( $ batchSize * ( $ batch - 1 ) ) -> take ( $ batchSize ) -> get ( ) ; if ( count ( $ records ) == 0 ) break ;... | Import an Eloquent |
16,549 | public function setName ( $ name ) { $ index_prefix = Config :: get ( 'larasearch.elasticsearch.index_prefix' , '' ) ; if ( $ index_prefix && ! Str :: startsWith ( $ name , $ index_prefix ) ) $ name = $ index_prefix . $ name ; $ this -> name = $ name ; return $ this ; } | Set index name |
16,550 | public function aliasExists ( $ alias ) { $ index_prefix = Config :: get ( 'larasearch.elasticsearch.index_prefix' , '' ) ; if ( $ index_prefix && ! Str :: startsWith ( $ alias , $ index_prefix ) ) $ alias = $ index_prefix . $ alias ; return self :: getClient ( ) -> indices ( ) -> existsAlias ( [ 'name' => $ alias ] ) ... | Check if an alias exists |
16,551 | public function store ( $ record ) { $ params [ 'index' ] = $ this -> getName ( ) ; $ params [ 'type' ] = $ record [ 'type' ] ; $ params [ 'id' ] = $ record [ 'id' ] ; $ params [ 'body' ] = $ record [ 'data' ] ; self :: getClient ( ) -> index ( $ params ) ; } | Store a record in the index |
16,552 | public function retrieve ( $ record ) { $ params [ 'index' ] = $ this -> getName ( ) ; $ params [ 'type' ] = $ record [ 'type' ] ; $ params [ 'id' ] = $ record [ 'id' ] ; self :: getClient ( ) -> get ( $ params ) ; } | Retrieve a record from the index |
16,553 | public function remove ( $ record ) { $ params [ 'index' ] = $ this -> getName ( ) ; $ params [ 'type' ] = $ record [ 'type' ] ; $ params [ 'id' ] = $ record [ 'id' ] ; self :: getClient ( ) -> delete ( $ params ) ; } | Remove a record from the index |
16,554 | public function tokens ( $ text , $ options = [ ] ) { self :: getClient ( ) -> indices ( ) -> analyze ( array_merge ( [ 'index' => $ this -> getName ( ) , 'text' => $ text ] , $ options ) ) ; } | Inspect tokens returned from the analyzer |
16,555 | public static function refresh ( $ index ) { $ index_prefix = Config :: get ( 'larasearch.elasticsearch.index_prefix' , '' ) ; if ( $ index_prefix && ! Str :: startsWith ( $ index , $ index_prefix ) ) $ index = $ index_prefix . $ index ; return self :: getClient ( ) -> indices ( ) -> refresh ( [ 'index' => $ index ] ) ... | Refresh an index |
16,556 | private function getDefaultIndexParams ( ) { $ analyzers = Config :: get ( 'larasearch.elasticsearch.analyzers' ) ; $ params = Config :: get ( 'larasearch.elasticsearch.defaults.index' ) ; $ mapping = [ ] ; $ mapping_options = array_combine ( $ analyzers , array_map ( function ( $ type ) { $ config = $ this -> getProxy... | Initialize the default index settings and mappings |
16,557 | public static function getProxy ( ) { if ( ! static :: $ __es_proxy ) { $ instance = new static ; if ( $ instance instanceof Model ) { static :: $ __es_proxy = App :: make ( 'iverberk.larasearch.proxy' , $ instance ) ; return static :: $ __es_proxy ; } else { throw new \ Exception ( "This trait can ony be used in Eloqu... | Return an instance of the Elasticsearch proxy |
16,558 | public function deleted ( Model $ model ) { Queue :: push ( 'Iverberk\Larasearch\Jobs\DeleteJob' , [ get_class ( $ model ) . ':' . $ model -> getKey ( ) ] ) ; Queue :: push ( 'Iverberk\Larasearch\Jobs\ReindexJob' , $ this -> findAffectedModels ( $ model , true ) ) ; } | Model delete event handler |
16,559 | public function saved ( Model $ model ) { if ( $ model :: $ __es_enable && $ model -> shouldIndex ( ) ) { Queue :: push ( 'Iverberk\Larasearch\Jobs\ReindexJob' , $ this -> findAffectedModels ( $ model ) ) ; } } | Model save event handler |
16,560 | private function findAffectedModels ( Model $ model , $ excludeCurrent = false ) { $ affectedModels = [ ] ; $ paths = Config :: get ( 'larasearch.reversedPaths.' . get_class ( $ model ) , [ ] ) ; foreach ( ( array ) $ paths as $ path ) { if ( ! empty ( $ path ) ) { $ model = $ model -> load ( $ path ) ; $ path = explod... | Find all searchable models that are affected by the model change |
16,561 | public static function findKey ( $ params , $ arg , $ default = null ) { if ( is_object ( $ params ) === true ) { $ params = ( array ) $ params ; } if ( isset ( $ params [ $ arg ] ) === true ) { $ val = $ params [ $ arg ] ; unset ( $ params [ $ arg ] ) ; return $ val ; } else { return $ default ; } } | Read and return parameters from an array . |
16,562 | public function transform ( $ relations = false ) { $ relations = $ relations ? Config :: get ( 'larasearch.paths.' . get_class ( $ this ) ) : [ ] ; $ doc = $ this -> load ( $ relations ) -> toArray ( ) ; return $ doc ; } | Transform the Person model and its relations to an Elasticsearch document . |
16,563 | protected function appendDisqusScript ( $ request , $ response ) { $ content = $ response -> getContent ( ) ; if ( ! Str :: contains ( $ content , '<div id="disqus_thread"></div>' ) ) { return ; } $ uri = $ request -> getRequestUri ( ) ; $ pageUrl = url ( $ uri ) ; $ pageId = 'route' . implode ( '.' , explode ( '/' , $... | Append disqus script on the end of the page . |
16,564 | public function bootContainerBindings ( ) { $ this -> bindElasticsearch ( ) ; $ this -> bindLogger ( ) ; $ this -> bindIndex ( ) ; $ this -> bindQuery ( ) ; $ this -> bindProxy ( ) ; $ this -> bindResult ( ) ; } | Boot the container bindings . |
16,565 | protected function bindElasticsearch ( ) { $ this -> app -> singleton ( 'Elasticsearch' , function ( $ app ) { return new Client ( \ Illuminate \ Support \ Facades \ Config :: get ( 'larasearch.elasticsearch.params' ) ) ; } ) ; } | Bind the Elasticsearch client to the container |
16,566 | protected function bindIndex ( ) { $ this -> app -> bind ( 'iverberk.larasearch.index' , function ( $ app , $ params ) { $ name = isset ( $ params [ 'name' ] ) ? $ params [ 'name' ] : '' ; return new Index ( $ params [ 'proxy' ] , $ name ) ; } ) ; } | Bind the Larasearch index to the container |
16,567 | protected function bindQuery ( ) { $ this -> app -> bind ( 'iverberk.larasearch.query' , function ( $ app , $ params ) { return new Query ( $ params [ 'proxy' ] , $ params [ 'term' ] , $ params [ 'options' ] ) ; } ) ; } | Bind the Larasearch Query to the container |
16,568 | public function getSavedFile ( ) { if ( $ this -> savedAttribute && $ this -> owner -> { $ this -> savedAttribute } ) { return FileModel :: findOne ( $ this -> owner -> { $ this -> savedAttribute } ) ; } } | Get saved file |
16,569 | public function beforeDelete ( $ event ) { $ oldId = $ this -> owner -> { $ this -> savedAttribute } ; if ( ( $ oldModel = FileModel :: findOne ( $ oldId ) ) !== null ) { $ event -> isValid = $ event -> isValid && $ oldModel -> delete ( ) ; } } | Event handler for beforeDelete |
16,570 | public function refreshMobileSession ( ) { try { $ response = $ this -> steamCommunity -> cURL ( 'https://api.steampowered.com/IMobileAuthService/GetWGToken/v0001' , null , [ 'access_token' => $ this -> oauth [ 'oauth_token' ] ] ) ; $ json = json_decode ( $ response , true ) ; $ this -> oauth [ 'wgtoken' ] = $ json [ '... | Refreshes the mobile session by retrieving new tokens . |
16,571 | public function acceptTrade ( TradeOffer $ tradeOffer ) { if ( ! $ tradeOffer -> isOurOffer ( ) ) { $ url = 'https://steamcommunity.com/tradeoffer/' . $ tradeOffer -> getTradeOfferId ( ) . '/accept' ; $ referer = 'https://steamcommunity.com/tradeoffer/' . $ tradeOffer -> getTradeOfferId ( ) . '/' ; $ params = [ 'sessio... | Accept a trade offer . |
16,572 | public function declineTrade ( TradeOffer $ tradeOffer ) { if ( ! $ tradeOffer -> isOurOffer ( ) ) { return $ this -> declineTradeById ( $ tradeOffer -> getTradeOfferId ( ) ) ; } return false ; } | Decline a trade offer . |
16,573 | public function declineTradeById ( $ tradeOfferId ) { $ url = 'https://steamcommunity.com/tradeoffer/' . $ tradeOfferId . '/decline' ; $ referer = 'https://steamcommunity.com/tradeoffer/' . $ tradeOfferId . '/' ; $ params = [ 'sessionid' => $ this -> steamCommunity -> getSessionId ( ) , 'serverid' => '1' ] ; $ response... | Decline a trade offer by its id . |
16,574 | public function cancelTrade ( TradeOffer $ tradeOffer ) { if ( $ tradeOffer -> isOurOffer ( ) ) { return $ this -> cancelTradeById ( $ tradeOffer -> getTradeOfferId ( ) ) ; } return false ; } | Cancel a trade offer . |
16,575 | public function getItems ( $ tradeOffer ) { if ( is_int ( $ tradeOffer ) ) { $ tradeOffer = $ this -> getTradeOfferViaAPI ( $ tradeOffer ) ; } if ( $ tradeOffer instanceof TradeOffer && $ tradeId = $ tradeOffer -> getTradeId ( ) ) { $ url = 'https://steamcommunity.com/trade/' . $ tradeId . '/receipt/' ; $ response = $ ... | Get the new assetid after a trade |
16,576 | public function createAccount ( $ email ) { $ captchaUrl = 'https://store.steampowered.com/join/' ; if ( is_null ( $ this -> captchaGID ) ) { $ captchaUrlResponse = $ this -> cURL ( $ captchaUrl ) ; $ pattern = '/<input(?:.*?)id=\"captchagid\"(?:.*)value=\"([^"]+).*>/i' ; preg_match ( $ pattern , $ captchaUrlResponse ,... | Create a new Steam account . |
16,577 | private function _createFile ( $ dir , $ name , $ ext ) { if ( ! empty ( $ this -> rootDir ) ) { if ( ! file_exists ( $ this -> _getFileDir ( $ dir ) ) ) { mkdir ( $ this -> _getFileDir ( $ dir ) , 0777 , true ) ; } if ( ! file_exists ( $ this -> _getFilePath ( $ dir , $ name , $ ext ) ) ) { if ( file_put_contents ( $ ... | The directory and file are created automatically . |
16,578 | public function registerApiKey ( $ domain = '' ) { $ this -> apiKeyDomain = $ domain ; $ this -> _setApiKey ( ) ; if ( empty ( $ this -> apiKey ) ) { throw new SteamException ( 'Could not register API key.' ) ; } return $ this -> apiKey ; } | In most cases you don t need to call this since an API key is registered automatically upon logging in as long as you have set the domain first . |
16,579 | public function fetchConfirmations ( ) { $ url = $ this -> generateConfirmationUrl ( ) ; $ confirmations = [ ] ; $ response = '' ; try { $ response = $ this -> mobileAuth -> steamCommunity ( ) -> cURL ( $ url ) ; } catch ( \ Exception $ ex ) { return $ confirmations ; } if ( strpos ( $ response , '<div>Nothing to confi... | Fetch list of confirmations . May need to retry more than once because of Steam occasionally not showing any confirmations . |
16,580 | public function getConfirmationTradeOfferId ( Confirmation $ confirmation ) { $ url = 'https://steamcommunity.com/mobileconf/details/' . $ confirmation -> getConfirmationId ( ) . '?' . $ this -> generateConfirmationQueryParams ( 'details' ) ; $ response = '' ; try { $ response = $ this -> mobileAuth -> steamCommunity (... | Get the trade offer ID of a confirmation . May need to retry more than once due to Steam occasionally failing to load the trade page . |
16,581 | public function getResults ( $ phrase , $ parameters = array ( ) ) { if ( $ phrase == '' ) { return array ( ) ; } if ( $ this -> engineId == '' ) { throw new \ Exception ( 'You must specify a engineId' ) ; } if ( $ this -> apiKey == '' ) { throw new \ Exception ( 'You must specify a apiKey' ) ; } $ searchArray = http_b... | Get search results |
16,582 | public function setErrors ( $ errors = array ( ) ) { foreach ( $ errors as $ error ) { if ( ! $ error instanceof ConstraintViolation ) { throw new \ InvalidArgumentException ( sprintf ( 'The supplied error is of class "%s", while a "Symfony\Component\Validator\ConstraintViolation" was expected.' , get_class ( $ error )... | Validate and set errors . |
16,583 | public function getBatchActions ( ) { if ( null === $ this -> batchActions ) { $ this -> batchActions = array ( ) ; $ this -> findBatchActions ( ) ; } return $ this -> batchActions ; } | Return a list of batch action from list . batch_actions |
16,584 | public function getIndentationColumnIndex ( ) { if ( null === $ this -> indentationColumnIndex ) { $ field = $ this -> getGenerator ( ) -> getFromYaml ( 'builders.nested_list.indentation.field' ) ; if ( ! $ field ) { return $ this -> indentationColumnIndex = 0 ; } $ this -> indentationColumnIndex = array_search ( $ fie... | Get the indentation field that should be used . No validity is made uppon the field name . |
16,585 | protected function resolveOptions ( $ name , array $ fieldOptions , array $ builderOptions = array ( ) , $ optionsClass = null ) { $ getter = 'get' . ucfirst ( $ name ) . 'Options' ; if ( $ optionsClass ) { if ( method_exists ( $ optionsClass , 'setAuthorizationChecker' ) ) { $ optionsClass -> setAuthorizationChecker (... | Resolve field options . |
16,586 | protected function mergeConfiguration ( array $ global , array $ builder ) { foreach ( $ global as $ name => & $ value ) { if ( ! array_key_exists ( $ name , $ builder ) || is_null ( $ builder [ $ name ] ) ) { continue ; } if ( ! is_array ( $ value ) ) { $ value = $ builder [ $ name ] ; continue ; } if ( ! is_array ( $... | Merge configuration on a single level |
16,587 | protected function applyActionsBuilderDefaults ( array $ params ) { if ( ! array_key_exists ( 'namespace_prefix' , $ params ) || ! array_key_exists ( 'bundle_name' , $ params ) ) { return $ params ; } $ routeBase = $ params [ 'namespace_prefix' ] . '_' . $ params [ 'bundle_name' ] . '_' . $ this -> getBaseGeneratorName... | Inject default batch and object actions settings |
16,588 | protected function setYamlConfig ( array $ yaml ) { $ this -> yaml = array_replace_recursive ( Yaml :: parse ( file_get_contents ( __DIR__ . '/../Resources/config/default.yml' ) ) , $ yaml ) ; } | Set the yaml to pass all the vars to the builders |
16,589 | public function getObjectActions ( ) { $ objectActions = parent :: getObjectActions ( ) ; if ( array_key_exists ( 'edit' , $ objectActions ) ) { unset ( $ objectActions [ 'edit' ] ) ; $ this -> objectActions = $ objectActions ; } return $ this -> objectActions ; } | Return a list of action from list . object_actions |
16,590 | public function mapBy ( array $ input , $ key ) { return array_map ( function ( $ item ) use ( $ key ) { if ( is_array ( $ item ) ) { if ( ! array_key_exists ( $ key , $ item ) ) { throw new \ LogicException ( "Could not map item by key \"$key\". Array key does not exist." ) ; } return $ item [ $ key ] ; } if ( ! is_ob... | Map collection by key . For objects return the property use get method or is method if avaliable . |
16,591 | public function getColumns ( ) { if ( null === $ this -> columns ) { $ this -> columns = array ( ) ; $ this -> findColumns ( ) ; } return $ this -> columns ; } | Return a list of columns from list . display . |
16,592 | public function getColumnsFor ( $ input ) { if ( ! is_array ( $ input ) ) { $ input = array ( $ input ) ; } $ it = new \ RecursiveIteratorIterator ( new \ RecursiveArrayIterator ( $ input ) ) ; $ fieldsNames = iterator_to_array ( $ it , false ) ; return array_intersect_key ( $ this -> getColumns ( ) , array_flip ( $ fi... | Get columns for tab fieldset row or field . |
16,593 | public function getActions ( ) { if ( null === $ this -> actions ) { $ this -> actions = array ( ) ; $ this -> findActions ( ) ; } return $ this -> actions ; } | Return a list of action from list . actions . |
16,594 | public function getObjectActions ( ) { if ( null === $ this -> objectActions ) { $ this -> objectActions = array ( ) ; $ this -> findObjectActions ( ) ; } return $ this -> objectActions ; } | Return a list of action from list . object_actions . |
16,595 | public function getStylesheets ( ) { $ parse_stylesheets = function ( $ params , $ stylesheets ) { foreach ( $ params as $ css ) { if ( is_string ( $ css ) ) { $ css = array ( 'path' => $ css , 'media' => 'all' , ) ; } $ stylesheets [ ] = $ css ; } return $ stylesheets ; } ; $ stylesheets = $ parse_stylesheets ( $ this... | Allow to add complementary strylesheets . |
16,596 | public function getJavascripts ( ) { $ self = $ this ; $ parse_javascripts = function ( $ params , $ javascripts ) use ( $ self ) { foreach ( $ params as $ js ) { if ( is_string ( $ js ) ) { $ js = array ( 'path' => $ js , ) ; } elseif ( isset ( $ js [ 'route' ] ) ) { $ js = array ( 'path' => $ self -> getGenerator ( )... | Allow to add complementary javascripts . |
16,597 | public function getExport ( ) { if ( null === $ this -> export ) { $ this -> export = array ( ) ; $ this -> fillExport ( ) ; } return $ this -> export ; } | Return a list of columns from excel . export |
16,598 | public function getFiltersMode ( ) { if ( null === $ this -> filtersMode ) { $ this -> filtersMode = $ this -> getGenerator ( ) -> getFromYaml ( 'builders.list.params.filtersMode' , 'default' ) ; } return $ this -> filtersMode ; } | Retrieve the filters mode parameter defined into the YAML generator file under the list builder . |
16,599 | public function getFormType ( ) { return sprintf ( '%s%s\\Form\Type\\%s\\FiltersType' , $ this -> getVariable ( 'namespace_prefix' ) ? $ this -> getVariable ( 'namespace_prefix' ) . '\\' : '' , $ this -> getVariable ( 'bundle_name' ) , $ this -> getBaseGeneratorName ( ) ) ; } | Retrieve the FQCN formType used by this builder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.