idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
3,900 | protected function getRedirectType ( $ BID ) { $ objCat = \ Database :: getInstance ( ) -> prepare ( "SELECT pid as CatID FROM `tl_banner` ... | Search Banner Redirect Definition |
3,901 | protected function getCmsOrderedConfigReplace ( ) { $ orderColumns = $ this -> data [ 'ordered_by' ] ? : [ ] ; $ translatedOrderColumns = array_intersect ( array_keys ( $ orderColumns ) , $ this -> data [ 'translated_attributes' ] ) ; if ( count ( $ translatedOrderColumns ) ) { foreach ( $ translatedOrderColumns as $ c... | Returns the replace required depending on whether the CMS module has automatic sorting for defined columns |
3,902 | protected function getCatID ( ) { $ objBannerCatID = \ Database :: getInstance ( ) -> prepare ( "SELECT MIN(pid) AS ID FROM tl_bann... | Get min category id |
3,903 | protected function getBannersByCatID ( $ CatID = 0 ) { $ arrBanners = array ( ) ; if ( $ CatID == - 1 ) { $ objBanners = \ Database :: getInstance ( ) -> prepare ( "SELECT tb.id , tb.banner_type ... | Get banners by category id |
3,904 | protected function getBannerCategories ( $ banner_number ) { $ objBannerCat = \ Database :: getInstance ( ) -> prepare ( "SELECT id , title FROM tl_ban... | Get banner categories |
3,905 | protected function getBannerCategoriesByUsergroups ( ) { $ arrBannerCats = array ( ) ; $ objBannerCat = \ Database :: getInstance ( ) -> prepare ( "SELECT `id` , `title` , `banner_stat_protected`... | Get banner categories by usergroups |
3,906 | protected function getMaxViewsClicksStatus ( & $ Banner ) { $ intMaxViews = false ; $ intMaxClicks = false ; if ( $ Banner [ 'banner_until' ] == 1 && $ Banner [ 'banner_views_until' ] != '' && $ Banner [ 'banner_views' ] >= $ Banner [ 'banner_views_until' ] ) { $ intMaxViews = true ; } if ( $ Banner [ 'banner_until' ] ... | Get status of maxviews and maxclicks |
3,907 | protected function isUserInBannerStatGroups ( $ banner_stat_groups , $ banner_stat_protected ) { if ( true === $ this -> User -> isAdmin ) { return true ; } if ( false === $ banner_stat_protected ) { return true ; } if ( 0 == strlen ( $ banner_stat_groups ) ) { return false ; } foreach ( deserialize ( $ banner_stat_gro... | Check if User member of group in banner statistik groups |
3,908 | public function runMigration ( $ plugin ) { $ command = new Migrate ( ) ; $ output = new NullOutput ( ) ; $ input = new ArrayInput ( [ '--plugin' => $ plugin ] ) ; $ resultCode = $ command -> run ( $ input , $ output ) ; } | Runs the migrations for a given plugin |
3,909 | public function tableExists ( $ tableName , $ connectionName = 'default' ) { try { $ db = ConnectionManager :: get ( $ connectionName ) ; $ collection = $ db -> schemaCollection ( ) ; $ tables = $ collection -> listTables ( ) ; if ( in_array ( $ tableName , $ tables ) ) { return true ; } } catch ( PDOException $ connec... | Check whether table is exists in database or not . |
3,910 | public function databaseConnection ( $ dataSource = 'default' ) { try { $ connection = ConnectionManager :: get ( $ dataSource ) ; $ connected = $ connection -> connect ( ) ; } catch ( MissingConnectionException $ connectionError ) { $ connected = false ; } return $ connected ; } | Test database connection . |
3,911 | public function roles ( User $ user ) { if ( $ this -> session -> hasValue ( Roles :: SESSION_KEY ) ) { return $ this -> session -> value ( Roles :: SESSION_KEY ) ; } $ roles = $ this -> authorizationProvider -> roles ( $ user ) ; $ this -> session -> putValue ( Roles :: SESSION_KEY , $ roles ) ; return $ roles ; } | returns the roles available for this request and user |
3,912 | protected function _getAppBase ( ) { $ baseUrl = Configure :: read ( 'App.base' ) ; if ( ! $ baseUrl ) { $ request = Router :: getRequest ( true ) ; if ( ! $ request ) { $ baseUrl = '' ; } else { $ baseUrl = $ request -> base ; } } return $ baseUrl . '/' ; } | Return the content of CakePHP App . base . If the App . base value is false it returns the generated URL automatically by mimicking how CakePHP add the base to its URL . |
3,913 | public function module ( $ name ) { list ( $ plugin , $ path ) = $ this -> _View -> pluginSplit ( $ name , false ) ; if ( ! empty ( $ plugin ) ) { $ name = $ this -> Url -> assetUrl ( $ name , [ 'pathPrefix' => Configure :: read ( 'App.jsBaseUrl' ) , 'ext' => '.js' , ] ) ; } if ( ! $ this -> _requireLoaded ) { return $... | Add a javascript module to be loaded on the page . |
3,914 | public function evaluate ( array $ item , array $ clause ) { if ( false === isset ( $ clause [ 'key' ] ) || false === isset ( $ clause [ 'value' ] ) || false === isset ( $ clause [ 'operator' ] ) ) { throw new \ InvalidArgumentException ( 'Clause must contain "key", "value" and operator.' ) ; } $ value = isset ( $ item... | Evaluates the given item with the given clause . |
3,915 | protected function evaluateFilters ( $ value , array $ clause ) { if ( true === isset ( $ clause [ 'filters' ] ) ) { if ( false === is_array ( $ clause [ 'filters' ] ) ) { $ clause [ 'filters' ] = [ $ clause [ 'filters' ] ] ; } foreach ( $ clause [ 'filters' ] as $ filter ) { $ value = $ this -> evaluateFilter ( $ valu... | Evaluates the given value with the given clause . |
3,916 | public function listAction ( ) { $ products = $ this -> container -> get ( 'vespolina.product_manager' ) -> findBy ( array ( ) ) ; return $ this -> container -> get ( 'templating' ) -> renderResponse ( 'VespolinaCommerceBundle:Product:list.html.' . $ this -> getEngine ( ) , array ( 'products' => $ products ) ) ; } | Show all products |
3,917 | public function detailAction ( $ id ) { $ product = $ this -> container -> get ( 'vespolina.product_manager' ) -> findProductById ( $ id ) ; if ( ! $ product ) { throw new NotFoundHttpException ( 'The product does not exist!' ) ; } return $ this -> container -> get ( 'templating' ) -> renderResponse ( 'VespolinaCommerc... | Show one product by object id |
3,918 | public function editAction ( $ id ) { $ product = $ this -> container -> get ( 'vespolina.product_manager' ) -> findProductById ( $ id ) ; if ( ! $ product ) { throw new NotFoundHttpException ( 'The product does not exist!' ) ; } $ formHandler = $ this -> container -> get ( 'vespolina.product.form.handler' ) ; $ proces... | Edit one product show the edit form |
3,919 | public function deleteAction ( $ id ) { $ product = $ this -> container -> get ( 'vespolina.product_manager' ) -> findProductById ( $ id ) ; if ( ! $ product ) { throw new NotFoundHttpException ( 'The product does not exist!' ) ; } $ dm = $ this -> container -> get ( 'doctrine.odm.mongodb.document_manager' ) ; $ dm -> ... | Delete one product then show list |
3,920 | private function buildModelMap ( ) { $ this -> modelMap = ArrayHelper :: merge ( $ this -> defaultModelMap , $ this -> modelMap ) ; foreach ( $ this -> modelMap as $ modelName => $ configuration ) { Yii :: $ container -> set ( $ configuration [ 'class' ] , $ configuration ) ; } } | Builds model map setups di container |
3,921 | private function createVisitor ( ) { $ this -> visitor = Yii :: $ container -> get ( $ this -> modelMap [ 'Visitor' ] [ 'class' ] ) ; $ this -> visitor -> save ( ) ; return $ this -> visitor ; } | Create Visitor record |
3,922 | private function saveVisitor ( ) { Yii :: $ app -> session -> set ( $ this -> visitorCookieName , $ this -> visitor -> getPrimaryKey ( ) ) ; if ( ! Yii :: $ app -> request -> cookies -> has ( $ this -> visitorCookieName ) ) { $ this -> setVisitorCookie ( ) ; return ; } $ cookie = Yii :: $ app -> request -> cookies -> g... | Store visitor_id in session and if require in cookie |
3,923 | private function setVisitorCookie ( ) { Yii :: $ app -> response -> cookies -> add ( new Cookie ( [ 'name' => $ this -> visitorCookieName , 'value' => $ this -> visitor -> getPrimaryKey ( ) , 'expire' => time ( ) + $ this -> visitorCookieTime , ] ) ) ; } | Add visitor cookie |
3,924 | public function hasVisitor ( $ visitor_id ) { if ( $ this -> visitor !== null ) { return true ; } $ model = Yii :: $ container -> get ( $ this -> modelMap [ 'Visitor' ] [ 'class' ] ) ; $ this -> visitor = $ model -> find ( ) -> where ( [ 'id' => $ visitor_id ] ) -> one ( ) ; return $ this -> visitor !== null ; } | Check if visitor exists |
3,925 | public function getVisitor ( ) { if ( $ this -> visitor !== null ) { return $ this -> visitor ; } if ( Yii :: $ app -> session -> has ( $ this -> visitorCookieName ) ) { $ visitor_id = Yii :: $ app -> session -> get ( $ this -> visitorCookieName ) ; } elseif ( Yii :: $ app -> request -> cookies -> has ( $ this -> visit... | Return current Visitor |
3,926 | public function getQualifiedOrderByColumns ( ) { $ columns = $ this -> cmsOrderBy ; $ qualified = [ ] ; if ( empty ( $ columns ) ) return [ ] ; foreach ( $ columns as $ column => $ direction ) { $ qualified [ $ this -> getTable ( ) . '.' . $ column ] = $ direction ; } return $ qualified ; } | Get the fully qualified column name for applying the scope |
3,927 | public function store ( ApiStoreRequest $ request , $ crudeName ) { $ this -> crude = CrudeInstance :: get ( $ request -> crudeName ) ; $ model = $ this -> crude -> store ( $ request -> all ( ) ) ; return $ this -> successResponse ( [ 'model' => $ model , 'message' => $ this -> crude -> getCrudeSetup ( ) -> trans ( 'it... | Add new model |
3,928 | public function getOptionOrDefault ( $ name ) { return isset ( $ this -> options [ $ name ] ) ? $ this -> options [ $ name ] : $ this -> getDefault ( $ name ) ; } | Get an option value by name or a default option with the same name . |
3,929 | private function traverse ( array $ segments , & $ result = array ( ) , $ node = null ) { $ path = array ( ) ; if ( null !== $ node ) { $ path = explode ( '/' , substr ( $ node -> getPath ( ) , 1 ) ) ; } do { list ( $ element , $ bitmask ) = array_shift ( $ segments ) ; if ( $ bitmask & SelectorParser :: T_STATIC ) { $... | Traverse the node |
3,930 | protected function addEntry ( $ id , $ number , $ type , DateTime $ date , $ route , $ pdfUrl , $ translationKey = '' ) { $ this -> entries [ ] = array ( 'id' => $ id , 'number' => $ number , 'type' => $ type , 'date' => $ date , 'route' => $ route , 'pdfUrl' => $ pdfUrl , 'translationKey' => $ translationKey ) ; } | Creates and adds an entry to the exisiting entries |
3,931 | public function statusCodes ( ) : array { return array_map ( function ( $ status ) { return new Status ( $ status -> getCode ( ) , $ status -> getDescription ( ) ) ; } , $ this -> annotations -> named ( 'Status' ) ) ; } | returns list of possible status codes on this route |
3,932 | public function headers ( ) : array { return array_map ( function ( $ header ) { return new Header ( $ header -> getName ( ) , $ header -> getDescription ( ) ) ; } , $ this -> annotations -> named ( 'Header' ) ) ; } | returns list of headers on this route |
3,933 | public function parameters ( ) : array { return array_map ( function ( $ parameter ) { $ param = new Parameter ( $ parameter -> getName ( ) , $ parameter -> getDescription ( ) , $ parameter -> getIn ( ) ) ; if ( $ parameter -> hasValueByName ( 'required' ) && $ parameter -> isRequired ( ) ) { $ param -> markRequired ( ... | returns list of parameters |
3,934 | public function hasRole ( Role $ role ) { $ role = ! is_string ( $ role ) ? : Role :: where ( [ 'name' => $ role ] ) -> firstOrFail ( ) ; if ( $ role ) { foreach ( $ this -> roles as $ r ) { if ( $ r -> id == $ role -> id ) { return true ; } } } return false ; } | Returns true if the user has the role . |
3,935 | final public function compare ( $ item1 , $ item2 ) { if ( ! $ this -> isReady ( ) ) { throw new \ RuntimeException ( "The comparer is not ready, no valid callback has been set." ) ; } return call_user_func_array ( $ this -> callback , [ $ item1 , $ item2 , $ this -> options ] ) ; } | Compares two items . |
3,936 | public function reorder ( array $ newOrder ) { $ param = $ this -> crudeSetup -> getOrderParameters ( ) ; $ idAttr = $ param [ 'idAttr' ] ; $ orderAttr = $ param [ 'orderAttr' ] ; $ table = $ this -> model -> getTable ( ) ; $ data = collect ( $ newOrder ) -> map ( function ( $ item ) { return "({$item['id']},{$item['or... | Set new order for selected items |
3,937 | public function setPort ( $ port ) { if ( ! ctype_digit ( $ port ) ) { trigger_error ( 'Port must be a positive integer: ' . var_export ( $ port , true ) , E_USER_ERROR ) ; } $ this -> port = $ port ; } | Sets the port on which to operate the daemon . |
3,938 | public function setDownloadPath ( $ downloadPath ) { if ( ! is_dir ( $ downloadPath ) || ! is_writable ( $ downloadPath ) ) { trigger_error ( 'Cannot write to directory: ' . $ downloadPath , E_USER_ERROR ) ; } $ this -> downloadPath = $ downloadPath ; } | Sets the path at which to store downloaded files . |
3,939 | protected function execute ( $ command ) { $ process = proc_open ( $ command , array ( 1 => array ( 'pipe' , 'w' ) , 2 => array ( 'pipe' , 'w' ) ) , $ pipes ) ; fclose ( $ pipes [ 2 ] ) ; $ this -> output = stream_get_contents ( $ pipes [ 1 ] ) ; fclose ( $ pipes [ 1 ] ) ; $ status = proc_get_status ( $ process ) ; $ t... | Execute a shell command . |
3,940 | public function start ( ) { if ( $ this -> started ) { return ; } $ auth = $ this -> getAuthFlag ( ) ; $ command = 'transmission-remote -C ' . $ auth . ' -' . ( $ this -> encryption ? 'er' : 'ep' ) . ' -p ' . $ this -> port . ' -' . ( $ this -> upnp ? 'm' : 'M' ) . ( $ this -> downloadPath ? ' -w ' . $ this -> download... | Starts the daemon . |
3,941 | public function addTorrents ( $ paths ) { if ( is_array ( $ paths ) ) { $ paths = implode ( ' ' , $ paths ) ; } $ this -> execute ( 'transmission-remote ' . $ this -> getAuthFlag ( ) . ' -a ' . $ paths ) ; } | Adds a torrent to download . |
3,942 | protected function splitUrl ( $ url ) { $ path = parse_url ( trim ( $ url , '/' ) , PHP_URL_PATH ) ; return $ path ? explode ( '/' , $ path ) : array ( ) ; } | Get parts of a URL path |
3,943 | public function initPermissionsRelatedById ( $ overrideExisting = true ) { if ( null !== $ this -> collPermissionsRelatedById && ! $ overrideExisting ) { return ; } $ this -> collPermissionsRelatedById = new ObjectCollection ( ) ; $ this -> collPermissionsRelatedById -> setModel ( '\Alchemy\Component\Cerberus\Model\Per... | Initializes the collPermissionsRelatedById collection . |
3,944 | public function getPermissionsRelatedById ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { $ partial = $ this -> collPermissionsRelatedByIdPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collPermissionsRelatedById || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null ===... | Gets an array of ChildPermission objects which contain a foreign key that references this object . |
3,945 | public function countPermissionsRelatedById ( Criteria $ criteria = null , $ distinct = false , ConnectionInterface $ con = null ) { $ partial = $ this -> collPermissionsRelatedByIdPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collPermissionsRelatedById || null !== $ criteria || $ partial ) { if ( $ this -... | Returns the number of related Permission objects . |
3,946 | public function addPermissionRelatedById ( ChildPermission $ l ) { if ( $ this -> collPermissionsRelatedById === null ) { $ this -> initPermissionsRelatedById ( ) ; $ this -> collPermissionsRelatedByIdPartial = true ; } if ( ! $ this -> collPermissionsRelatedById -> contains ( $ l ) ) { $ this -> doAddPermissionRelated... | Method called to associate a ChildPermission object to this object through the ChildPermission foreign key attribute . |
3,947 | public function getRolePermissions ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { $ partial = $ this -> collRolePermissionsPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collRolePermissions || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collRolePe... | Gets an array of ChildRolePermission objects which contain a foreign key that references this object . |
3,948 | public function countRolePermissions ( Criteria $ criteria = null , $ distinct = false , ConnectionInterface $ con = null ) { $ partial = $ this -> collRolePermissionsPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collRolePermissions || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null =... | Returns the number of related RolePermission objects . |
3,949 | public function getRolePermissionsJoinRole ( Criteria $ criteria = null , ConnectionInterface $ con = null , $ joinBehavior = Criteria :: LEFT_JOIN ) { $ query = ChildRolePermissionQuery :: create ( null , $ criteria ) ; $ query -> joinWith ( 'Role' , $ joinBehavior ) ; return $ this -> getRolePermissions ( $ query , $... | If this collection has already been initialized with an identical criteria it returns the collection . Otherwise if this Permission is new it will return an empty collection ; or if this Permission has previously been saved it will retrieve related RolePermissions from storage . |
3,950 | public function getRoles ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { $ partial = $ this -> collRolesPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collRoles || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) ) { if ( null === $ this -> collRoles ) { $ this -> initRoles ... | Gets a collection of ChildRole objects related by a many - to - many relationship to the current object by way of the role_permission cross - reference table . |
3,951 | public function countRoles ( Criteria $ criteria = null , $ distinct = false , ConnectionInterface $ con = null ) { $ partial = $ this -> collRolesPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collRoles || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collRoles ) { ret... | Gets the number of Role objects related by a many - to - many relationship to the current object by way of the role_permission cross - reference table . |
3,952 | public function removeRole ( ChildRole $ role ) { if ( $ this -> getRoles ( ) -> contains ( $ role ) ) { $ rolePermission = new ChildRolePermission ( ) ; $ rolePermission -> setRole ( $ role ) ; if ( $ role -> isPermissionsLoaded ( ) ) { $ role -> getPermissions ( ) -> removeObject ( $ this ) ; } $ rolePermission -> se... | Remove role of this object through the role_permission cross reference table . |
3,953 | public static function findBySlug ( $ slug , $ locale = null ) { $ model = ( new static ) ; $ translationModel = $ model -> getTranslationModelName ( ) ; $ parentKey = $ model -> getRelationKey ( ) ; $ translationInstance = $ translationModel :: findBySlug ( $ slug , $ locale ) ; if ( empty ( $ translationInstance ) ) ... | Find by slug on translated attribute |
3,954 | public function scopeWhereSlug ( $ query , $ slug , $ locale = null ) { return $ query -> whereHas ( 'translations' , function ( $ query ) use ( $ slug , $ locale ) { return $ query -> whereSlug ( $ slug , $ locale , true ) ; } ) ; } | Scopes query for slug on translated attribute |
3,955 | public function createQuery ( $ context = 'list' ) { $ query = parent :: createQuery ( $ context ) ; $ query -> leftJoin ( $ query -> getRootAlias ( ) . '.template' , 'template' ) -> addSelect ( 'template' ) -> leftJoin ( 'template.areas' , 'area' ) -> addSelect ( 'area' ) -> leftJoin ( $ query -> getRootAlias ( ) . '.... | Need to override createQuery method because or list order & joins |
3,956 | protected function checkIntTypes ( NumericTypeInterface $ a , NumericTypeInterface $ b ) { $ a1 = ( $ a instanceof IntType ? $ a : $ a -> asIntType ( ) ) ; $ b1 = ( $ a instanceof IntType ? $ b : $ b -> asIntType ( ) ) ; return [ $ a1 , $ b1 ] ; } | Check for integer type converting if necessary |
3,957 | public function getConfigFactory ( ) { if ( empty ( $ this -> configFactory ) ) { $ this -> configFactory = \ Drupal :: service ( 'config.factory' ) ; } return $ this -> configFactory ; } | Gets the config factory . |
3,958 | public function setFile ( $ file ) { if ( empty ( $ file ) || false === stream_resolve_include_path ( $ file ) ) { throw new Exception \ InvalidArgumentException ( 'Invalid options to validator provided' ) ; } $ this -> options [ 'file' ] = $ file ; return $ this ; } | Sets the path to the file |
3,959 | public function setType ( $ type ) { $ this -> type = ( string ) $ type ; $ this -> getDocBlock ( ) -> getTagCollection ( ) -> removeByName ( Tag :: TAG_VAR ) ; $ tag = Tag :: createFromProperty ( $ this ) ; $ this -> getDocBlock ( ) -> addTag ( $ tag ) ; return $ this ; } | Sets the property s type . |
3,960 | public function toUrlQuery ( ) { $ queryData = array ( ) ; foreach ( self :: $ properties as $ p => $ setter ) { if ( $ this -> $ p !== null ) { $ queryData [ $ p ] = $ this -> $ p ; } } return http_build_query ( $ queryData ) ; } | Returns the resulting url - encoded query string . |
3,961 | public function set ( $ criteria ) { if ( $ criteria instanceof Criteria ) { $ this -> limit = $ criteria -> limit ; $ this -> offset = $ criteria -> offset ; $ this -> sort = $ criteria -> sort ; $ this -> filter = $ criteria -> filter ; $ this -> after = $ criteria -> after ; $ this -> loadonly = $ criteria -> loadon... | Sets multiple parameters at once . |
3,962 | private function parseHttpQuery ( $ query ) { if ( empty ( $ query ) ) { return array ( ) ; } $ result = array ( ) ; $ parts = explode ( '&' , $ query ) ; foreach ( $ parts as $ p ) { $ keyval = explode ( '=' , $ p ) ; $ result [ urldecode ( $ keyval [ 0 ] ) ] = urldecode ( $ keyval [ 1 ] ) ; } return $ result ; } | Parses a http query into a key - value array similar to PHP s parse_str function . |
3,963 | public static function fromCookie ( $ key , $ default = null , $ filter = null , $ args = array ( ) ) { if ( ! $ key ) { return self :: filterArray ( $ _COOKIE , $ filter , $ args ) ; } return self :: getPassedValue ( $ key , $ default , 'C' , $ filter , $ args ) ; } | Wrapper for COOKIE input |
3,964 | public static function fromDelete ( $ key , $ default = null , $ filter = null , $ args = array ( ) ) { if ( ! $ key ) { $ values = array ( ) ; parse_str ( file_get_contents ( "php://input" ) , $ values ) ; return self :: filterArray ( $ values , $ filter , $ args ) ; } return self :: getPassedValue ( $ key , $ default... | Wrapper for DELETE input |
3,965 | public static function fromFiles ( $ key , $ default = null , $ filter = null , $ args = array ( ) ) { if ( ! $ key ) { return self :: filterArray ( $ _FILES , $ filter , $ args ) ; } return self :: getPassedValue ( $ key , $ default , 'F' , $ filter , $ args ) ; } | Wrapper for FILES input |
3,966 | public static function fromGet ( $ key , $ default = null , $ filter = null , $ args = array ( ) ) { if ( ! $ key ) { return self :: filterArray ( $ _GET , $ filter , $ args ) ; } return self :: getPassedValue ( $ key , $ default , 'G' , $ filter , $ args ) ; } | Wrapper for GET input |
3,967 | public static function fromPost ( $ key , $ default = null , $ filter = null , $ args = array ( ) ) { if ( ! $ key ) { return self :: filterArray ( $ _POST , $ filter , $ args ) ; } return self :: getPassedValue ( $ key , $ default , 'P' , $ filter , $ args ) ; } | Wrapper for POST input |
3,968 | public static function fromRequest ( $ key , $ default = null , $ filter = null , $ args = array ( ) ) { if ( ! $ key ) { return self :: filterArray ( $ _REQUEST , $ filter , $ args ) ; } return self :: getPassedValue ( $ key , $ default , 'R' , $ filter , $ args ) ; } | Wrapper for REQUEST input |
3,969 | protected static function filterArray ( array $ values , $ filter = null , $ args = array ( ) , $ doTrim = true ) { if ( ! $ values ) { return $ values ; } if ( ! $ filter ) { $ filter = self :: $ defaultFilter ; } if ( ! $ args ) { $ args = array ( 'flags' => self :: $ defaultFlags ) ; } foreach ( $ values as $ k => $... | Filter an array item by item . This function is recursive array safe . |
3,970 | private function sumField ( $ devices = null , $ partitions = null , $ field ) { $ result = 0 ; if ( $ devices ) { $ devices = ( array ) $ devices ; } if ( is_array ( $ devices ) ) { $ devices = array_flip ( $ devices ) ; } if ( $ partitions ) { $ partitions = ( array ) $ partitions ; } if ( is_array ( $ partitions ) )... | Calcuate a sum |
3,971 | protected function loginUser ( $ user ) { $ this -> session -> put ( config ( 'pagekit.session_key' , 'pagekit_session' ) , [ 'github_id' => $ user -> id , 'github_name' => $ user -> name , 'github_email' => $ user -> email ] ) ; $ this -> session -> save ( ) ; } | Checks if the user credentials matches the credentials stored in the config |
3,972 | public function getTags ( $ useDefault = null ) { if ( is_null ( $ useDefault ) ) { $ useDefault = $ this -> useDefault ; } $ tags = array ( ) ; foreach ( $ this -> tags as $ tag ) { if ( ! array_key_exists ( $ tag -> getProperty ( ) , $ tags ) ) { $ tags [ $ tag -> getProperty ( ) ] = $ tag -> getValue ( ) ; } } if ( ... | return the tags merged with the defaults |
3,973 | public function getConnection ( ) { if ( ! $ this -> _connection ) { $ this -> _connection = new \ Guzzle \ Http \ Client ( $ this -> getHost ( ) ) ; } return $ this -> _connection ; } | Get Guzzle RESTful client |
3,974 | protected function _should_load_template ( ) { return ( \ is_tax ( ) || \ is_category ( ) || \ is_tag ( ) ) && ! empty ( $ this -> term ) && in_array ( $ this -> taxonomy , $ this -> taxonomies ) ; } | Determines whether a custom template for a taxonomy term should be loaded . |
3,975 | private function buildFields ( array $ fields , $ indent , array & $ result ) { $ stringified_field_names = [ ] ; $ fields_with_default_value = [ ] ; foreach ( $ fields as $ field ) { if ( $ field instanceof ScalarField && $ field -> getShouldBeAddedToModel ( ) ) { $ stringified_field_names [ ] = var_export ( $ field -... | Build field definitions . |
3,976 | public function buildGeneratedFields ( array $ generated_field_names , $ indent , array & $ result ) { $ result [ ] = '' ; $ result [ ] = $ indent . '/**' ; $ result [ ] = $ indent . ' * Generated fields that are loaded, but not managed by the entity..' ; $ result [ ] = $ indent . ' *' ; $ result [ ] = $ indent . ' * @... | Build a list of generated fields . |
3,977 | private function buildGeneratedFieldGetter ( $ field_name , $ caster , $ indent , array & $ result ) { $ short_getter = null ; switch ( $ caster ) { case ValueCasterInterface :: CAST_INT : $ return_type = 'int' ; break ; case ValueCasterInterface :: CAST_FLOAT : $ return_type = 'float' ; break ; case ValueCasterInterfa... | Build getter for generated field . |
3,978 | private function useShortGetterName ( $ field_name ) { return substr ( $ field_name , 0 , 3 ) === 'is_' || in_array ( substr ( $ field_name , 0 , 4 ) , [ 'has_' , 'had_' , 'was_' ] ) || in_array ( substr ( $ field_name , 0 , 5 ) , [ 'were_' , 'have_' ] ) ; } | Return true if we should use a short getter name . |
3,979 | private function buildJsonSerialize ( array $ serialize , $ indent , array & $ result ) { if ( count ( $ serialize ) ) { $ result [ ] = '' ; $ result [ ] = $ indent . '/**' ; $ result [ ] = $ indent . ' * Prepare object properties so they can be serialized to JSON.' ; $ result [ ] = $ indent . ' *' ; $ result [ ] = $ i... | Build JSON serialize method if we need to serialize extra fields . |
3,980 | private function buildValidatePresenceLinesForScalarField ( ScalarField $ field , $ line_indent , array & $ validator_lines ) { if ( $ field instanceof RequiredInterface && $ field instanceof UniqueInterface ) { if ( $ field -> isRequired ( ) && $ field -> isUnique ( ) ) { $ validator_lines [ ] = $ line_indent . $ this... | Build validate lines for scalar fields . |
3,981 | private function buildValidateUniquenessLine ( $ field_name , array $ context ) { $ field_names = [ var_export ( $ field_name , true ) ] ; foreach ( $ context as $ v ) { $ field_names [ ] = var_export ( $ v , true ) ; } return '$validator->unique(' . implode ( ', ' , $ field_names ) . ');' ; } | Build validator uniqueness line . |
3,982 | protected function registerDrupalPaths ( $ composer_config ) { if ( empty ( $ composer_config [ 'class-location' ] ) ) { return ; } $ this -> loader -> setClassMap ( ( array ) $ composer_config [ 'class-location' ] ) ; $ this -> load ( ) ; } | Register the path based autoloader . |
3,983 | protected function registerPsr ( array $ composer_config ) { $ psr0 = $ psr4 = array ( ) ; if ( ! empty ( $ composer_config [ 'psr-0' ] ) ) { $ psr0 = ( array ) $ composer_config [ 'psr-0' ] ; } if ( ! empty ( $ composer_config [ 'psr-4' ] ) ) { $ psr4 = ( array ) $ composer_config [ 'psr-4' ] ; } if ( empty ( $ psr4 )... | Use Composer s autoloader to register the PRS - 0 and PSR - 4 paths . |
3,984 | public function index ( ) { $ action = $ this -> Crud -> action ( ) ; $ action -> config ( 'scaffold.fields_blacklist' , [ 'created' , 'modified' ] ) ; $ this -> Crud -> execute ( ) ; } | Index method Don t show created and modified fields |
3,985 | public function view ( ) { $ action = $ this -> Crud -> action ( ) ; $ action -> config ( 'scaffold.relations' , false ) ; $ this -> Crud -> execute ( ) ; } | View method Related models are blacklisted because the role is already present in the main user panel |
3,986 | private function getNextOrderCollection ( int $ renderedArticleCount ) { $ count = $ this -> count ( ) ; $ logger = $ this -> getLogger ( ) ; $ orderCollection = null ; $ withPagination = $ this -> withPagination ( ) ; $ logger -> debug ( 'Tries to load the next order collection' , [ 'count' => $ count , 'withPaginatio... | Returns the next order collection or void . |
3,987 | private function getTotalCount ( ) : int { if ( $ this -> totalCount === - 1 ) { $ this -> setTotalCount ( $ this -> getLastResponse ( ) -> getTotal ( ) ) ; } return $ this -> totalCount ; } | Returns the total count of found orders . |
3,988 | private function loadOrderCollection ( ) : OrderVisitor { $ logger = $ this -> getLogger ( ) ; $ response = $ this -> getClient ( ) -> execute ( $ this -> getOrderQuery ( ) ) ; if ( $ response instanceof ErrorResponse ) { $ logger -> error ( 'Got error response loading the orders.' , [ 'response' => $ response ] ) ; th... | Loads the order collection . |
3,989 | private function loadOrderQuery ( ) : OrderVisitor { $ logger = $ this -> getLogger ( ) ; $ query = new OrderQueryRequest ( ) ; if ( $ wheres = $ this -> getDefaultWhere ( ) ) { $ logger -> debug ( 'Added where-clause to fech orders.' , [ 'predicates' => $ wheres ] ) ; array_walk ( $ wheres , function ( string $ where ... | Returns the order query request . |
3,990 | private function withPagination ( bool $ newStatus = true ) : bool { $ oldStatus = $ this -> withPagination ; if ( func_num_args ( ) ) { $ this -> withPagination = $ newStatus ; } return $ oldStatus ; } | Sets the pagination status for this list . |
3,991 | public function yieldOrders ( ) { $ usedIndex = 0 ; $ orderCollection = $ this -> getOrderCollection ( ) ; while ( $ orderCollection && count ( $ orderCollection ) ) { foreach ( $ orderCollection as $ order ) { set_time_limit ( 0 ) ; yield $ usedIndex ++ => $ order ; } $ orderCollection = $ this -> getNextOrderCollecti... | Yields all found orders . |
3,992 | public function addPanel ( Panel $ panel ) { $ id = $ panel -> getId ( ) ; if ( ! empty ( $ this -> _panels [ $ id ] ) ) { throw new BugException ( '[FireBug] No panels exist with ID "' . $ id . '".' ) ; } $ this -> _panels [ $ id ] = $ panel ; } | Adds a Fire \ Bug \ Panel object to the the array of panels . |
3,993 | public function render ( ) { if ( $ this -> _enabled ) { if ( php_sapi_name ( ) === 'cli' ) { echo 'FireBug: ' . $ this -> getLoadTime ( ) . ' milliseconds' . "\n" ; } else { ob_start ( ) ; include $ this -> _template ; $ debugPanel = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ debugPanel ; } } } | Method used to render FireBug . |
3,994 | public function add ( string $ key , $ object ) { $ key = self :: ProcessKey ( __METHOD__ , $ key ) ; $ objectType = gettype ( $ object ) ; switch ( $ objectType ) { case "object" : $ this -> repository -> push ( $ object , $ key ) ; return true ; case "string" : return $ this -> service ( $ key ) -> class ( $ object )... | Store an instance or add new server |
3,995 | public function request ( $ method , $ url , array $ params = [ ] , $ outFile = '' , $ returnBool = \ false , $ arrayKey = '' , $ verifyPeer = \ true ) { list ( $ url , $ contextOptions ) = $ this -> configureRequestOptions ( $ url , $ method , $ params , $ verifyPeer ) ; $ fp = @ fopen ( $ url , 'rb' , \ false , strea... | Makes an HTTP request to put . io s API and returns the response . Relies on native PHP functions . |
3,996 | public function match ( $ httpMethod , $ path ) { $ path = $ this -> parsePath ( $ path ) ; if ( ( $ route = $ this -> collector -> findStaticRoute ( $ httpMethod , $ path ) ) || ( $ route = $ this -> matchDynamicRoute ( $ httpMethod , $ path ) ) ) { $ route -> setMatcher ( $ this ) ; return $ route ; } $ this -> match... | Find a route that matches the given arguments . |
3,997 | protected function matchDynamicRoute ( $ httpMethod , $ path ) { if ( $ routes = $ this -> collector -> findDynamicRoutes ( $ httpMethod , $ path ) ) { $ this -> parser = $ this -> collector -> getParser ( ) ; foreach ( array_chunk ( $ routes , round ( 1 + 3.3 * log ( count ( $ routes ) ) ) , true ) as $ chunk ) { arra... | Find and return the request dynamic route based on the compiled data and Path . |
3,998 | protected function buildRoute ( Route $ route ) { if ( $ route -> getBlock ( ) ) { return $ route ; } list ( $ pattern , $ params ) = $ this -> parsePlaceholders ( $ route -> getPattern ( ) ) ; return $ route -> setPatternWithoutReset ( $ pattern ) -> setParams ( $ params ) -> setBlock ( true ) ; } | Parse the dynamic segments of the pattern and replace then for corresponding regex . |
3,999 | protected function buildGroup ( array $ routes ) { $ groupCount = ( int ) $ map = $ regex = [ ] ; foreach ( $ routes as $ route ) { $ params = $ route -> getParams ( ) ; $ paramsCount = count ( $ params ) ; $ groupCount = max ( $ groupCount , $ paramsCount ) + 1 ; $ regex [ ] = $ route -> getPattern ( ) . str_repeat ( ... | Group several dynamic routes patterns into one big regex and maps the routes to the pattern positions in the big regex . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.