idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
6,400 | public function generateArticleFromDraft ( ArticleInterface & $ article , ArticleInterface $ draft ) { $ this -> loadArticle ( $ article , $ draft ) ; $ article -> setStatus ( Article :: STATUS_PUBLISHED ) -> setParent ( null ) ; return $ article ; } | Will synchronize changes made on Draft to the master article and set it As Published |
6,401 | protected function buildProcesses ( $ processes , $ container , $ processClass , $ stepClass ) { $ processReferences = array ( ) ; foreach ( $ processes as $ processName => $ processConfig ) { if ( ! empty ( $ processConfig [ 'import' ] ) ) { if ( is_file ( $ processConfig [ 'import' ] ) ) { $ yaml = new Parser ( ) ; $... | Build process definitions from configuration . |
6,402 | protected function buildSteps ( $ processName , $ steps , $ container , $ stepClass ) { $ stepReferences = array ( ) ; foreach ( $ steps as $ stepName => $ stepConfig ) { $ definition = new Definition ( $ stepClass , array ( $ stepName , $ stepConfig [ 'label' ] , array ( ) , $ stepConfig [ 'model_status' ] , $ stepCon... | Build steps definitions from configuration . |
6,403 | protected function addStepNextStates ( Definition $ step , $ stepsNextStates , $ processName ) { foreach ( $ stepsNextStates as $ stateName => $ data ) { if ( NextStateInterface :: TYPE_STEP === $ data [ 'type' ] ) { $ step -> addMethodCall ( 'addNextState' , array ( $ stateName , $ data [ 'type' ] , new Reference ( sp... | Add all next states to the step definition . |
6,404 | private function createZipBackup ( ) { if ( class_exists ( \ ZipArchive :: class ) ) { $ zip = new \ ZipArchive ( ) ; $ file_name = $ this -> file_name . '.zip' ; if ( $ zip -> open ( $ file_name , \ ZipArchive :: CREATE ) === TRUE ) { $ zip -> addFile ( $ this -> file_name , basename ( $ this -> file_name ) ) ; $ zip ... | Charge method to backup and create a zip with this |
6,405 | private function zipDirectory ( $ zip , $ alias , $ directory ) { if ( $ handle = opendir ( $ directory ) ) { while ( ( $ file = readdir ( $ handle ) ) !== false ) { if ( is_dir ( $ directory . $ file ) && $ file != "." && $ file != ".." && ! in_array ( $ directory . $ file . '/' , $ this -> module -> excludeDirectoryB... | Method responsible for reading a directory and add them to the zip |
6,406 | public function unzip ( $ sqlZipFile ) { if ( file_exists ( $ sqlZipFile ) ) { $ zip = new \ ZipArchive ( ) ; $ result = $ zip -> open ( $ sqlZipFile ) ; if ( $ result === true ) { $ zip -> extractTo ( dirname ( $ sqlZipFile ) ) ; $ zip -> close ( ) ; $ sqlZipFile = str_replace ( ".zip" , "" , $ sqlZipFile ) ; } } retu... | Zip file execution |
6,407 | public function findCurrentModelState ( ModelInterface $ model , $ processName , $ stepName = null ) { return $ this -> repository -> findLatestModelState ( $ model -> getWorkflowIdentifier ( ) , $ processName , $ stepName ) ; } | Returns the current model state . |
6,408 | public function findAllModelStates ( ModelInterface $ model , $ processName , $ successOnly = true ) { return $ this -> repository -> findModelStates ( $ model -> getWorkflowIdentifier ( ) , $ processName , $ successOnly ) ; } | Returns all model states . |
6,409 | public function newModelStateError ( ModelInterface $ model , $ processName , $ stepName , ViolationList $ violationList , $ previous = null ) { $ modelState = $ this -> createModelState ( $ model , $ processName , $ stepName , $ previous ) ; $ modelState -> setSuccessful ( false ) ; $ modelState -> setErrors ( $ viola... | Create a new invalid model state . |
6,410 | public function deleteAllModelStates ( ModelInterface $ model , $ processName = null ) { return $ this -> repository -> deleteModelStates ( $ model -> getWorkflowIdentifier ( ) , $ processName ) ; } | Delete all model states . |
6,411 | public function newModelStateSuccess ( ModelInterface $ model , $ processName , $ stepName , $ previous = null ) { $ modelState = $ this -> createModelState ( $ model , $ processName , $ stepName , $ previous ) ; $ modelState -> setSuccessful ( true ) ; $ this -> om -> persist ( $ modelState ) ; $ this -> om -> flush (... | Create a new successful model state . |
6,412 | protected function createModelState ( ModelInterface $ model , $ processName , $ stepName , $ previous = null ) { $ modelState = new ModelState ( ) ; $ modelState -> setWorkflowIdentifier ( $ model -> getWorkflowIdentifier ( ) ) ; $ modelState -> setProcessName ( $ processName ) ; $ modelState -> setStepName ( $ stepNa... | Create a new model state . |
6,413 | public function addValidator ( WirecardCEE_Stdlib_Validate_ValidateAbstract $ oValidator , $ param ) { $ this -> _validators [ ( string ) $ param ] [ ] = $ oValidator ; return $ this ; } | Adds the validator |
6,414 | public function getReturned ( ) { $ ret = $ this -> _returnData ; if ( array_key_exists ( 'responseFingerprintOrder' , $ ret ) ) { unset ( $ ret [ 'responseFingerprintOrder' ] ) ; } if ( array_key_exists ( 'responseFingerprint' , $ ret ) ) { unset ( $ ret [ 'responseFingerprint' ] ) ; } return $ ret ; } | getter for filtered return data . |
6,415 | public function findModelStates ( $ workflowIdentifier , $ processName , $ successOnly ) { $ qb = $ this -> createQueryBuilder ( 'ms' ) -> andWhere ( 'ms.workflowIdentifier = :workflow_identifier' ) -> andWhere ( 'ms.processName = :process' ) -> orderBy ( 'ms.createdAt' , 'ASC' ) -> setParameter ( 'workflow_identifier'... | Returns all model states for the given workflow identifier . |
6,416 | public function getOperationsAllowed ( ) { if ( $ this -> _getField ( self :: $ OPERATIONS_ALLOWED ) == '' ) { return Array ( ) ; } else { return explode ( ',' , $ this -> _getField ( self :: $ OPERATIONS_ALLOWED ) ) ; } } | getter for allowed follow - up operations |
6,417 | protected static function _getInstance ( $ return , $ secret ) { switch ( strtoupper ( $ return [ 'paymentState' ] ) ) { case parent :: STATE_SUCCESS : return self :: _getSuccessInstance ( $ return , $ secret ) ; break ; case parent :: STATE_CANCEL : return new WirecardCEE_QMore_Return_Cancel ( $ return ) ; break ; cas... | Returns the return sintance object |
6,418 | protected static function _getSuccessInstance ( $ return , $ secret ) { if ( ! array_key_exists ( 'paymentType' , $ return ) ) { throw new WirecardCEE_QMore_Exception_InvalidResponseException ( 'Invalid response from QMORE. Paymenttype is missing.' ) ; } switch ( strtoupper ( $ return [ 'paymentType' ] ) ) { case Wirec... | getter for the correct QMORE success return instance |
6,419 | public function cache_menu ( $ menu , $ args ) { if ( $ this -> should_cache_menu ( $ args ) ) { set_transient ( $ this -> menu_key ( $ args ) , $ menu , $ this -> expiration ( ) ) ; } return $ menu ; } | Stores the menu HTML in a transient . |
6,420 | public function get_menu ( $ menu , $ args ) { if ( $ this -> should_cache_menu ( $ args ) ) { $ cached_menu = get_transient ( $ this -> menu_key ( $ args ) ) ; if ( is_string ( $ cached_menu ) ) { return $ cached_menu ; } } return $ menu ; } | Returns a cached menu if found . |
6,421 | private function expiration ( ) { if ( isset ( $ this -> expiration ) ) { return $ this -> expiration ; } $ this -> expiration = ( int ) apply_filters ( self :: FILTER_EXPIRATION , 300 ) ; return $ this -> expiration ; } | Returns the expiration . |
6,422 | private function should_cache_menu ( $ args ) { $ should_cache_menu = true ; if ( ! empty ( $ args -> theme_location ) ) { $ theme_locations = $ this -> theme_locations ( ) ; if ( $ theme_locations ) { $ should_cache_menu = in_array ( $ args -> theme_location , $ theme_locations , true ) ; } } return ( bool ) apply_fil... | Checks if a menu should be cached . |
6,423 | private function theme_locations ( ) { if ( isset ( $ this -> theme_locations ) ) { return $ this -> theme_locations ; } $ theme_locations = ( array ) apply_filters ( self :: FILTER_THEME_LOCATIONS , [ ] ) ; $ this -> theme_locations = array_map ( 'strval' , $ theme_locations ) ; return $ this -> theme_locations ; } | Returns the theme locations . |
6,424 | public function loginUrl ( ) { $ query = 'client_id=' . $ this -> app -> getId ( ) . '&redirect_uri=' . urlencode ( $ this -> callback ) . '&response_type=code&state=' . $ this -> state ; $ query .= isset ( $ this -> scopes ) ? '&scope=' . urlencode ( str_replace ( ',' , ' ' , implode ( ',' , $ this -> scopes ) ) ) : '... | Creates login url |
6,425 | public function feedAction ( $ type ) { $ articles = $ this -> get ( 'app_repository_article' ) -> getActiveArticles ( ) ; $ feed = $ this -> get ( 'eko_feed.feed.manager' ) -> get ( 'article' ) ; $ feed -> addFromArray ( $ articles ) ; return new Response ( $ feed -> render ( $ type ) ) ; } | Generate the article feed |
6,426 | public function getProcess ( $ name ) { if ( ! isset ( $ this -> processes [ $ name ] ) ) { throw new WorkflowException ( sprintf ( 'Unknown process "%s".' , $ name ) ) ; } return $ this -> processes [ $ name ] ; } | Returns a process by its name . |
6,427 | public function authenticateAction ( Request $ request ) { if ( ! $ this -> getUser ( ) ) { $ referer = $ request -> headers -> get ( 'referer' ) ; $ pageSection = $ request -> get ( 'section' , false ) ; $ this -> get ( 'session' ) -> set ( 'refererUrl' , $ referer ) ; if ( $ pageSection ) { $ this -> get ( 'session' ... | This action will ask for authorization and redirect user back to referer |
6,428 | public static function generate ( Array $ aValues , WirecardCEE_Stdlib_FingerprintOrder $ oFingerprintOrder ) { if ( self :: $ _HASH_ALGORITHM == self :: HASH_ALGORITHM_HMAC_SHA512 ) { $ secret = isset ( $ aValues [ 'secret' ] ) && ! empty ( $ aValues [ 'secret' ] ) ? $ aValues [ 'secret' ] : '' ; if ( ! strlen ( $ sec... | generates an Fingerprint - string |
6,429 | protected function _setField ( $ name , $ value ) { $ this -> _addressData [ self :: $ PREFIX . $ this -> _addressType . $ name ] = ( string ) $ value ; } | setter for an addressfield . |
6,430 | public function supports ( ParamConverter $ configuration ) { if ( null === $ configuration -> getClass ( ) ) { return false ; } if ( array_key_exists ( $ configuration -> getClass ( ) , $ this -> targetEntitiesArray ) ) { return true ; } else { return false ; } } | Checks if the object is supported . |
6,431 | public function authenticate ( array $ data , HTTPRequest $ request , ValidationResult & $ result = null ) { $ result = $ result ? : ValidationResult :: create ( ) ; $ service = Injector :: inst ( ) -> get ( LDAPService :: class ) ; $ login = trim ( $ data [ 'Login' ] ) ; if ( Email :: is_valid_address ( $ login ) ) { ... | Performs the login but will also create and sync the Member record on - the - fly if not found . |
6,432 | protected function fallbackAuthenticate ( $ data , HTTPRequest $ request ) { if ( array_key_exists ( 'Login' , $ data ) && ! array_key_exists ( 'Email' , $ data ) ) { $ data [ 'Email' ] = $ data [ 'Login' ] ; } $ authenticatorClass = Config :: inst ( ) -> get ( self :: class , 'fallback_authenticator_class' ) ; if ( $ ... | Try to authenticate using the fallback authenticator . |
6,433 | protected function hydrateAllData ( ) { $ result = array ( ) ; $ data = $ this -> _stmt -> fetchAll ( PDO :: FETCH_ASSOC ) ; foreach ( $ data as $ row ) { $ keys = array_keys ( $ row ) ; $ result [ $ row [ $ keys [ 0 ] ] ] = $ row [ $ keys [ 1 ] ] ; } return $ result ; } | Hydrates all rows from the current statement instance at once . |
6,434 | public function toArray ( ) { $ data = array ( ) ; foreach ( $ this -> violations as $ violation ) { $ data [ ] = $ violation -> getMessage ( ) ; } return $ data ; } | Cast violations to flat array . |
6,435 | public function getGroups ( $ cached = true , $ attributes = [ ] , $ indexBy = 'dn' ) { $ searchLocations = $ this -> config ( ) -> groups_search_locations ? : [ null ] ; $ cache = self :: get_cache ( ) ; $ cacheKey = 'groups' . md5 ( implode ( '' , array_merge ( $ searchLocations , $ attributes ) ) ) ; $ results = $ c... | Return all AD groups in configured search locations including all nested groups . Uses groups_search_locations if defined otherwise falls back to NULL which tells LDAPGateway to use the default baseDn defined in the connection . |
6,436 | public function getGroupByGUID ( $ guid , $ attributes = [ ] ) { $ searchLocations = $ this -> config ( ) -> groups_search_locations ? : [ null ] ; foreach ( $ searchLocations as $ searchLocation ) { $ records = $ this -> getGateway ( ) -> getGroupByGUID ( $ guid , $ searchLocation , Ldap :: SEARCH_SCOPE_SUB , $ attrib... | Get a particular AD group s data given a GUID . |
6,437 | public function getUsers ( $ attributes = [ ] ) { $ searchLocations = $ this -> config ( ) -> users_search_locations ? : [ null ] ; $ results = [ ] ; foreach ( $ searchLocations as $ searchLocation ) { $ records = $ this -> getGateway ( ) -> getUsersWithIterator ( $ searchLocation , $ attributes ) ; if ( ! $ records ) ... | Return all AD users in configured search locations including all users in nested groups . Uses users_search_locations if defined otherwise falls back to NULL which tells LDAPGateway to use the default baseDn defined in the connection . |
6,438 | public function updateMemberGroups ( $ data , Member $ member ) { if ( isset ( $ data [ 'memberof' ] ) ) { $ ldapGroups = is_array ( $ data [ 'memberof' ] ) ? $ data [ 'memberof' ] : [ $ data [ 'memberof' ] ] ; foreach ( $ ldapGroups as $ groupDN ) { foreach ( LDAPGroupMapping :: get ( ) as $ mapping ) { if ( ! $ mappi... | Ensure the user is mapped to any applicable groups . |
6,439 | public function addLDAPUserToGroup ( $ userDn , $ groupDn ) { $ members = $ this -> getLDAPGroupMembers ( $ groupDn ) ; if ( in_array ( $ userDn , $ members ) ) { return ; } $ members [ ] = $ userDn ; try { $ this -> update ( $ groupDn , [ 'member' => $ members ] ) ; } catch ( Exception $ e ) { throw new ValidationExce... | Add LDAP user by DN to LDAP group . |
6,440 | public function setPassword ( Member $ member , $ password , $ oldPassword = null ) { $ validationResult = ValidationResult :: create ( ) ; $ this -> extend ( 'onBeforeSetPassword' , $ member , $ password , $ validationResult ) ; if ( ! $ member -> GUID ) { $ this -> getLogger ( ) -> debug ( sprintf ( 'Cannot update Me... | Change a members password on the AD . Works with ActiveDirectory compatible services that saves the password in the unicodePwd attribute . |
6,441 | public function ajax ( $ jquery = false ) { $ url = $ this -> link -> shortered ( ) ; $ code = $ jquery ? "<script src='https://code.jquery.com/jquery-3.1.1.min.js' integrity='sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=' crossorigin='anonymous'></script>" : '' ; $ code .= '<script>' ; $ code .= "$.get('$url');"... | Returns the javascript code to send a and ajax request to the short url . |
6,442 | public function request ( Client $ client , $ endpoint , $ options , $ method = 'GET' ) { try { return $ client -> request ( $ method , $ endpoint , [ 'form_params' => $ options , ] ) ; } catch ( ClientException $ exception ) { static :: throwException ( static :: extractOriginalExceptionMessage ( $ exception ) , $ exc... | Sends request to Instagram Api Endpoints |
6,443 | protected static function createBody ( $ options , $ method ) { return ( 'GET' !== $ method ) ? is_array ( $ options ) ? http_build_query ( $ options ) : ltrim ( $ options , '&' ) : null ; } | Create body for Guzzle client request |
6,444 | protected static function throwException ( \ stdClass $ object , ClientException $ exMessage ) { $ exception = static :: createExceptionMessage ( $ object ) ; if ( stripos ( $ exception [ 'error_type' ] , 'oauth' ) !== false ) { throw new InstagramOAuthException ( json_encode ( [ 'Type' => $ exception [ 'error_type' ] ... | Throw required Exception |
6,445 | protected static function createExceptionMessage ( \ stdClass $ object ) { $ message = [ ] ; $ message [ 'error_type' ] = isset ( $ object -> meta ) ? $ object -> meta -> error_type : $ object -> error_type ; $ message [ 'error_message' ] = isset ( $ object -> meta ) ? $ object -> meta -> error_message : $ object -> er... | Creates Exception Message |
6,446 | protected function makeResource ( ) { $ resource = new $ this -> resourceClass ( $ this -> data , $ this -> transformer , $ this -> resourceKey ) ; if ( ! empty ( $ this -> meta ) ) { $ resource -> setMeta ( $ this -> meta ) ; } if ( $ resource instanceof Collection && isset ( $ this -> paginator ) ) { $ resource -> se... | Creates the resource for this builder . |
6,447 | protected function makeScope ( ) { $ resource = $ this -> makeResource ( ) ; if ( isset ( $ this -> serializer ) ) { $ this -> fractal -> setSerializer ( $ this -> serializer ) ; } return $ this -> fractal -> createData ( $ resource ) ; } | Creates the scope for this builder . |
6,448 | public function deleteAction ( Request $ request , Media $ media ) { $ user = $ this -> getBlogUser ( ) ; $ mediaLibrary = $ this -> container -> get ( 'sonata.media.manager.gallery' ) -> findOneBy ( array ( 'name' => 'Media Library' ) ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; foreach ( $ media -> getGal... | Will remove Media from MediaLibrary but not from file system! |
6,449 | private function setParams ( Response $ response ) { $ this -> protocol = $ response -> getProtocolVersion ( ) ; $ this -> statusCode = ( int ) $ response -> getStatusCode ( ) ; $ this -> headers = $ response -> getHeaders ( ) ; $ this -> body = json_decode ( $ response -> getBody ( ) -> getContents ( ) ) ; $ this -> e... | Set Values to the class members |
6,450 | private function extractBodyParts ( ) { if ( isset ( $ this -> body -> pagination ) ) { $ this -> isPagination = true ; $ this -> pagination = $ this -> body -> pagination ; } if ( isset ( $ this -> body -> meta ) ) { $ this -> isMetaData = true ; $ this -> metaData = $ this -> body -> meta ; } $ this -> data = $ this ... | Extract Body Parts from the response |
6,451 | private function createClassesNodeDefinition ( ) { $ classesNode = new ArrayNodeDefinition ( 'classes' ) ; $ classesNode -> addDefaultsIfNotSet ( ) -> children ( ) -> scalarNode ( 'process_handler' ) -> defaultValue ( 'Lexik\Bundle\WorkflowBundle\Handler\ProcessHandler' ) -> end ( ) -> scalarNode ( 'process' ) -> defau... | Create a configuration node to customize classes used by the bundle . |
6,452 | private function createProcessesNodeDefinition ( ) { $ processesNode = new ArrayNodeDefinition ( 'processes' ) ; $ processesNode -> useAttributeAsKey ( 'name' ) -> prototype ( 'array' ) -> validate ( ) -> ifTrue ( function ( $ value ) { return ! empty ( $ value [ 'import' ] ) && ! empty ( $ value [ 'steps' ] ) ; } ) ->... | Create a configuration node to define processes . |
6,453 | private function createStepsNodeDefinition ( ) { $ stepsNode = new ArrayNodeDefinition ( 'steps' ) ; $ stepsNode -> defaultValue ( array ( ) ) -> useAttributeAsKey ( 'name' ) -> prototype ( 'array' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> scalarNode ( 'label' ) -> defaultValue ( '' ) -> end ( ) -> arrayNode ( 'r... | Create a configuration node to define the steps of a process . |
6,454 | private function findWritingLockMeta ( ArticleInterface $ article ) { $ metaLock = null ; foreach ( $ article -> getMetaData ( ) as $ meta ) { if ( $ meta -> getKey ( ) == 'writing_locked' ) { $ metaLock = $ meta ; break ; } } return $ metaLock ; } | Finds last writing lock |
6,455 | public function addToEditHistory ( $ media , $ providerReference , $ width , $ height ) { $ key = 'media_edit_history_' . $ media -> getId ( ) ; $ history = $ this -> session -> get ( $ key , null ) ; if ( ! $ history ) { $ history = array ( ) ; } else { $ history = unserialize ( $ history ) ; } $ history [ ] = array (... | Keep temparary records of file media edit history |
6,456 | public function lostPasswordForm ( ) { $ loginFieldLabel = ( Config :: inst ( ) -> get ( LDAPAuthenticator :: class , 'allow_email_login' ) === 'yes' ) ? _t ( 'SilverStripe\\LDAP\\Forms\\LDAPLoginForm.USERNAMEOREMAIL' , 'Username or email' ) : _t ( 'SilverStripe\\LDAP\\Forms\\LDAPLoginForm.USERNAME' , 'Username' ) ; $ ... | Factory method for the lost password form |
6,457 | public function usedBrowsers ( ) { $ results = [ ] ; foreach ( $ this -> views as $ view ) { array_key_exists ( $ view -> browser , $ results ) ? $ results [ $ view -> browser ] ++ : $ results [ $ view -> browser ] = 1 ; } return $ results ; } | Returns the link browsers . |
6,458 | public function mostUsedBrowser ( ) { $ max = 0 ; $ max_browser = null ; foreach ( $ this -> usedBrowsers ( ) as $ browser => $ count ) { if ( $ count >= $ max ) { $ max = $ count ; $ max_browser = $ browser ; } } return $ max_browser ; } | Returns the link most used browser . |
6,459 | public function addView ( ) { $ view = View :: create ( [ 'link_id' => $ this -> id , 'language' => Identify :: lang ( ) -> getLanguage ( ) , 'browser' => Identify :: browser ( ) -> getName ( ) , 'browser_version' => Identify :: browser ( ) -> getVersion ( ) , 'os' => Identify :: os ( ) -> getName ( ) , 'os_version' =>... | Adds a new view to the link . |
6,460 | public function login ( Request $ request ) { session ( [ 'links.password' => Crypt :: encrypt ( $ request -> input ( 'password' ) ) ] ) ; if ( Crypt :: decrypt ( session ( 'links.password' ) ) != config ( 'links.password' ) ) { return redirect ( ) -> route ( 'links::login' ) -> with ( 'msg' , 'The password is not corr... | Login the user . |
6,461 | public function redirect ( $ slug ) { if ( ! $ link = Link :: where ( 'slug' , $ slug ) -> first ( ) ) { abort ( 404 , 'Unable to find this link' ) ; } $ link -> addView ( ) ; return redirect ( $ link -> url ) ; } | Redirects the user to the link . |
6,462 | public function getExcerptText ( ) { if ( $ this -> excerpt ) { return $ this -> excerpt ; } else { $ rowExcerpt = strip_tags ( $ this -> content ) ; if ( strlen ( $ rowExcerpt ) > self :: EXCERPT_LENGTH ) { $ break = strpos ( $ rowExcerpt , ' ' , self :: EXCERPT_LENGTH - 10 ) ; $ rowExcerpt = substr ( $ rowExcerpt , 0... | Use this over getExcept in frontend display |
6,463 | public function getDescription ( ) { if ( array_key_exists ( self :: ITEM_DESCRIPTION , $ this -> _itemData ) ) { return ( string ) $ this -> _itemData [ self :: ITEM_DESCRIPTION ] ; } return null ; } | Returns the item description |
6,464 | public function getImageUrl ( ) { if ( array_key_exists ( self :: ITEM_IMAGE_URL , $ this -> _itemData ) ) { return ( string ) $ this -> _itemData [ self :: ITEM_IMAGE_URL ] ; } return null ; } | Returns the item image url |
6,465 | public function getPaymentInformation ( $ paymentType = null ) { $ paymentInformation = $ this -> _getField ( self :: $ PAYMENT_INFORMATION ) ; if ( is_array ( $ paymentInformation ) ) { if ( ! is_null ( $ paymentType ) ) { $ paymentType = strtoupper ( $ paymentType ) ; foreach ( $ paymentInformation as $ singlePayment... | getter for all stored anonymized paymentInformation |
6,466 | public function setBirthDate ( DateTime $ birthDate ) { $ this -> _setField ( self :: $ BIRTH_DATE , $ birthDate -> format ( self :: $ BIRTH_DATE_FORMAT ) ) ; return $ this ; } | setter for the birthdate of the consumer |
6,467 | protected function _setField ( $ name , $ value ) { $ this -> _consumerData [ self :: $ PREFIX . $ name ] = ( string ) $ value ; } | setter for consumerdata fields |
6,468 | public function getLoginUrl ( array $ parameters ) { if ( $ this -> callbackUrl === null ) { throw new InstagramException ( 'Missing Callback Url' , 400 ) ; } if ( ! isset ( $ parameters [ 'scope' ] ) ) { throw new InstagramException ( 'Missing or Invalid Scope permission used' , 400 ) ; } if ( count ( array_diff ( $ p... | Make URLs for user browser navigation |
6,469 | public function oauth ( $ code ) { $ options = [ 'grant_type' => 'authorization_code' , 'client_id' => $ this -> app -> getId ( ) , 'client_secret' => $ this -> app -> getSecret ( ) , 'redirect_uri' => $ this -> getCallbackUrl ( ) , 'code' => $ code , 'state' => $ this -> state , ] ; $ response = HelperFactory :: getIn... | Get the Oauth Access Token of a user from callback code |
6,470 | public function setAccessToken ( $ token ) { if ( ! $ this -> oauthResponse instanceof InstagramOAuth ) { $ this -> oauthResponse = new InstagramOAuth ( json_decode ( json_encode ( [ 'access_token' => $ token ] ) ) ) ; } } | Set User Access Token |
6,471 | protected function replaceClassAndNamespace ( $ name , & $ stub ) { $ stub = str_replace ( [ 'DummyClassWithNamespace' , 'DummyClass' ] , [ $ this -> argument ( 'name' ) , $ name ] , $ stub ) ; return $ this ; } | Replace the classname and the namespace for the given stub . |
6,472 | protected function replaceFields ( $ name , & $ stub ) { if ( empty ( $ fillable = $ this -> getFillable ( ) ) ) { return str_replace ( 'fields' , '//' , $ stub ) ; } $ fields = 'return [' ; foreach ( $ fillable as $ column ) { $ fields .= PHP_EOL . " '{$column}' => \$faker->word," ; } return str_replace ( 'fiel... | Replace the fields of the model factory . |
6,473 | public function addServers ( array $ servers ) : self { foreach ( $ servers as $ hostname => $ server ) { if ( ! $ server instanceof Server && is_array ( $ server ) ) { $ host = $ server [ 'host' ] ; $ port = $ server [ 'port' ] ?? null ; $ database = $ server [ 'database' ] ?? null ; $ username = $ server [ 'username'... | Pushes servers to cluster . |
6,474 | public function addServer ( string $ hostname , Server $ server ) { if ( isset ( $ this -> servers [ $ hostname ] ) ) { throw ClusterException :: serverHostnameDuplicate ( $ hostname ) ; } $ this -> servers [ $ hostname ] = $ server ; } | Pushes one server to cluster . |
6,475 | public function getServerByHostname ( string $ hostname ) : Server { if ( ! isset ( $ this -> servers [ $ hostname ] ) ) { throw ClusterException :: serverNotFound ( $ hostname ) ; } return $ this -> servers [ $ hostname ] ; } | Returns server by specified hostname . |
6,476 | public static function createFromJSON ( $ className , $ json , $ isError = false ) { if ( ! $ className ) { throw new Exception ( 'Invalid className:' . $ className ) ; } $ model = new $ className ( ) ; self :: fillFromJSON ( $ model , $ json , $ isError ) ; return $ model ; } | Create new model instance from JSON . |
6,477 | public static function fillFromJSON ( $ model , $ json , $ isError = false ) { if ( is_array ( $ json ) ) { $ array = $ json ; } else { if ( get_magic_quotes_gpc ( ) ) { $ json = stripslashes ( $ json ) ; } $ array = json_decode ( $ json , true ) ; } if ( ! is_array ( $ array ) ) $ array = array ( ) ; if ( $ isError ) ... | Fill existing model instance from JSON . |
6,478 | public static function convertToJSON ( $ model , $ toString = false ) { $ conversionRules = Models :: getConversionRules ( get_class ( $ model ) ) ; $ result = array ( ) ; $ objectVars = get_object_vars ( $ model ) ; foreach ( $ objectVars as $ key => $ value ) { if ( is_string ( $ value ) || is_numeric ( $ value ) ) $... | Convert model to JSON . |
6,479 | public function request ( $ method , $ endpoint , array $ data = null , array $ query = null , $ rawData = false ) { $ options = [ 'json' => $ data ] ; if ( $ rawData ) { $ options = $ data ; } if ( isset ( $ query ) ) { $ options [ 'query' ] = $ query ; } $ url = $ this -> baseUrl . $ endpoint ; return $ this -> perfo... | Internal method for handling requests |
6,480 | public function addItem ( $ item = [ ] ) { $ this -> items [ ] = $ this -> normalizeItem ( $ item , count ( $ this -> items ) ) ; return $ this ; } | If you wants to add an item to collection in runtime you should use this instead of direct items pushing to collection because it supports configuring slides from strings and arrays . |
6,481 | protected function checkBehaviours ( ) { foreach ( $ this -> behaviours as $ behaviour ) { if ( ! in_array ( $ behaviour , $ this -> availableBehaviours ) ) { throw new \ InvalidArgumentException ( "Unknown behaviour {$behaviour}" ) ; } } } | Checks if there is invalid behaviour given . If given then throws exception |
6,482 | protected function renderBehaviourParallax ( ) { if ( ! in_array ( self :: BEHAVIOUR_PARALLAX , $ this -> behaviours ) ) { return '' ; } $ parallaxOptions = $ this -> parallaxOptions ; $ parallaxTag = ArrayHelper :: remove ( $ parallaxOptions , 'tag' , 'div' ) ; ArrayHelper :: remove ( $ parallaxOptions , self :: PARAL... | This function renders parallax part of widget |
6,483 | protected function renderBehaviourPagination ( ) { if ( in_array ( self :: BEHAVIOUR_PAGINATION , $ this -> behaviours ) ) { $ paginationOptions = $ this -> paginationOptions ; $ paginationTag = ArrayHelper :: remove ( $ paginationOptions , 'tag' , 'div' ) ; if ( ! isset ( $ this -> pluginOptions [ self :: OPTION_PAGIN... | This function renders pagination part of widget |
6,484 | protected function renderBehaviourScrollbar ( ) { if ( in_array ( self :: BEHAVIOUR_SCROLLBAR , $ this -> behaviours ) ) { $ scrollbarOptions = $ this -> scrollbarOptions ; $ scrollbarTag = ArrayHelper :: remove ( $ scrollbarOptions , 'tag' , 'div' ) ; if ( ! isset ( $ this -> pluginOptions [ self :: OPTION_SCROLLBAR ]... | This function renders scrollbar part of widget |
6,485 | protected function renderBehaviourNextButton ( ) { if ( in_array ( self :: BEHAVIOUR_NEXT_BUTTON , $ this -> behaviours ) ) { $ nextButtonOptions = $ this -> nextButtonOptions ; $ nextButtonTag = ArrayHelper :: remove ( $ nextButtonOptions , 'tag' , 'div' ) ; if ( ! isset ( $ this -> pluginOptions [ self :: OPTION_NEXT... | This function renders nextButton part of widget |
6,486 | protected function renderBehaviourPrevButton ( ) { if ( in_array ( self :: BEHAVIOUR_PREV_BUTTON , $ this -> behaviours ) ) { $ prevButtonOptions = $ this -> prevButtonOptions ; $ prevButtonTag = ArrayHelper :: remove ( $ prevButtonOptions , 'tag' , 'div' ) ; if ( ! isset ( $ this -> pluginOptions [ self :: OPTION_PREV... | This function renders prevButton part of widget |
6,487 | protected function renderWrapper ( ) { $ renderedItems = $ this -> renderItems ( $ this -> items ) ; $ wrapperOptions = $ this -> wrapperOptions ; $ wrapperTag = ArrayHelper :: remove ( $ wrapperOptions , 'tag' , 'div' ) ; $ renderedWrapper = Html :: tag ( $ wrapperTag , PHP_EOL . $ renderedItems . PHP_EOL , $ wrapperO... | This function renders the wrapper tag of swiper which contains slides |
6,488 | protected function registerClientScript ( ) { $ view = $ this -> getView ( ) ; SwiperAsset :: register ( $ view ) ; $ id = $ this -> containerOptions [ 'id' ] ; $ pluginOptions = Json :: encode ( $ this -> pluginOptions ) ; $ variableName = 'swiper' . Inflector :: id2camel ( $ this -> containerOptions [ 'id' ] ) ; $ vi... | Registers the initializer of Swiper plugin |
6,489 | public function scopeFilteredByType ( Builder $ query , $ type = null ) { $ type = is_null ( $ type ) ? request ( 'f' , 'all' ) : $ type ; if ( in_array ( $ type , [ 'audio' , 'document' , 'image' , 'video' , 'embedded' ] ) ) { $ query -> whereType ( $ type ) ; } return $ query ; } | Scope for request filter |
6,490 | protected function setImageMetadata ( ) { $ image = ImageFacade :: make ( $ this -> getFilePath ( ) ) ; $ this -> setMetadata ( 'width' , $ image -> width ( ) ) ; $ this -> setMetadata ( 'height' , $ image -> height ( ) ) ; } | Sets the image metadata |
6,491 | public function summarize ( $ json = false ) { $ attributes = [ 'id' => $ this -> getKey ( ) , 'name' => $ this -> getAttribute ( 'name' ) , 'type' => $ this -> getAttribute ( 'type' ) , 'meta' => $ this -> present ( ) -> metaDescription , 'thumbnail' => $ this -> present ( ) -> thumbnail , 'preview' => ( $ this -> typ... | Summarizes the model |
6,492 | private static function withExpires ( ResponseInterface $ response , CacheUtil $ util , string $ expires ) : ResponseInterface { $ expires = new DateTime ( $ expires ) ; $ cacheControl = ResponseCacheControl :: fromString ( $ response -> getHeaderLine ( 'Cache-Control' ) ) -> withMaxAge ( $ expires -> getTimestamp ( ) ... | Add the Expires and Cache - Control headers . |
6,493 | public function populateDefaultMetadata ( ) { $ oEmbed = Oembed :: cache ( $ this -> path , [ 'lifetime' => 432000 ] ) ; $ this -> type = $ this -> mediaType ; $ this -> mimetype = mb_strtolower ( $ oEmbed -> providerName ) ; $ this -> size = 0 ; $ this -> name = $ oEmbed -> title ; $ this -> caption = $ oEmbed -> titl... | Populates default data with oEmbed data |
6,494 | protected function createEmbeddedPath ( ) { $ path = upload_path ( 'embedded' ) ; if ( ! file_exists ( $ path ) ) { if ( ! mkdir ( $ path , 0777 , true ) ) { throw new RuntimeException ( 'Directory (' . $ path . ') could not be created.' ) ; } } } | Creates the current embedded directory |
6,495 | public function poster ( $ imdbid , $ height = 300 ) { if ( is_null ( $ this -> api_key ) ) { return $ this -> output ( '400' , 'No API Key Found' ) ; } if ( $ this -> validateIMDBid ( $ imdbid ) == false ) { return $ this -> output ( '400' , 'Invalid IMDB ID provided' ) ; } if ( ! is_numeric ( $ height ) ) { return $ ... | Get poster from OMDb Poster API |
6,496 | protected function get ( $ api_uri ) { try { $ response = $ this -> client -> get ( $ api_uri ) ; $ code = $ response -> getStatusCode ( ) ; $ message = $ response -> getReasonPhrase ( ) ; $ body = $ response -> getBody ( ) ; $ data = json_decode ( $ body -> getContents ( ) , $ this -> assoc ) ; } catch ( RequestExcept... | Make the call using Guzzle Client |
6,497 | protected function output ( $ code , $ message , $ data = null ) { $ result = [ 'code' => $ code , 'message' => $ message , 'data' => $ data , ] ; if ( ! $ this -> assoc ) { $ result = ( object ) $ result ; } return $ result ; } | Format the output data |
6,498 | public function register ( Container $ container ) { if ( ! isset ( $ container -> get ( 'settings' ) [ 'view' ] ) ) { throw new InvalidArgumentException ( 'Template configuration not found' ) ; } $ engine = new Plates ( $ container -> get ( 'settings' ) [ 'view' ] , $ container -> get ( 'response' ) ) ; $ engine -> lo... | Register this plates view provider with a Pimple container . |
6,499 | public function editImage ( $ action ) { $ image = $ this -> loadImage ( ) ; $ path = $ this -> processImage ( $ action , $ image ) ; $ this -> changeImagePath ( $ path ) ; } | Edits image according to given action |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.