idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
9,400 | protected function appendReceivedTransformations ( Transformer $ transformer , $ received ) { if ( ! empty ( $ received ) ) { $ template = new Template ( '__' ) ; foreach ( $ received as $ transformation ) { $ template [ ] = $ transformation ; } $ transformer -> getTemplates ( ) -> append ( $ template ) ; } } | Append received transformations . |
9,401 | protected function getProgressBar ( InputInterface $ input ) { $ progress = parent :: getProgressBar ( $ input ) ; if ( ! $ progress ) { return null ; } $ eventDispatcher = $ this -> getService ( 'event_dispatcher' ) ; $ eventDispatcher -> addListener ( 'transformer.transformation.post' , function ( ) use ( $ progress ... | Adds the transformer . transformation . post event to advance the progressbar . |
9,402 | public function rsearch ( $ folder , $ pattern ) { $ dir = new RecursiveDirectoryIterator ( $ folder ) ; $ iterator = new RecursiveIteratorIterator ( $ dir ) ; $ files = new RegexIterator ( $ iterator , $ pattern , RegexIterator :: GET_MATCH ) ; $ fileList = [ ] ; foreach ( $ files as $ file ) { $ fileList = array_merg... | Search the given folder recursively for files using a regular expression pattern . |
9,403 | public function getUrl ( $ path ) { $ mapping = $ this -> mapper -> get ( $ path ) ; if ( ! $ mapping ) { return false ; } try { $ volume = $ this -> client -> lookup ( $ mapping [ 'fid' ] ) ; return $ this -> client -> buildVolumeUrl ( $ volume -> getPublicUrl ( ) , $ mapping [ 'fid' ] ) ; } catch ( SeaweedFSException... | Get the public URL of a path . |
9,404 | public function getLicenseByIdentifier ( $ identifier ) { if ( ! isset ( $ this -> licenses [ $ identifier ] ) ) { return ; } $ license = $ this -> licenses [ $ identifier ] ; $ license [ 2 ] = 'http://spdx.org/licenses/' . $ identifier . '#licenseText' ; return $ license ; } | Returns license metadata by license identifier . |
9,405 | public function getIdentifierByName ( $ name ) { foreach ( $ this -> licenses as $ identifier => $ licenseData ) { if ( $ licenseData [ 0 ] === $ name ) { return $ identifier ; } } } | Returns the short identifier of a license by full name . |
9,406 | public function listen ( ) { $ notifications = $ this -> repository -> findSendable ( ) -> toArray ( ) ; foreach ( $ notifications as $ notification ) { $ this -> listenNotificationsEvents ( $ notification ) ; } } | Listening for notifications |
9,407 | protected function listenNotificationsEvents ( array $ notification ) { $ events = Arr :: get ( $ notification , 'event' ) ; if ( $ events === null && isset ( $ notification [ 'classname' ] ) ) { $ events = app ( ) -> make ( $ notification [ 'classname' ] ) -> getEvents ( ) ; } foreach ( ( array ) $ events as $ event )... | Runs notification events . |
9,408 | protected function runNotificationListener ( string $ event , array $ notification ) { app ( 'events' ) -> listen ( $ event , function ( array $ variables = null , array $ recipients = null ) use ( $ notification ) { $ this -> eventDispatcher -> run ( $ notification , $ variables , $ recipients ) ; } ) ; } | Runs notification listener . |
9,409 | public static function fromHex ( $ hex ) { if ( strlen ( $ hex ) != 2 ) { throw new Exception ( "given parameter '" . $ hex . "' is not a valid hexadecimal number" ) ; } return new self ( chr ( hexdec ( $ hex ) ) ) ; } | Returns the Char based on a given hex value . |
9,410 | public function discoverFields ( ) { if ( ! empty ( $ this -> fields ) ) { return ; } $ sm = $ this -> db ( ) -> getSchemaManager ( ) ; $ columns = $ sm -> listTableColumns ( $ this -> table ) ; foreach ( $ columns as $ column ) { $ this -> fields [ $ column -> getName ( ) ] = array ( 'name' => $ column -> getName ( ) ... | Gets info of the fields from the table . |
9,411 | public function setField ( $ name , $ value ) { if ( isset ( $ this -> fields [ $ name ] ) ) { $ this -> isDirty = TRUE ; return $ this -> record [ $ name ] = $ value ; } throw new \ Exception ( 'Not a valid Field for Set ' . $ name ) ; } | Sets a field to the record . |
9,412 | public function getField ( $ name ) { if ( isset ( $ this -> fields [ $ name ] ) ) { return $ this -> record [ $ name ] ; } if ( isset ( $ this -> fetchedRecord [ $ name ] ) ) { return $ this -> fetchedRecord [ $ name ] ; } throw new \ Exception ( 'Not a valid Field for Get ' . $ name ) ; } | Gets a Field from Record . |
9,413 | public function insert ( ) { $ this -> db ( ) -> insert ( $ this -> table , $ this -> record ) ; $ id = $ this -> db ( ) -> lastInsertId ( ) ; $ this -> record [ $ this -> id_name ] = $ id ; $ this -> isDirty = FALSE ; return $ this ; } | Inserts the record . |
9,414 | public function update ( ) { $ this -> db ( ) -> update ( $ this -> table , $ this -> record , $ this -> identifier ( ) ) ; $ this -> isDirty = FALSE ; return $ this ; } | Updates the record . |
9,415 | public function delete ( ) { if ( $ this -> isNew ( ) ) { throw new \ Exception ( 'ID is not setted for Delete' ) ; } $ this -> db ( ) -> delete ( $ this -> table , $ this -> identifier ( ) ) ; $ this -> isDeleted = TRUE ; return $ this ; } | Deletes the record . |
9,416 | public function identifier ( ) { if ( empty ( $ this -> record [ $ this -> id_name ] ) ) { return FALSE ; } return array ( $ this -> id_name => $ this -> record [ $ this -> id_name ] ) ; } | Provides the Id in array format column - value . False if is a new object . |
9,417 | public function getId ( ) { if ( empty ( $ this -> record [ $ this -> id_name ] ) ) { return FALSE ; } return $ this -> record [ $ this -> id_name ] ; } | Gets the ID value or false . |
9,418 | public function setRecord ( $ record ) { $ this -> resetObject ( ) ; $ newRecord = array ( ) ; foreach ( $ this -> fields as $ field_name => $ field ) { if ( ! empty ( $ record [ $ field_name ] ) ) { $ newRecord [ $ field_name ] = $ record [ $ field_name ] ; } else { $ newRecord [ $ field_name ] = '' ; } } $ this -> re... | Sets the internal record with a new record . |
9,419 | public function mergeRecord ( $ record ) { if ( $ this -> isNew ( ) ) { throw new \ Exception ( 'Can not merge, is new' ) ; } foreach ( $ this -> fields as $ field_name => $ field ) { if ( ! empty ( $ record [ $ field_name ] ) ) { $ this -> record [ $ field_name ] = $ record [ $ field_name ] ; } $ this -> isDirty = TRU... | Update partial values of the record and keep the current non modified values . |
9,420 | public function fetchOne ( $ sql , $ params = array ( ) ) { $ result = $ this -> db ( ) -> fetchAssoc ( $ sql , $ params ) ; if ( ! empty ( $ result ) ) { $ this -> setRecord ( $ result ) ; return $ this ; } return FALSE ; } | Fetchs one record with the given query . |
9,421 | public function hydrate ( PDOStatement $ results ) { if ( method_exists ( $ this , 'preHydrate' ) ) { $ results = $ this -> preHydrate ( $ results ) ; } $ return = array ( ) ; if ( $ results ) { $ arrayResults = $ results -> fetchAll ( ) ; foreach ( $ arrayResults as $ arrayResult ) { $ className = get_class ( $ this )... | Default Hydrate . |
9,422 | public function findRelatedModel ( $ modelName , $ field , $ id = NULL ) { $ relatedModel = $ this -> getInstance ( $ modelName ) ; if ( $ this -> isNew ( ) && $ id === NULL ) { throw new \ Exception ( 'No id for related' ) ; } if ( $ id === NULL ) { $ id = $ this -> getField ( $ field ) ; } $ result = $ relatedModel -... | Finds a related model instance by the given field name and the id value . |
9,423 | public function findRelatedModels ( $ modelName , $ field , $ id = NULL ) { $ relatedModel = $ this -> getInstance ( $ modelName ) ; if ( $ this -> isNew ( ) && $ id === NULL ) { throw new \ Exception ( 'No id for related' ) ; } if ( $ id === NULL ) { $ id = $ this -> getId ( ) ; } $ result = $ relatedModel -> findByFi... | Finds related models instances using the field name and the id value . |
9,424 | static public function plain ( $ objects ) { $ data = array ( ) ; foreach ( $ objects as $ object ) { $ data [ ] = $ object -> getRecord ( ) ; } return $ data ; } | Convert the array of objects into a plain array . |
9,425 | public function createQuery ( ) { $ query = $ this -> db ( ) -> createQueryBuilder ( ) ; $ query -> select ( 't.*' ) -> from ( $ this -> table , 't' ) ; return $ query ; } | Creates a QueryBuilder with the table selected . |
9,426 | public function findAllPaged ( $ page = 0 , $ limit = 20 ) { $ results = $ this -> findAllWithoutFetchPaged ( $ page , $ limit ) ; $ return = $ this -> hydrate ( $ results ) ; return $ return ; } | Finds all records of a table paged . |
9,427 | public function findAllWithoutFetchPaged ( $ page = 0 , $ limit = 20 ) { $ offset = $ page * $ limit ; $ results = $ this -> createQuery ( ) -> setFirstResult ( $ offset ) -> setMaxResults ( $ limit ) -> execute ( ) ; return $ results ; } | Finds all records of a table . |
9,428 | protected function redirectAfterUpdate ( ) { merchant_toastr ( trans ( 'merchant.update_succeeded' ) ) ; $ url = Input :: get ( Builder :: PREVIOUS_URL_KEY ) ? : $ this -> resource ( - 1 ) ; return redirect ( $ url ) ; } | Get RedirectResponse after update . |
9,429 | public function actionIndex ( ) { $ model = new Location ( ) ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { $ model = new Location ( ) ; } $ searchModel = new LocationSearch ( [ 'pagination' => TRUE ] ) ; $ dataProvider = $ searchModel -> search ( \ Yii :: $ app -> request -... | Lists all Location models . |
9,430 | public function resolveOptions ( $ options , $ defaults , $ required = [ ] , $ allowedTypes = [ ] ) { $ resolver = new OptionsResolver ( ) ; $ resolver -> setDefaults ( $ defaults ) ; if ( ! empty ( $ required ) ) { $ resolver -> setRequired ( $ required ) ; } if ( ! empty ( $ allowedTypes ) ) { foreach ( $ allowedType... | Helper function for resolving parameters . |
9,431 | public function setSeller ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Seller $ seller = null ) { $ this -> seller = $ seller ; return $ this ; } | Set seller . |
9,432 | public function addProduct ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Product \ Product $ product ) { $ this -> products [ ] = $ product ; return $ this ; } | Add product . |
9,433 | public function removeProduct ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Product \ Product $ product ) { return $ this -> products -> removeElement ( $ product ) ; } | Remove product . |
9,434 | public function addTransport ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Transport \ Transport $ transport ) { $ this -> transports [ ] = $ transport ; return $ this ; } | Add transport . |
9,435 | public function removeTransport ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Transport \ Transport $ transport ) { return $ this -> transports -> removeElement ( $ transport ) ; } | Remove transport . |
9,436 | public function addInvoice ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Invoice \ Invoice $ invoice ) { $ this -> invoices [ ] = $ invoice ; return $ this ; } | Add invoice . |
9,437 | public function removeInvoice ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Invoice \ Invoice $ invoice ) { return $ this -> invoices -> removeElement ( $ invoice ) ; } | Remove invoice . |
9,438 | public function addPayment ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Payment \ Payment $ payment ) { $ this -> payments [ ] = $ payment ; return $ this ; } | Add payment . |
9,439 | public function addConciliation ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Conciliation \ Conciliation $ conciliation ) { $ this -> conciliations [ ] = $ conciliation ; return $ this ; } | Add conciliation . |
9,440 | public function removeConciliation ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Trading \ Order \ Shipping \ Conciliation \ Conciliation $ conciliation ) { return $ this -> conciliations -> removeElement ( $ conciliation ) ; } | Remove conciliation . |
9,441 | public function configure ( Composer $ composer , IOInterface $ io ) { $ this -> composer = $ composer ; $ this -> jsonFile = null ; $ this -> io = $ io ; $ publicDirectorySet = $ this -> isPublicDirectorySet ( ) ; $ wordPressInstallDirectorySet = $ this -> isWordPressInstallDirectorySet ( ) ; $ reposConfigured = $ thi... | Configure the composer . json file . |
9,442 | protected function setPublicDirectory ( ) { if ( ! $ this -> json ) { $ this -> readJson ( ) ; } $ this -> json [ 'extra' ] [ 'public-dir' ] = $ this -> plugin -> getPublicDirectory ( ) ; } | Set the public directory in the composer . json . |
9,443 | protected function setWordPressInstallDirectory ( ) { if ( ! $ this -> json ) { $ this -> readJson ( ) ; } $ this -> json [ 'extra' ] [ 'wordpress-install-dir' ] = $ this -> plugin -> getPublicDirectory ( ) . '/wp' ; } | Set the WordPress installation directory in the composer . json . |
9,444 | protected function areReposConfigured ( ) { if ( ! $ this -> json ) { $ this -> readJson ( ) ; } return ! empty ( $ this -> json [ 'repositories' ] ) && $ this -> pregGrepRecursive ( '/^http(s|\?)?:\/\/wpackagist\.org\/?$/' , $ this -> json [ 'repositories' ] ) ; } | Check if the additional repositories for using WordPress with composer are set . |
9,445 | protected function configureRepos ( ) { if ( ! $ this -> json ) { $ this -> readJson ( ) ; } $ public = $ this -> plugin -> getPublicDirectory ( ) ; $ plugins_path = $ public . '/plugins/{$name}/' ; $ themes_path = $ public . '/themes/{$name}/' ; $ this -> json [ 'repositories' ] [ ] = [ 'type' => 'composer' , 'url' =>... | Configure additional repositories for using WordPress with composer and set the installation directories for WordPress packages . |
9,446 | protected function isSortingConfigured ( ) { if ( ! $ this -> json ) { $ this -> readJson ( ) ; } return ! empty ( $ this -> json [ 'config' ] ) && ! empty ( $ this -> json [ 'config' ] [ 'sort-packages' ] ) ; } | Check if autmatic sorting of linked packages is enabled . |
9,447 | protected function sortProperties ( ) { if ( ! $ this -> json ) { $ this -> readJson ( ) ; } $ this -> json = $ this -> sortByArray ( $ this -> json , $ this -> composerOrder ) ; if ( isset ( $ this -> json [ 'autoload' ] ) ) { $ this -> json [ 'autoload' ] = $ this -> sortByArray ( $ this -> json [ 'autoload' ] , $ th... | Sort the composer . json properties . |
9,448 | protected function getJsonFile ( ) { if ( ! $ this -> jsonFile ) { $ this -> jsonFile = new JsonFile ( 'composer.json' , null , $ this -> io ) ; } return $ this -> jsonFile ; } | Get the JsonFile . |
9,449 | protected function pregGrepRecursive ( $ pattern , $ haystack ) { $ matches = [ ] ; foreach ( $ haystack as $ key => $ item ) { if ( is_array ( $ item ) ) { $ sub_matches = $ this -> pregGrepRecursive ( $ pattern , $ item ) ; if ( $ sub_matches ) { $ matches [ $ key ] = $ sub_matches ; } } elseif ( preg_match ( $ patte... | Recursive version of preg_grep . |
9,450 | protected function sortByArray ( $ array , $ order ) { $ keys = array_keys ( $ array ) ; return array_merge ( array_flip ( array_intersect ( $ order , $ keys ) + array_diff ( $ keys , $ order ) ) , $ array ) ; } | Sort an array by its keys using a given array as the sort order . |
9,451 | public function getActiveSiteTheme ( $ siteId ) { $ qb = $ this -> getEntityManager ( ) -> createQueryBuilder ( ) ; $ query = $ qb -> select ( 'e, t' ) -> from ( $ this -> _entity , 'e' ) -> innerJoin ( 'e.themeId' , 't' ) -> where ( 'e.siteId = :id' ) -> andWhere ( 'e.isActive = 1' ) -> setMaxResults ( 1 ) -> setParam... | Get Active Site Theme |
9,452 | public function register ( Application $ app ) { $ this -> addMerger ( $ app ) ; $ app -> extend ( 'console' , function ( ConsoleApplication $ console ) { $ console -> getDefinition ( ) -> addOption ( new InputOption ( 'config' , 'c' , InputOption :: VALUE_OPTIONAL , 'Location of a custom configuration file' ) ) ; retu... | Adds the Configuration object to the DIC . |
9,453 | private function addMerger ( Application $ container ) { $ this -> addMergerAnnotations ( $ container ) ; $ container [ 'config.merger' ] = $ container -> share ( function ( ) { return new Merger ( new AnnotationReader ( ) ) ; } ) ; } | Initializes and adds the configuration merger object as the config . merger service to the container . |
9,454 | private function addMergerAnnotations ( Application $ container ) { if ( ! isset ( $ container [ 'serializer.annotations' ] ) ) { throw new \ RuntimeException ( 'The configuration service provider depends on the JmsSerializer Service Provider but the ' . '"serializer.annotations" key could not be found in the container... | Adds the annotations for the Merger component to the Serializer . |
9,455 | public function write ( $ path , $ contents ) { if ( ! FileKeeper :: exists ( $ dir = $ this -> getBasePath ( ) ) ) { FileKeeper :: directory ( $ dir ) ; } FileKeeper :: write ( $ path , $ contents ) ; } | Writes a file also creates base directory |
9,456 | public static function create ( $ type , $ content ) { if ( empty ( $ type ) ) { throw new AlertTypeException ( 'Unable to create message with invalid type.' ) ; } if ( empty ( $ content ) ) { throw new AlertContentException ( 'Unable to create message with invalid content.' ) ; } return new self ( $ type , $ content )... | Create a new alerter instance . |
9,457 | public function display ( $ viewPath = null , $ view = null ) { if ( ! $ viewPath ) { $ viewPath = $ this -> viewPath ; } if ( ! $ view ) { $ view = $ this -> view ; } return ( new AlertDisplay ( $ this , $ viewPath , $ view ) ) -> display ( ) ; } | Return a string of alert display HTML for a set display view . |
9,458 | protected function validateBlockType ( $ blockType ) { if ( ! $ blockType ) { throw new Exception \ InvalidArgumentException ( 'The block type name must not be empty.' ) ; } if ( ! $ blockType instanceof BlockTypeInterface ) { if ( ! is_string ( $ blockType ) ) { throw new Exception \ UnexpectedTypeException ( $ blockT... | Checks if the given value can be used as the block type name |
9,459 | protected static function makeBin ( $ str , $ len ) { if ( $ str instanceof self ) { return $ str -> bytes ; } if ( \ strlen ( $ str ) === $ len ) { return $ str ; } $ str = ( string ) preg_replace ( [ '/^urn:uuid:/is' , '/[^a-f0-9]/is' , ] , '' , $ str ) ; if ( \ strlen ( $ str ) !== ( $ len * 2 ) ) { return null ; } ... | Insure that an input string is either binary or hexadecimal . Returns binary representation or false on failure . |
9,460 | public function offsetGet ( $ offset ) { return isset ( $ this -> _args [ $ offset ] ) ? ( ( is_array ( $ this -> _args [ $ offset ] ) ) ? new AssociativeArray ( $ this -> _args [ $ offset ] ) : $ this -> _args [ $ offset ] ) : null ; } | Retrieve a value based on an offset in the array . |
9,461 | public static function getCacheObject ( $ cacheConfig = 'default' ) { if ( empty ( static :: $ instance [ $ cacheConfig ] ) ) { $ config = Helper :: getConfig ( 'application' , $ cacheConfig ) ; if ( isset ( $ config [ "cache" ] [ $ cacheConfig ] ) ) { static :: $ instance [ $ cacheConfig ] = new $ config [ "cache" ] [... | Get the cache instance |
9,462 | public function replace ( string $ subject , string $ replacement , int $ limit = - 1 , int & $ count = null ) : string { $ result = preg_replace ( $ this -> pattern -> getPattern ( ) . $ this -> modifier , $ replacement , $ subject , $ limit , $ count ) ; if ( ( $ errno = preg_last_error ( ) ) !== PREG_NO_ERROR ) { $ ... | Retrieve replaced subject with replacement |
9,463 | public function getRequiredPhpVersion ( ) { @ $ packageInfo = $ this -> registry -> packageInfo ( 'ezcomponents' , null , 'components.ez.no' ) ; if ( array_key_exists ( 'required' , $ packageInfo [ 'dependencies' ] ) ) { return $ packageInfo [ 'dependencies' ] [ 'required' ] [ 'php' ] [ 'min' ] ; } return $ packageInfo... | Returns a PHP version string that describes the required PHP version for this installed eZ Components bundle . |
9,464 | public function getRoot ( ) { if ( $ this -> root === null ) { $ this -> root = $ this -> menuFactory -> createItem ( $ this -> getName ( ) ) ; } return $ this -> root ; } | Returns root item |
9,465 | public function send ( ) { $ response = $ this -> _response ; header ( $ response -> getStatus ( ) -> __toString ( ) ) ; foreach ( $ response -> getHeaders ( ) as $ headerField ) header ( $ headerField ) ; if ( $ response -> hasBody ( ) ) echo $ response -> getBody ( ) ; } | Sends the headers and body . |
9,466 | private function filterPort ( $ scheme , $ host , $ port ) { if ( null !== $ port ) { $ port = ( int ) $ port ; if ( 1 > $ port || 65535 < $ port ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid port: %d. Must be between 1 and 65535' , $ port ) ) ; } } return self :: isStandardPort ( $ port , ( string ) $ ... | Filter port before setting it . |
9,467 | private static function isStandardPort ( $ port , $ scheme = null , $ host = null ) { if ( $ host === null || $ scheme === null ) { return false ; } return array_key_exists ( $ scheme , static :: $ schemes ) && $ port === static :: $ schemes [ $ scheme ] ; } | Is a given port standard for the current scheme? |
9,468 | public function withPath ( $ path ) { if ( ! is_string ( $ path ) ) { throw new \ InvalidArgumentException ( 'Invalid path provided; must be a string' ) ; } $ path = $ this -> filterPath ( $ path ) ; $ new = clone $ this ; $ new -> path = $ path ; return $ new ; } | Returns instance with given path . |
9,469 | public function loadRepository ( RepositoryInterface $ repo ) { foreach ( $ repo -> getPackages ( ) as $ package ) { if ( $ package instanceof AliasPackage ) { continue ; } if ( 'composer-plugin' === $ package -> getType ( ) ) { $ requiresComposer = null ; foreach ( $ package -> getRequires ( ) as $ link ) { if ( 'comp... | Load all plugins and installers from a repository |
9,470 | protected function lookupInstalledPackage ( Pool $ pool , Link $ link ) { $ packages = $ pool -> whatProvides ( $ link -> getTarget ( ) , $ link -> getConstraint ( ) ) ; return ( ! empty ( $ packages ) ) ? $ packages [ 0 ] : null ; } | Resolves a package link to a package in the installed pool |
9,471 | protected function prepareValueAndOperator ( $ value , $ operator , $ useDefault = false ) { if ( $ useDefault ) { return [ $ operator , '=' ] ; } if ( $ this -> invalidOperatorAndValue ( $ operator , $ value ) ) { throw new InvalidArgumentException ( 'Illegal operator and value combination.' ) ; } return [ $ value , $... | Prepare the value and operator for a where clause . |
9,472 | protected function runPaginationCountQuery ( $ columns = [ '*' ] ) { return $ this -> cloneWithout ( [ 'columns' , 'orders' , 'limit' , 'offset' ] ) -> cloneWithoutBindings ( [ 'select' , 'order' ] ) -> setAggregate ( 'count' , $ this -> withoutSelectAliases ( $ columns ) ) -> get ( ) -> all ( ) ; } | Run a pagiantion count query . |
9,473 | public function setAuthor ( $ author , $ sort_key = '' ) { $ this -> creator = $ this -> metadata -> appendChild ( $ this -> createElement ( 'dc:creator' ) ) ; $ this -> creator -> setAttribute ( 'opf:role' , "aut" ) ; $ txt = $ this -> createTextNode ( $ author ) ; $ this -> creator -> appendChild ( $ txt ) ; if ( $ s... | Book author or creator optional . . |
9,474 | public function offsetGet ( $ id ) { if ( $ this -> rootContainer ) { try { return $ this -> rootContainer -> get ( $ id ) ; } catch ( NotFoundException $ ex ) { return $ this -> pimpleContainer [ $ id ] ; } } else { return $ this -> pimpleContainer [ $ id ] ; } } | Gets a parameter or an object first from the root container then from Pimple if nothing is found in root container . It is expected that the root container will be a composite container with Pimple being part of it therefore the fallback to Pimple is just here by security . |
9,475 | public function offsetExists ( $ id ) { if ( $ this -> rootContainer ) { try { return $ this -> rootContainer -> has ( $ id ) ; } catch ( NotFoundException $ ex ) { return $ this -> pimpleContainer -> offsetExists ( $ id ) ; } } else { return $ this -> pimpleContainer -> offsetExists ( $ id ) ; } } | Check existence of a parameter or an object first in the root container then in Pimple if nothing is found in root container . It is expected that the root container will be a composite container with Pimple being part of it therefore the fallback to Pimple is just here by security . |
9,476 | public function createService ( ServiceLocatorInterface $ viewHelperManager ) { $ serviceLocator = $ viewHelperManager -> getServiceLocator ( ) ; $ config = $ serviceLocator -> has ( 'config' ) ? $ serviceLocator -> get ( 'config' ) : array ( ) ; if ( isset ( $ config [ 'google_analytics' ] ) ) { $ this -> config ( $ c... | Create and configure helper instance |
9,477 | public function initialize ( ) { if ( true == $ this -> initialized ) { return ; } $ this -> initialized = true ; if ( null !== $ this -> trackingId ) { $ trackerId = $ this -> trackingId ; $ inlineScript = $ this -> getView ( ) -> plugin ( 'inlineScript' ) ; $ inlineScript -> appendScript ( <<<HDOC(function(i,s,o,g,r,... | Inject Google Analytics tracker code into InlineScript helper . This should only be called once after the helper is completely configured . |
9,478 | public static function create ( $ year = null , $ month = null , $ day = null , $ hour = null , $ minute = null , $ second = null , TimeZone $ tz = null ) { [ $ nowYear , $ nowMonth , $ nowDay , $ nowHour , $ nowMin , $ nowSec ] = explode ( '-' , date ( 'Y-n-j-G-i-s' , time ( ) ) ) ; $ year = $ year ?? $ nowYear ; $ mo... | Create a DateTime instance |
9,479 | protected function entityToArray ( $ class , $ object ) { if ( is_object ( $ object ) && get_class ( $ object ) == $ class ) { $ object = $ object -> toArray ( ) ; } return $ object ; } | Return entity transformed to array |
9,480 | public function getArg ( $ key = '' ) { if ( isset ( $ this -> args [ $ key ] ) ) { return $ this -> args [ $ key ] ; } else { return null ; } } | Gets the event _args value for a specific key if passed |
9,481 | function parseResponse ( $ response , $ format ) { if ( isset ( $ format ) ) { switch ( $ format ) { case "pdf" : $ theResponse = $ response ; break ; case "json" : $ theResponse = json_decode ( $ response , true ) ; break ; default : $ theResponse = simplexml_load_string ( $ response ) ; break ; } } return $ theRespon... | Convert the response into usable data |
9,482 | protected function filterService ( ) { if ( empty ( $ _GET [ 'service' ] ) ) { return false ; } if ( is_null ( $ this -> service_filter ) ) { return true ; } return ( true == call_user_func ( $ this -> service_filter , $ _GET [ 'service' ] ) ) ; } | Validate if the proxied service is authenticated |
9,483 | public function login ( $ service , $ gateway = false ) { $ query = array ( 'service' => $ this -> my_service . '?' . http_build_query ( array ( 'service' => $ service , ) ) , ) ; if ( $ gateway ) { $ query [ 'gateway' ] = $ gateway ; } self :: http_redirect ( $ this -> server [ 'login_url' ] . '?' . http_build_query (... | From proxied service to CAS server |
9,484 | public function back ( $ service , $ ticket = '' ) { $ parts = parse_url ( $ service ) ; if ( isset ( $ parts [ 'query' ] ) ) { parse_str ( $ parts [ 'query' ] , $ query ) ; } else { $ query = array ( ) ; } if ( ! empty ( $ ticket ) ) { $ query [ 'ticket' ] = $ ticket ; } $ parts [ 'query' ] = http_build_query ( $ quer... | From CAS server back to proxied service |
9,485 | public function serviceValidate ( $ service , $ ticket , $ timeout = 10 ) { header ( 'Content-Type: text/xml; charset=UTF-8' ) ; exit ( self :: file_get_contents ( $ this -> server [ 'service_validate_url' ] . '?' . http_build_query ( array ( 'service' => $ this -> my_service . '?' . http_build_query ( array ( 'service... | Pass service validate http response |
9,486 | public function detach ( EventManagerInterface $ events ) { foreach ( $ this -> listeners as $ listener ) { $ events -> detach ( $ listener ) ; } } | Detach event listeners |
9,487 | public function getActionPlugins ( ) { if ( null === $ this -> actionPlugins ) { $ this -> setActionPlugins ( new Action \ PluginManager ( ) ) ; } return $ this -> actionPlugins ; } | Get action plugin manager |
9,488 | public function setLimit ( $ limit ) { if ( is_array ( $ limit ) ) { $ spec = $ limit ; if ( ! isset ( $ spec [ 'name' ] ) ) { throw new \ Exception ( "Cannot create Limit: Name missing from configuration." ) ; } $ name = $ spec [ 'name' ] ; $ limit = isset ( $ spec [ 'limit' ] ) ? $ spec [ 'limit' ] : null ; $ interva... | Set a limit |
9,489 | public function setStorage ( $ storage ) { if ( is_string ( $ storage ) ) { $ storage = $ this -> getStoragePlugins ( ) -> get ( $ storage ) ; } elseif ( is_array ( $ storage ) ) { if ( ! isset ( $ storage [ 'name' ] ) ) { throw new \ Exception ( 'Invalid Storage configuration: Name required.' ) ; } $ storage = $ this ... | Set storage instance |
9,490 | public function getStoragePlugins ( ) { if ( null === $ this -> storagePlugins ) { $ this -> setStoragePlugins ( new Storage \ PluginManager ( ) ) ; } return $ this -> storagePlugins ; } | Get storage plugin manager |
9,491 | public function initialize ( MvcEvent $ event ) { $ appConfig = $ event -> getApplication ( ) -> getServiceManager ( ) -> get ( 'config' ) ; if ( array_key_exists ( self :: CONFIG_KEY , $ appConfig ) ) { $ this -> configure ( $ appConfig [ self :: CONFIG_KEY ] ) ; } $ event -> getApplication ( ) -> getServiceManager ( ... | Configure instance and inject it into controller plugin manager |
9,492 | public function check ( MvcEvent $ event ) { foreach ( $ this -> limits as $ limit ) { if ( $ this -> storage -> check ( $ this -> remoteAddress -> getIpAddress ( ) , $ limit ) ) { foreach ( $ limit -> getActions ( ) as $ action ) { $ action ( $ event ) ; } } } } | Test limits and take actions if they have been exceeded |
9,493 | private function findFirstMessage ( ) { $ data = fgets ( $ this -> fh ) ; fseek ( $ this -> fh , 0 ) ; if ( substr ( $ data , 0 , 18 ) === 'From MAILER-DAEMON' ) { return $ this -> findNextMessage ( ) ; } else { return 0 ; } } | Finds the position of the first message while skipping a possible header . |
9,494 | private function findNextMessage ( ) { do { $ data = fgets ( $ this -> fh ) ; } while ( ! feof ( $ this -> fh ) && substr ( $ data , 0 , 5 ) !== "From " ) ; if ( feof ( $ this -> fh ) ) { return false ; } return ftell ( $ this -> fh ) ; } | Reads through the Mbox file and stops at the next message . |
9,495 | public function listMessages ( ) { $ messages = array ( ) ; fseek ( $ this -> fh , 0 ) ; $ position = $ this -> findFirstMessage ( ) ; if ( $ position === false ) { return $ messages ; } do { $ position = $ this -> findNextMessage ( ) ; if ( $ position !== false ) { $ messages [ ] = $ position ; } } while ( $ position ... | This function reads through the whole mbox and returns starting positions of the messages . |
9,496 | public function getParams ( ) { if ( empty ( $ this -> types ) ) { return $ this -> params ; } $ params = [ ] ; $ num_params = count ( $ this -> params ) ; for ( $ i = 0 ; $ i < $ num_params ; $ i ++ ) { $ value = $ this -> params [ $ i ] ; $ column = $ this -> param_columns [ $ i ] ; if ( isset ( $ this -> types [ $ c... | Get the parameters to be used in the prepared query converted to the correct database type . |
9,497 | public function execute ( ) { $ stmt = $ this -> connection -> prepare ( $ this -> getSQL ( ) ) ; $ stmt -> execute ( $ this -> getParams ( ) ) ; return $ this -> counting ? ( int ) $ stmt -> fetchColumn ( ) : $ stmt -> fetchAll ( ) ; } | Prepare and execute the current SQL query returning an array of the results . |
9,498 | public static function fromConnection ( Connection $ connection , $ table , array $ types = [ ] ) { $ name = $ connection -> getDriver ( ) -> getName ( ) ; switch ( $ name ) { case 'pdo_mysql' : return new MysqlSelector ( $ connection , $ table , $ types ) ; case 'pdo_sqlite' : return new SqliteSelector ( $ connection ... | Get a vendor - specific selector based on a connection instance . |
9,499 | protected function addParam ( $ column , $ value ) { if ( is_array ( $ value ) ) { $ this -> params = array_merge ( $ this -> params , $ value ) ; $ this -> param_columns = array_merge ( $ this -> param_columns , array_fill ( 0 , count ( $ value ) , $ column ) ) ; return ; } $ this -> params [ ] = $ value ; $ this -> p... | Add a param to be executed in the query . To ensure the order of parameters this should be called during the buildSQL method . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.