idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
7,300 | public function sox ( ) { $ args = func_get_args ( ) ; array_unshift ( $ args , $ this -> filename ) ; return self :: exec ( 'sox' , $ args ) ; } | Execute sox . Each argument will be used in the command . |
7,301 | public function includeAuthor ( Book $ book , ParamBag $ paramBag = null ) { return $ this -> item ( $ book -> author , new AuthorTransformer ( $ paramBag ) ) ; } | Include Author . |
7,302 | public function buildPayload ( array $ payload ) { if ( $ visible = $ this -> getVisible ( ) ) { $ payload = array_only ( $ payload , $ visible ) ; } if ( $ hidden = $ this -> getHidden ( ) ) { $ payload = array_except ( $ payload , $ hidden ) ; } return $ payload ; } | Filter fields to respond . |
7,303 | protected function setProperties ( ) { list ( $ limit , $ offset ) = $ this -> paramBag -> get ( 'limit' ) ; list ( $ sortKey , $ sortDirection ) = $ this -> paramBag -> get ( 'sort' ) ; $ this -> limit = $ limit ? : $ this -> limit ; $ this -> offset = $ offset ? : $ this -> offset ; $ this -> sortKey = $ sortKey ? : ... | Set class properties by request query string . |
7,304 | protected function validateIncludeParams ( ) { $ validParams = array_keys ( $ this -> config [ 'include' ] [ 'params' ] ) ; $ usedParams = array_keys ( iterator_to_array ( $ this -> paramBag ) ) ; if ( $ invalidParams = array_diff ( $ usedParams , $ validParams ) ) { throw new UnexpectedIncludesParamException ( sprintf... | Validate include params . We already define the white lists in the config . |
7,305 | public function transform ( $ model ) { if ( is_array ( $ model ) ) { return $ model ; } if ( $ model instanceof Collection ) { return $ model -> toArray ( ) ; } if ( $ model instanceof JsonSerializable ) { return $ model -> jsonSerialize ( ) ; } if ( $ model instanceof \ stdClass ) { return ( array ) $ model ; } throw... | Transform single resource |
7,306 | public function getPhotoUrl ( string $ email , bool $ secure = true ) { $ hash = md5 ( strtolower ( trim ( $ email ) ) ) ; $ url = ( $ secure ? "https://" : "http://" ) ; $ url .= "{$this->bamboo->domain}.bamboohr.com/employees/photos/?h={$hash}" ; return $ url ; } | Get the URL of an employee s photo |
7,307 | public function addEditList ( $ listId , array $ options ) { $ xml = "<options>" ; foreach ( $ options as $ option ) { $ xml .= "<option" ; if ( isset ( $ option [ 'id' ] ) ) { $ xml .= " id=\"{$option['id']}\"" ; } if ( isset ( $ option [ 'archived' ] ) ) { $ xml .= " archived=\"{$option['archived']}\"" ; } $ xml .= "... | Add or update values for list fields |
7,308 | public function actionEdit ( $ id = null ) { if ( $ id === null ) { $ model = new Context ; $ dataProvider = null ; } else { $ model = $ this -> findModel ( $ id ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => Language :: find ( ) -> where ( [ 'context_id' => $ model -> id ] ) , ] ) ; } $ isLoaded = $ model ... | Updates an existing Context model . If update is successful the browser will be redirected to the view page . |
7,309 | public function actionEditLanguage ( $ id = null , $ contextId = null ) { if ( $ id === null ) { $ model = new Language ( ) ; } else { $ model = $ this -> findLanguageModel ( $ id ) ; } if ( $ contextId !== null ) { $ model -> context_id = $ contextId ; } $ hasAccess = ( $ model -> isNewRecord && Yii :: $ app -> user -... | Updates an existing Language model . If update is successful the browser will be redirected to the view page . |
7,310 | public function actionDeleteLanguage ( $ id ) { $ model = $ this -> findLanguageModel ( $ id ) ; $ model -> delete ( ) ; return $ this -> redirect ( [ 'edit' , 'id' => $ model -> context_id ] ) ; } | Deletes an existing Language model . If deletion is successful the browser will be redirected to the index page . |
7,311 | protected function setBaseApiUri ( TokenInterface $ token ) { $ endpoint = 'https://login.mailchimp.com/oauth2/metadata?oauth_token=' . $ token -> getAccessToken ( ) ; $ response = $ this -> httpRequest ( $ endpoint , [ ] , [ ] , 'GET' ) ; $ meta = json_decode ( $ response , true ) ; $ this -> baseApiUri = new Url ( 'h... | Set the right base endpoint . |
7,312 | public function inspectJsonColumns ( ) { foreach ( $ this -> jsonColumns as $ col ) { if ( ! $ this -> showJsonColumns ) { $ this -> hidden [ ] = $ col ; } if ( array_key_exists ( $ col , $ this -> attributes ) ) { $ obj = json_decode ( $ this -> attributes [ $ col ] ) ; } else { $ obj = json_decode ( $ this -> $ col )... | Decodes each of the declared JSON attributes and records the attributes on each . |
7,313 | public function hintJsonStructure ( $ column , $ structure ) { if ( json_decode ( $ structure ) === null ) { throw new InvalidJsonException ( ) ; } $ this -> hintedJsonAttributes [ $ column ] = $ structure ; $ this -> addHintedAttributes ( ) ; } | Sets a hint for a given column . |
7,314 | public function hasGetMutator ( $ key ) { $ jsonPattern = '/' . implode ( '|' , self :: $ jsonOperators ) . '/' ; if ( array_key_exists ( $ key , $ this -> jsonAttributes ) !== false ) { return true ; } elseif ( preg_match ( $ jsonPattern , $ key ) != false ) { return true ; } return parent :: hasGetMutator ( $ key ) ;... | Include JSON column in the list of attributes that have a get mutator . |
7,315 | public function getMutatedAttributes ( ) { $ attributes = parent :: getMutatedAttributes ( ) ; $ jsonAttributes = array_keys ( $ this -> jsonAttributes ) ; return array_merge ( $ attributes , $ jsonAttributes ) ; } | Include the JSON attributes in the list of mutated attributes for a given instance . |
7,316 | protected function mutateAttribute ( $ key , $ value ) { $ jsonPattern = '/' . implode ( '|' , self :: $ jsonOperators ) . '/' ; $ containsJsonOperator = false ; if ( preg_match ( $ jsonPattern , $ key ) ) { $ elems = preg_split ( $ jsonPattern , $ key ) ; $ key = end ( $ elems ) ; $ key = str_replace ( [ '>' , "'" ] ,... | Check if the key is a known json attribute and return that value . |
7,317 | public static function between ( $ latitude1 , $ longitude1 , $ latitude2 , $ longitude2 , $ decimals = 1 , $ unit = 'km' ) { $ theta = $ longitude1 - $ longitude2 ; $ distance = ( sin ( deg2rad ( $ latitude1 ) ) * sin ( deg2rad ( $ latitude2 ) ) ) + ( cos ( deg2rad ( $ latitude1 ) ) * cos ( deg2rad ( $ latitude2 ) ) *... | Get distance between two coordinates |
7,318 | public static function getClosest ( $ latitude1 , $ longitude1 , $ items , $ decimals = 1 , $ unit = 'km' ) { $ distances = array ( ) ; foreach ( $ items as $ key => $ item ) { $ latitude2 = $ item [ 'latitude' ] ; $ longitude2 = $ item [ 'longitude' ] ; $ distance = self :: between ( $ latitude1 , $ longitude1 , $ lat... | Get closest location from all locations |
7,319 | protected function searchExtractorClassInLib ( $ serviceFullyQualifiedClass ) { $ parts = explode ( '\\' , $ serviceFullyQualifiedClass ) ; $ className = $ parts [ sizeof ( $ parts ) - 1 ] ; $ extractorClass = sprintf ( '\OAuth\UserData\Extractor\%s' , $ className ) ; if ( class_exists ( $ extractorClass ) ) { return $... | Search a mapping on the fly by inspecting the library code |
7,320 | public function initFileActiveRecord ( ) { if ( count ( static :: primaryKey ( ) ) === 1 ) { $ this -> on ( self :: EVENT_BEFORE_INSERT , function ( $ event ) { if ( empty ( $ event -> sender -> { $ event -> data [ 'pkName' ] } ) ) { $ className = $ event -> data [ 'className' ] ; $ lastModel = $ className :: find ( ) ... | Init events of this trait . |
7,321 | static function build ( $ request_name , $ params , $ helper = NULL ) { return self :: processSchema ( self :: getRequestSchema ( $ request_name ) , $ params , $ helper ) ; } | Build an individual request from schema and params . |
7,322 | static function processSchema ( $ schema , $ params , $ helper = NULL ) { $ built = [ ] ; $ errors = [ ] ; ( is_null ( $ helper ) ) ? $ helper = [ 'input' => $ params ] : $ helper [ 'input' ] = $ params ; $ schema [ 'defaults' ] = @ $ schema [ 'defaults' ] ? : [ ] ; if ( isset ( $ helper [ 'override_defaults' ] ) ) $ s... | Process the schema and params to validate and structure a request fragment . |
7,323 | private function updateFile ( ) { if ( is_null ( $ this -> file_path ) ) { throw new StorageException ( 'Invalid file path' ) ; } file_put_contents ( $ this -> file_path , serialize ( [ 'tokens' => $ this -> tokens , 'states' => $ this -> states ] ) ) ; } | Update file containing tokens and states |
7,324 | private function parseFromFile ( ) { if ( is_null ( $ this -> file_path ) ) { throw new StorageException ( 'Invalid file path' ) ; } $ data = unserialize ( file_get_contents ( $ this -> file_path ) ) ; if ( $ data === false ) { throw new StorageException ( 'File contents not unserializeable' ) ; } $ this -> tokens = $ ... | Get serialized content from a file |
7,325 | public function index ( Response $ response ) { $ payload = [ 'resources' => route ( 'v1.books.index' ) , 'authors' => route ( 'v1.authors.index' ) , ] ; return $ response -> setMeta ( [ 'message' => "Hello, I'm a appkr/api example" , 'version' => 1 , 'documentation' => route ( 'v1.doc' ) , ] ) -> respond ( [ 'link' =>... | Exposure a listing of the endpoints . |
7,326 | protected function buildAuthorizationHeaderForTokenRequest ( array $ extraParameters = [ ] ) { $ parameters = $ this -> getBasicAuthorizationHeaderInfo ( ) ; $ parameters = array_merge ( $ parameters , $ extraParameters ) ; $ parameters [ 'oauth_signature' ] = $ this -> signature -> getSignature ( $ this -> getRequestT... | Builds the authorization header for getting an access or request token . |
7,327 | protected function buildAuthorizationHeaderForAPIRequest ( $ method , Url $ uri , TokenInterface $ token , $ bodyParams = null ) { $ this -> signature -> setTokenSecret ( $ token -> getAccessTokenSecret ( ) ) ; $ authParameters = $ this -> getBasicAuthorizationHeaderInfo ( ) ; if ( isset ( $ authParameters [ 'oauth_cal... | Builds the authorization header for an authenticated API request |
7,328 | protected function getBasicAuthorizationHeaderInfo ( ) { $ dateTime = new \ DateTime ( ) ; $ headerParameters = [ 'oauth_callback' => $ this -> credentials -> getCallbackUrl ( ) , 'oauth_consumer_key' => $ this -> credentials -> getConsumerId ( ) , 'oauth_nonce' => $ this -> generateNonce ( ) , 'oauth_signature_method'... | Builds the authorization header array . |
7,329 | protected function generateNonce ( $ length = 32 ) { $ characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' ; $ nonce = '' ; $ maxRand = strlen ( $ characters ) - 1 ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ nonce .= $ characters [ rand ( 0 , $ maxRand ) ] ; } return $ nonce ; } | Pseudo random string generator used to build a unique string to sign each request |
7,330 | function doRequest ( $ action , $ params = [ ] , $ config = [ ] ) { $ this -> request_input = [ 'action' => $ action , 'parameters' => $ params ] ; return $ this -> getSoapClient ( $ config ) -> __soapCall ( $ action , [ $ params ] ) ; } | Send off the request to the Royal Mail API |
7,331 | private function parseSegments ( $ field ) { $ field = starts_with ( '\\' , $ field ) ? $ field : '\\' . $ field ; $ segments = explode ( ':' , $ field ) ; if ( count ( $ segments ) < 2 ) { throw new \ Exception ( '--includes option should be consist of string value of model, separated by colon(:), and s... | Get the segments of the option field . |
7,332 | public function updateFile ( $ fileId , array $ data ) { $ xml = "<file>" ; if ( isset ( $ data [ 'name' ] ) ) { $ xml .= "<name>{$data['name']}</name>" ; } if ( isset ( $ data [ 'categoryId' ] ) ) { $ xml .= "<categoryId>{$data['categoryId']}</categoryId>" ; } if ( isset ( $ data [ 'shareWithEmployee' ] ) ) { $ xml .=... | Update a given file |
7,333 | protected function getLoaderData ( $ field ) { $ loaderName = $ this -> loadersMap -> getLoaderForField ( $ field ) ; if ( ! isset ( $ this -> loadersResults [ $ loaderName ] ) ) { $ this -> loadersResults [ $ loaderName ] = $ this -> { sprintf ( '%sLoader' , $ loaderName ) } ( ) ; } return $ this -> loadersResults [ $... | Get data from a loader . A loader is a function who is delegated to fetch a request to get the raw data |
7,334 | protected function extraNormalizer ( $ data , $ path = '' ) { if ( is_array ( $ data ) ) { if ( ! $ path ) { $ path = $ this -> normalizersMap -> getPathContext ( ) ; } $ path = trim ( $ path , '.' ) ; $ pathsFields = [ ] ; foreach ( $ this -> normalizersMap -> getPathNormalizers ( ) as $ normalizer ) { $ pathsFields [... | Generic extra normalizer |
7,335 | protected function seedHandlerStack ( ) { if ( ! is_null ( $ this -> handlers ) ) { throw new \ RuntimeException ( 'Handler stacks can only be seeded once.' ) ; } $ this -> stacks = [ ] ; $ base = new BaseHandler ( ) ; $ this -> handlers = [ $ base ] ; $ this -> stacks [ 'delete' ] = new \ SplStack ( ) ; $ this -> stac... | Seed handler stack with first callable |
7,336 | public static function initialize ( ) { $ manager = self :: $ manager = new self ( ) ; $ manager -> seedHandlerStack ( ) ; session_set_save_handler ( $ manager ) ; return $ manager ; } | Initialize the session manager . |
7,337 | public function close ( ) { $ this -> handlerLock = true ; while ( count ( $ this -> handlers ) > 0 ) { array_pop ( $ this -> handlers ) ; $ this -> stacks [ 'delete' ] -> pop ( ) ; $ this -> stacks [ 'clean' ] -> pop ( ) ; $ this -> stacks [ 'create' ] -> pop ( ) ; $ this -> stacks [ 'read' ] -> pop ( ) ; $ this -> st... | Close the current session . |
7,338 | public function destroy ( $ session_id ) { if ( is_null ( $ this -> handlers ) ) { $ this -> seedHandlerStack ( ) ; } $ start = $ this -> stacks [ 'delete' ] -> top ( ) ; $ this -> handlerLock = true ; $ data = $ start ( $ session_id ) ; $ this -> handlerLock = false ; return $ data ; } | Destroy a session by either invalidating it or forcibly removing it from session storage . |
7,339 | public function open ( $ save_path , $ name ) { if ( is_null ( $ this -> handlers ) ) { $ this -> seedHandlerStack ( ) ; } $ start = $ this -> stacks [ 'create' ] -> top ( ) ; $ this -> handlerLock = true ; $ data = $ start ( $ save_path , $ name ) ; $ this -> handlerLock = false ; return $ data ; } | Create a new session storage . |
7,340 | protected function getField ( $ field ) { if ( $ this -> isFieldSupported ( $ field ) && isset ( $ this -> fields [ $ field ] ) ) { return $ this -> fields [ $ field ] ; } return null ; } | Get the value for a given field |
7,341 | protected static function getAllFields ( ) { return FieldsValues :: construct ( [ self :: FIELD_UNIQUE_ID , self :: FIELD_USERNAME , self :: FIELD_FIRST_NAME , self :: FIELD_LAST_NAME , self :: FIELD_FULL_NAME , self :: FIELD_EMAIL , self :: FIELD_DESCRIPTION , self :: FIELD_LOCATION , self :: FIELD_PROFILE_URL , self ... | Get an array listing all fields names |
7,342 | public function submitRequest ( $ employeeId , array $ data = [ ] ) { $ xml = "<request>" ; if ( isset ( $ data [ 'status' ] ) ) { $ xml .= "<status>{$data['status']}</status>" ; } else { $ xml .= "<status>requested</status>" ; } $ xml .= "<start>{$data['start']}</start> <end>{$data['end']}</end> ... | Submit a new time off request for a given employeeId |
7,343 | public function addHistoryEntry ( $ employeeId , $ requestId , string $ date , string $ note ) { $ xml = " <history> <date>{$date}</date> <eventType>used</eventType> <timeOffRequestId>{$requestId}</timeOffRequestId> <note>{$note}</note> <... | Add a time off history entry |
7,344 | public function assignedPolicies ( $ employeeId ) { $ this -> bamboo -> options [ 'version' ] = 'v1_1' ; $ response = $ this -> get ( "employees/{$employeeId}/time_off/policies" ) ; $ this -> bamboo -> options [ 'version' ] = 'v1' ; return $ response ; } | List assigned time off policies for a given employee |
7,345 | public function assignPolicy ( $ employeeId , array $ policies ) { $ this -> bamboo -> options [ 'version' ] = 'v1_1' ; $ response = $ this -> put ( "employees/{$employeeId}/time_off/policies" , json_encode ( $ policies ) ) ; $ this -> bamboo -> options [ 'version' ] = 'v1' ; return $ response ; } | Assign one or more time off policies to a given employee |
7,346 | public function get ( $ queueName ) { if ( ! isset ( $ this -> queues [ $ queueName ] ) ) { throw new \ OutOfBoundsException ( sprintf ( 'The collection does not contain the queue "%s".' , $ queueName ) ) ; } return $ this -> queues [ $ queueName ] ; } | Gets the queue by its name . |
7,347 | public function remove ( $ queueName ) { $ queue = null ; if ( isset ( $ this -> queues [ $ queueName ] ) ) { $ queue = $ this -> queues [ $ queueName ] ; } unset ( $ this -> queues [ $ queueName ] ) ; return $ queue ; } | Removes the queue from the collection . |
7,348 | static function doSkipThisIfThatEmpty ( $ val , $ settings , $ helper = NULL ) { if ( is_string ( $ settings ) ) $ settings = [ 'that' => $ settings ] ; if ( ! self :: checkPath ( $ settings [ 'that' ] , [ ] , $ helper ) ) throw new SkipException ( 'Skipping as ' . $ settings [ 'that' ] . ' is blank' ) ; return $ val ;... | Skip this field if another field is empty - works on input array so far can add output test later . |
7,349 | public function unsetMinify ( ) { $ this -> pug -> removeKeyword ( 'assets' ) ; $ this -> pug -> removeKeyword ( 'concat' ) ; $ this -> pug -> removeKeyword ( 'concat-to' ) ; $ this -> pug -> removeKeyword ( 'minify' ) ; $ this -> pug -> removeKeyword ( 'minify-to' ) ; $ this -> minify = null ; return $ this ; } | Remove the keywords . |
7,350 | public function method ( $ field , $ methodName = null ) { if ( ! $ methodName ) { $ methodName = $ field ; } if ( ! is_string ( $ field ) ) { throw new GenericException ( 'Must be a string!' ) ; } if ( ! is_string ( $ methodName ) ) { throw new GenericException ( 'Must be a string!' ) ; } $ this -> fields [ $ field ] ... | Add field method |
7,351 | public function methods ( array $ fieldsMethods ) { foreach ( $ fieldsMethods as $ field => $ path ) { $ this -> method ( $ field , $ path ) ; } return $ this ; } | Add fields methods |
7,352 | public function path ( $ field , $ path , $ defaultValue = null ) { if ( ! is_string ( $ field ) ) { throw new GenericException ( 'Must be a string!' ) ; } if ( ! is_string ( $ path ) ) { throw new GenericException ( 'Must be not empty string!' ) ; } $ this -> fields [ $ field ] = [ 'type' => self :: TYPE_ARRAY_PATH , ... | Add field path |
7,353 | public function paths ( array $ fieldPaths ) { foreach ( $ fieldPaths as $ field => $ path ) { if ( is_array ( $ path ) ) { $ this -> path ( $ field , $ path [ 0 ] , $ path [ 1 ] ) ; } else { $ this -> path ( $ field , $ path ) ; } } return $ this ; } | Add fields paths |
7,354 | public function prefilled ( $ field , $ value ) { $ this -> fields [ $ field ] = [ 'type' => self :: TYPE_PREFILLED_VALUE , 'value' => $ value ] ; return $ this ; } | Only return value if data loaded |
7,355 | public function getNormalizerForField ( $ field ) { if ( ! empty ( $ this -> fields [ $ field ] ) ) { return $ this -> fields [ $ field ] ; } else { return false ; } } | Get normalizer for field |
7,356 | public function pathContext ( $ pathContext ) { if ( ! is_string ( $ pathContext ) ) { throw new GenericException ( 'Must be a string!' ) ; } $ this -> contextPath = ltrim ( $ pathContext . '.' , '.' ) ; return $ this ; } | Set path context . All next fields will be added with prepended path |
7,357 | public function prependByPathContext ( $ pathContext ) { $ this -> pathContext ( $ pathContext ) ; foreach ( $ this -> getPathNormalizers ( ) as $ field => $ normalizer ) { $ this -> path ( $ field , $ normalizer [ 'pathWithoutContext' ] , $ normalizer [ 'defaultValue' ] ) ; } return $ this ; } | Prepend all added fields paths |
7,358 | public function cancelAllNotStartedChildJobs ( Job $ job ) { if ( ! $ job -> isRoot ( ) || ! $ job -> getChildJobs ( ) ) { return ; } foreach ( $ job -> getChildJobs ( ) as $ childJob ) { if ( in_array ( $ childJob -> getStatus ( ) , $ this -> getNotStartedJobStatuses ( ) , true ) ) { $ this -> cancelChildJob ( $ child... | Cancels running for all child jobs that are not in run status . |
7,359 | protected function filterTrailingSlash ( UriInterface $ uri ) { $ path = $ uri -> getPath ( ) ; if ( strlen ( $ path ) > 1 && substr ( $ path , - 1 ) === '/' ) { $ path = substr ( $ path , 0 , - 1 ) ; } return $ path ; } | Provide filter to trim trailing slashes in URI path |
7,360 | protected function filterRequestMethod ( Request $ req ) { $ method = strtoupper ( $ req -> getMethod ( ) ) ; if ( $ method != 'POST' ) { return $ req ; } $ params = $ req -> getParsedBody ( ) ; if ( isset ( $ params [ '_method' ] ) ) { $ req = $ req -> withMethod ( $ params [ '_method' ] ) ; } return $ req ; } | This provide a method - overwrite for GET and POST request |
7,361 | public function filter_field ( $ key , $ value ) { if ( $ key == 'emailMD5' && false !== strpos ( $ value , '@' ) ) { return md5 ( strtolower ( $ value ) ) ; } if ( ( $ key == 'usernameMD5' || $ key == 'passwordMD5' ) && strlen ( $ value ) != 32 ) { return md5 ( strtolower ( $ value ) ) ; } return $ value ; } | If key matches one of emailMD5 usernameMD5 or passwordMD5 convert value to lowercase and return the md5 . |
7,362 | public function send ( $ subject , $ content , $ data = [ ] , callable $ callback = null ) { $ this -> driver -> subject ( $ subject ) -> content ( $ content , $ data ) ; if ( null !== $ callback ) { $ callback ( $ this -> driver ) ; } return $ this -> driver -> send ( ) ; } | Send the thing . |
7,363 | public function injectIndexClient ( \ Flowpack \ SimpleSearch \ Domain \ Service \ IndexInterface $ indexClient ) { $ this -> indexClient = $ indexClient ; } | Injection method used by Flow dependency injection |
7,364 | public function like ( $ propertyName , $ propertyValue ) { $ parameterName = ':' . md5 ( $ propertyName . '#' . count ( $ this -> where ) ) ; $ this -> where [ ] = '(`' . $ propertyName . '` LIKE ' . $ parameterName . ')' ; $ this -> parameterMap [ $ parameterName ] = '%' . $ propertyValue . '%' ; return $ this ; } | add an like query for a given property |
7,365 | public function execute ( ) { $ query = $ this -> buildQueryString ( ) ; $ result = $ this -> indexClient -> executeStatement ( $ query , $ this -> parameterMap ) ; if ( empty ( $ result ) ) { return array ( ) ; } return array_values ( $ result ) ; } | Execute the query and return the list of results |
7,366 | public function fulltextMatchResult ( $ searchword , $ resultTokens = 60 , $ ellipsis = '...' , $ beginModifier = '<b>' , $ endModifier = '</b>' ) { $ query = $ this -> buildQueryString ( ) ; $ results = $ this -> indexClient -> query ( $ query ) ; $ chunks = array_chunk ( $ results , 990 ) ; foreach ( $ chunks as $ ch... | Produces a snippet with the first match result for the search term . |
7,367 | public function anyMatch ( $ propertyName , $ propertyValues ) { if ( $ propertyValues === null || empty ( $ propertyValues ) || $ propertyValues [ 0 ] === null ) { return $ this ; } $ queryString = null ; $ lastElemtentKey = count ( $ propertyValues ) - 1 ; foreach ( $ propertyValues as $ key => $ propertyValue ) { $ ... | Match any value in the given array for the property |
7,368 | public function getPaths ( $ extension = null ) { if ( isset ( $ extension ) ) { if ( isset ( $ this -> paths [ $ extension ] ) ) { return $ this -> paths [ $ extension ] ; } return ; } return $ this -> paths ; } | Get a list of language files that have been loaded . |
7,369 | public function paginatedList ( $ parameters = [ ] ) { return $ this -> sendRequest ( self :: METHOD_GET , self :: $ endPoints [ 'list' ] . '?' . http_build_query ( $ parameters ) ) ; } | Paginated listing of tokens . |
7,370 | public function listAssociatedUsers ( $ deviceToken , $ parameters = [ ] ) { return $ this -> prepareRequest ( self :: METHOD_GET , $ deviceToken , self :: $ endPoints [ 'listAssociatedUsers' ] . '?' . http_build_query ( $ parameters ) ) ; } | List users associated with the indicated token |
7,371 | public function associateUser ( $ deviceToken , $ userId ) { $ endPoint = str_replace ( ':user_id' , $ userId , self :: $ endPoints [ 'associateUser' ] ) ; return $ this -> prepareRequest ( self :: METHOD_POST , $ deviceToken , $ endPoint ) ; } | Associate the indicated user with the indicated device token |
7,372 | public function dissociateUser ( $ deviceToken , $ userId ) { $ endPoint = str_replace ( ':user_id' , $ userId , self :: $ endPoints [ 'dissociateUser' ] ) ; return $ this -> prepareRequest ( self :: METHOD_DELETE , $ deviceToken , $ endPoint ) ; } | Dissociate the indicated user with the indicated device token |
7,373 | public static function show ( $ terms = null , array $ columns = [ ] ) { $ self = self :: newSelf ( ) ; if ( ! $ self -> table ( ) ) { return false ; } $ query = $ self -> select ( $ columns ) ; $ self -> normalizeTerms ( $ query , $ terms ) ; $ model = $ self -> attributes ? static :: class : $ self ; return new Resul... | Show specific or all data |
7,374 | public static function create ( array $ pairs = null ) { $ self = self :: newSelf ( $ pairs ) ; if ( ! empty ( $ self -> attributes ) && null === $ pairs ) { $ pairs = $ self -> attributes ; } if ( ! $ self -> table ( ) ) { return false ; } if ( empty ( $ pairs ) ) { throw new \ LogicException ( 'Could not create empty... | Create new data |
7,375 | public static function patch ( $ pairs = null , $ terms = null ) { $ self = self :: newSelf ( ) ; if ( ! $ self -> table ( ) ) { return false ; } if ( ! empty ( $ self -> attributes ) && null === $ terms ) { $ terms = $ self -> attributes ; } if ( empty ( $ pairs ) ) { throw new \ LogicException ( 'Could not update emp... | Update spesific data |
7,376 | public static function delete ( $ terms = null ) { $ self = static :: newSelf ( $ terms ) ; if ( ! empty ( $ self -> attributes ) && null === $ terms ) { $ terms = $ self -> attributes [ $ self -> primary ( ) ] ; } if ( empty ( $ terms ) ) { throw new \ LogicException ( 'Could not delete empty data' ) ; } if ( $ self -... | Delete specific data |
7,377 | public static function restore ( $ terms = null ) { $ self = self :: newSelf ( ) ; if ( $ self -> softDeletes ) { return $ self -> patch ( [ self :: DELETED => '0000-00-00 00:00:00' ] , $ terms ) ; } return false ; } | Restore soft - deleted data |
7,378 | public function count ( $ terms = null ) { if ( ! $ this -> table ( ) ) { return 0 ; } $ query = $ this -> select ( [ 'count(*) count' ] ) ; $ this -> normalizeTerms ( $ query , $ terms ) ; return ( int ) $ query -> execute ( ) -> fetch ( ) [ 'count' ] ; } | Count all data |
7,379 | protected function select ( array $ columns = [ ] ) { $ columns = ! is_array ( $ columns ) ? func_get_args ( ) : $ columns ; if ( empty ( $ columns ) ) { $ columns = [ '*' ] ; } return static :: db ( ) -> select ( $ columns ) -> from ( $ this -> table ( ) ) ; } | Select data from table |
7,380 | protected function normalizeTerms ( StatementContainer $ stmt , $ terms ) { if ( $ terms instanceof Models ) { $ terms = $ terms -> key ( ) ; } if ( is_callable ( $ terms ) ) { $ terms ( $ stmt ) ; } elseif ( is_numeric ( $ terms ) && ! is_float ( $ terms ) ) { $ stmt -> where ( $ this -> primary , '=' , ( int ) $ term... | Normalize query terms |
7,381 | public function getRecord ( int $ recordID ) { foreach ( $ this -> getRecords ( ) as $ key => $ record ) { if ( $ record [ $ this -> primaryKey ] == $ recordID ) { return $ record ; } } return null ; } | This function returns a specific record by id |
7,382 | public function updateRecord ( int $ recordID , array $ data ) { foreach ( $ this -> getRecords ( ) as $ key => $ record ) { if ( $ recordID == $ record [ $ this -> primaryKey ] ) { foreach ( $ data as $ dataKey => $ dataValue ) { if ( isset ( $ record [ $ dataKey ] ) ) { $ record [ $ dataKey ] = $ dataValue ; } } $ th... | This function updates a record It will return updated records |
7,383 | public function deleteRecord ( int $ recordID ) { foreach ( $ this -> getRecords ( ) as $ key => $ record ) { if ( $ record [ 'id' ] == $ recordID ) { $ this -> database -> getReference ( ) -> getChild ( $ this -> table ) -> getChild ( $ key ) -> set ( null ) ; return true ; } } return false ; } | This function deletes a record from your database . It will return boolean after action was commited |
7,384 | public function input ( $ prompt , $ default = '' , $ acceptable = null , $ strict = false ) { if ( $ this -> hasSttyAvailable ( ) ) { $ input = $ this -> climate -> input ( $ prompt ) ; if ( ! empty ( $ default ) ) { $ input -> defaultTo ( $ default ) ; } if ( null !== $ acceptable ) { $ input -> accept ( $ acceptable... | Wanna ask something |
7,385 | public function password ( $ prompt ) { if ( $ this -> hasSttyAvailable ( ) ) { $ password = $ this -> climate -> password ( $ prompt ) ; return $ password -> prompt ( ) ; } return '' ; } | Ask something secretly? |
7,386 | public function confirm ( $ prompt ) { if ( $ this -> hasSttyAvailable ( ) ) { $ confirm = $ this -> climate -> confirm ( $ prompt ) ; return $ confirm -> confirmed ( ) ; } return '' ; } | Choise between yes or no? |
7,387 | public function checkboxes ( $ prompt , array $ options ) { if ( $ this -> hasSttyAvailable ( ) ) { $ checkboxes = $ this -> climate -> checkboxes ( $ prompt , $ options ) ; return $ checkboxes -> prompt ( ) ; } return '' ; } | Choise multiple answer from given options? |
7,388 | public function radio ( $ prompt , array $ options ) { if ( $ this -> hasSttyAvailable ( ) ) { $ radio = $ this -> climate -> radio ( $ prompt , $ options ) ; return $ radio -> prompt ( ) ; } return '' ; } | Choise an answer from given options? |
7,389 | public function setConfig ( $ notificationData , $ payloadData = [ ] , $ silentNotification = false , $ scheduledDateTime = '' , $ sound = 'default' ) { if ( ! is_array ( $ notificationData ) ) { $ notificationData = [ $ notificationData ] ; } if ( count ( $ notificationData ) > 0 ) { $ this -> requestData = array_merg... | Set notification config . |
7,390 | public function paginatedList ( $ parameters = [ ] ) { $ response = $ this -> sendRequest ( self :: METHOD_GET , self :: $ endPoints [ 'list' ] . '?' . http_build_query ( $ parameters ) , $ this -> requestData ) ; $ this -> resetRequestData ( ) ; return $ response ; } | Paginated listing of Push Notifications . |
7,391 | public function retrieve ( $ notificationId ) { $ response = $ this -> sendRequest ( self :: METHOD_GET , str_replace ( ':notification_id' , $ notificationId , self :: $ endPoints [ 'retrieve' ] ) , $ this -> requestData ) ; $ this -> resetRequestData ( ) ; return $ response ; } | Get a Notification . |
7,392 | public function delete ( $ notificationId ) { return $ this -> sendRequest ( self :: METHOD_DELETE , str_replace ( ':notification_id' , $ notificationId , self :: $ endPoints [ 'delete' ] ) ) ; } | Deletes a notification . |
7,393 | public function deleteAll ( ) { $ responses = array ( ) ; $ notifications = self :: paginatedList ( ) ; if ( $ notifications [ 'success' ] ) { foreach ( $ notifications [ 'response' ] [ 'data' ] as $ notification ) { $ responses [ ] = self :: delete ( $ notification -> uuid ) ; } } else { return array ( $ notifications... | Deletes all notifications |
7,394 | public function listMessages ( $ notificationId , $ parameters = [ ] ) { $ endPoint = str_replace ( ':notification_id' , $ notificationId , self :: $ endPoints [ 'listMessages' ] ) ; $ response = $ this -> sendRequest ( self :: METHOD_GET , $ endPoint . '?' . http_build_query ( $ parameters ) , $ this -> requestData ) ... | List messages of the indicated notification . |
7,395 | private function create ( ) { $ response = $ this -> sendRequest ( self :: METHOD_POST , self :: $ endPoints [ 'create' ] , $ this -> requestData ) ; $ this -> resetRequestData ( ) ; return $ response ; } | Create a Push Notification . |
7,396 | public static function utf8_latin_to_ascii ( $ string , $ case = 0 ) { if ( $ case <= 0 ) { $ string = str_replace ( array_keys ( self :: $ utf8LowerAccents ) , array_values ( self :: $ utf8LowerAccents ) , $ string ) ; } if ( $ case >= 0 ) { $ string = str_replace ( array_keys ( self :: $ utf8UpperAccents ) , array_va... | Returns strings transliterated from UTF - 8 to Latin |
7,397 | public function retrieve ( $ messageId ) { return $ this -> sendRequest ( self :: METHOD_GET , str_replace ( ':message_id' , $ messageId , self :: $ endPoints [ 'retrieve' ] ) ) ; } | Get Message details . Use this method to check the current status of a message or to lookup the error code for failures . |
7,398 | private function initializeDatabase ( array $ settings ) { if ( ! isset ( $ settings [ 'dsn' ] ) || ! $ settings [ 'dsn' ] ) { $ settings [ 'charset' ] = isset ( $ settings [ 'charset' ] ) ? $ settings [ 'charset' ] : 'utf8' ; $ settings [ 'dsn' ] = sprintf ( '%s:host=%s;dbname=%s;charset=%s' , $ settings [ 'driver' ] ... | Initialize database settings |
7,399 | public function fetch ( $ template , $ data = null ) { $ layout = $ this -> getLayout ( $ data ) ; $ result = $ this -> render ( $ template , $ data ) ; if ( is_string ( $ layout ) ) { $ result = $ this -> renderLayout ( $ layout , $ result , $ data ) ; } return $ result ; } | Override the default fetch mechanism to render a layout if set . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.