idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
51,000 | public function regionMatches ( $ offseta , $ str , $ offsetb , $ length ) { return $ this -> regionCompare ( $ offseta , $ str , $ offsetb , $ length ) == 0 ; } | Tests if two string regions are equal . |
51,001 | public function regionMatchesIgnoreCase ( $ offseta , $ str , $ offsetb , $ length ) { return $ this -> regionCompareIgnoreCase ( $ offseta , $ str , $ offsetb , $ length ) == 0 ; } | Tests if two string regions are equal ignoring case differences . |
51,002 | public function replace ( $ search , $ replacement , & $ count = 0 ) { return new GString ( str_replace ( $ search , $ replacement , $ this -> value , $ count ) ) ; } | Returns a new GString resulting from replacing all occurrences of the search string with the replacement string . |
51,003 | public function replaceAll ( $ regex , $ replacement , $ limit = - 1 , & $ count = 0 ) { return new GString ( preg_replace ( $ regex , $ replacement , $ this -> value , $ limit , $ count ) ) ; } | Replaces each substring of this string that matches the given regular expression with the given replacement . |
51,004 | public function replaceIgnoreCase ( $ search , $ replacement , & $ count = 0 ) { return new GString ( str_ireplace ( $ search , $ replacement , $ this -> value , $ count ) ) ; } | Returns a new GString resulting from replacing all occurrences of the search string with the replacement string ignoring case differences . |
51,005 | public function split ( $ regex , $ limit = - 1 ) { $ parts = preg_split ( $ regex , $ this -> value , $ limit ) ; for ( $ i = 0 , $ l = count ( $ parts ) ; $ i < $ l ; $ i ++ ) { $ parts [ $ i ] = new GString ( $ parts [ $ i ] ) ; } return $ parts ; } | Splits this string around matches of the given regular expression . |
51,006 | public function startsWith ( $ prefix , $ fromIndex = 0 ) { $ pattern = "/^" . preg_quote ( $ prefix ) . "/" ; return $ this -> substring ( $ fromIndex ) -> matches ( $ pattern ) ; } | Tests if this string starts with the specified prefix optionally checking for a match at the specified index . |
51,007 | public function substring ( $ beginIndex , $ endIndex = null ) { if ( $ beginIndex < 0 ) { throw new GStringIndexOutOfBoundsException ( $ beginIndex ) ; } else if ( $ beginIndex == $ this -> length ( ) ) { return new GString ( "" ) ; } if ( $ endIndex === null ) { $ length = $ this -> length ( ) - $ beginIndex ; if ( $... | Returns a new GString that is a substring of this string . |
51,008 | public function delRightMost ( $ sSearch ) { $ sSource = $ this -> value ; for ( $ i = strlen ( $ sSource ) ; $ i >= 0 ; $ i = $ i - 1 ) { $ f = strpos ( $ sSource , $ sSearch , $ i ) ; if ( $ f !== false ) { return new GString ( substr ( $ sSource , 0 , $ f ) ) ; break ; } } return new GString ( $ sSource ) ; } | Deletes the right most string from the found search string starting from right to left including the search string itself . |
51,009 | final protected function URLToString ( array $ components = array ( 'scheme' , 'user' , 'pass' , 'host' , 'port' , 'path' , 'query' , 'fragment' ) ) { $ url = '' ; $ query = "{$this->query}" ; if ( in_array ( 'scheme' , $ components ) ) { if ( is_string ( $ this -> _url_data [ 'scheme' ] ) ) { $ url .= rtrim ( $ this -... | Combine URL components into a URL string |
51,010 | function fetch_calc ( $ on_null = null ) { $ calc_entry = $ this -> fetch_entry ( ) ; $ value = array_pop ( $ calc_entry ) ; if ( $ value !== null ) { return $ value ; } else { return $ on_null ; } } | Shorthand for retrieving value from a querie that performs a COUNT SUM or some other calculation . |
51,011 | public function toProfiles ( $ profiles , $ horn ) { $ horn = array_merge ( [ 'profile_uids' => $ profiles ] , $ horn ) ; return $ this -> request -> send ( 'POST' , "/profiles/horns" , $ horn ) ; } | Sends a horn to a multiple profiles |
51,012 | public function hasType ( NodeType $ type ) { foreach ( $ this -> types as $ t ) { if ( $ t -> getId ( ) == $ type -> getId ( ) ) { return true ; } } return false ; } | Check if a node got a specific type |
51,013 | public function delete ( ) { if ( ! userHasPermission ( 'admin:blog:category:' . $ this -> blog -> id . ':delete' ) ) { unauthorised ( ) ; } $ id = $ this -> uri -> segment ( 6 ) ; if ( $ this -> blog_category_model -> delete ( $ id ) ) { $ this -> session -> set_flashdata ( 'success' , 'Category was deleted successful... | Delete a blog category |
51,014 | public function process ( \ Jb \ Bundle \ TagCloudBundle \ Model \ TagCloud $ cloud ) { $ keys = array_keys ( $ cloud -> getTags ( ) ) ; asort ( $ keys ) ; $ new = array ( ) ; $ old = $ cloud -> getTags ( ) ; foreach ( $ keys as $ key ) { $ new [ $ key ] = $ old [ $ key ] ; } $ cloud -> setTags ( $ new ) ; } | Sort the tag in the cloud |
51,015 | public function createAction ( string $ production_slug , AuthorizationCheckerInterface $ auth , TokenStorageInterface $ token_storage , Request $ request ) : Response { $ production_repo = $ this -> em -> getRepository ( Production :: class ) ; if ( null === $ production = $ production_repo -> findOneBy ( [ 'slug' => ... | Create a new standalone event . |
51,016 | public function readAction ( string $ production_slug , int $ id , AuthorizationCheckerInterface $ auth ) : Response { list ( $ event , $ production ) = $ this -> lookupEntity ( Event :: class , $ id , $ production_slug ) ; if ( null !== $ redirect = $ this -> checkSchedule ( $ event , $ production ) ) { return $ redir... | Show a single event . |
51,017 | public function updateAction ( string $ production_slug , int $ id , AuthorizationCheckerInterface $ auth , TokenStorageInterface $ token , Request $ request ) : Response { list ( $ event , $ production ) = $ this -> lookupEntity ( Event :: class , $ id , $ production_slug ) ; if ( null !== $ redirect = $ this -> check... | Update a standalone event . |
51,018 | public function archiveAction ( string $ production_slug , PaginatorInterface $ paginator , AuthorizationCheckerInterface $ auth , Request $ request ) : Response { $ production_repo = $ this -> em -> getRepository ( Production :: class ) ; if ( null === $ production = $ production_repo -> findOneBy ( [ 'slug' => $ prod... | Show a list of archived events . |
51,019 | private function checkSchedule ( Event $ event , Production $ production ) : ? RedirectResponse { if ( null !== $ schedule = $ event -> getSchedule ( ) ) { return new RedirectResponse ( $ this -> url_generator -> generate ( 'bkstg_schedule_read' , [ 'production_slug' => $ production -> getSlug ( ) , 'id' => $ schedule ... | Check if an event has a parent schedule . |
51,020 | public static function last_lines ( $ path , $ line_count , $ offset = 0 , $ block_size = 512 ) { $ lines = array ( ) ; $ leftover = "" ; $ fh = fopen ( $ path , 'r' ) ; $ storeOffset = $ offset ; fseek ( $ fh , $ offset , SEEK_END ) ; do { $ can_read = $ block_size ; if ( ftell ( $ fh ) < $ block_size ) { $ can_read =... | Shows the last lines of a text - file . |
51,021 | private function getLang ( ) { $ path = $ this -> _config -> get ( 'langpath' ) . $ this -> _config -> get ( 'lang' ) ; if ( file_exists ( $ path . '/validation.php' ) ) { $ this -> _lang = require_once $ path . '/validation.php' ; } else { $ this -> _lang = require_once $ this -> _config -> get ( 'langpath' ) . '/en_U... | Gets the language pack . |
51,022 | public function make ( $ input , $ rules = [ ] ) { $ this -> _input = $ input ; foreach ( $ rules as $ key => $ value ) { $ this -> validateInput ( $ input , $ rules , $ key ) ; } return $ this ; } | Creates validation . |
51,023 | public function isValid ( ) { $ valid = true ; foreach ( $ this -> _errors as $ input => $ message ) { foreach ( $ message as $ item ) { if ( ! empty ( $ item ) ) { $ valid = false ; } } } foreach ( $ this -> _input as $ key => $ value ) { \ Session :: delete ( 'input.' . $ key ) ; } return $ valid ; } | Checks to see if the validation passed . |
51,024 | private function validateInput ( $ input , $ rules , $ key ) { if ( isset ( $ input [ $ key ] ) && isset ( $ rules [ $ key ] ) ) { $ ruleExp = explode ( '|' , $ rules [ $ key ] ) ; foreach ( $ ruleExp as $ rule ) { $ this -> parseRule ( $ rule , $ input , $ key ) ; } } } | Validates the given input . |
51,025 | private function parseRule ( $ rule , $ input , $ key ) { $ ruleExp = explode ( ':' , $ rule ) ; if ( count ( $ ruleExp ) > 1 ) { switch ( $ ruleExp [ 0 ] ) { case 'match' : $ this -> _errors [ $ key ] [ ] = $ this -> _parser -> match ( $ input , $ key , $ ruleExp [ 1 ] , $ this -> _lang [ 'match' ] ) ; break ; case 'm... | Parses a given rule with the given input . |
51,026 | public function sort ( $ sort = null ) { if ( $ sort !== null && ! is_int ( $ sort ) ) { throw new \ InvalidArgumentException ( 'Invalid sort type. Sort type must ne integer.' , E_USER_ERROR ) ; } return $ sort === null ? sort ( $ this -> storedData ) : sort ( $ this -> storedData , $ sort ) ; } | Sort an array collection |
51,027 | private function resolveColumnType ( Column \ ColumnTypeInterface $ type ) { $ typeExtensions = [ ] ; $ parentType = $ type -> getParent ( ) ; $ class = get_class ( $ type ) ; foreach ( $ this -> extensions as $ extension ) { $ typeExtensions = array_merge ( $ typeExtensions , $ extension -> getColumnTypeExtensions ( $... | Wraps a type into a ResolvedColumnTypeInterface implementation and connects it with its parent type . |
51,028 | private function resolveFilterType ( Filter \ FilterTypeInterface $ type ) { $ typeExtensions = [ ] ; $ parentType = $ type -> getParent ( ) ; $ class = get_class ( $ type ) ; foreach ( $ this -> extensions as $ extension ) { $ typeExtensions = array_merge ( $ typeExtensions , $ extension -> getFilterTypeExtensions ( $... | Wraps a type into a ResolvedFilterTypeInterface implementation and connects it with its parent type . |
51,029 | private function resolveActionType ( Action \ ActionTypeInterface $ type ) { $ typeExtensions = [ ] ; $ parentType = $ type -> getParent ( ) ; $ class = get_class ( $ type ) ; foreach ( $ this -> extensions as $ extension ) { $ typeExtensions = array_merge ( $ typeExtensions , $ extension -> getActionTypeExtensions ( $... | Wraps a type into a ResolvedActionTypeInterface implementation and connects it with its parent type . |
51,030 | public function upAction ( $ pageId , $ menuName ) { $ pageMenuRepo = $ this -> getDoctrine ( ) -> getRepository ( 'FulgurioLightCMSBundle:PageMenu' ) ; $ pageMenu = $ pageMenuRepo -> findOneBy ( array ( 'page' => $ pageId , 'label' => $ menuName ) ) ; $ position = $ pageMenu -> getPosition ( ) ; if ( $ position > 1 ) ... | Move up page position in menu |
51,031 | public function changePositionAction ( $ pageId , $ menuName , $ newPosition ) { if ( $ this -> getRequest ( ) -> isXmlHttpRequest ( ) ) { $ pageMenuRepo = $ this -> getDoctrine ( ) -> getRepository ( 'FulgurioLightCMSBundle:PageMenu' ) ; $ pageMenu = $ pageMenuRepo -> findOneBy ( array ( 'page' => $ pageId , 'label' =... | Change position of page in menu in ajax |
51,032 | public function getPath ( string $ conversionName = '' ) : string { if ( ! $ this -> hasFile ( ) ) { throw new Exception ( 'Error getting path for media with no file' ) ; } $ path = $ this -> getFile ( ) -> getPath ( ) ; if ( $ conversionName ) { $ path = $ this -> getBasePath ( ) . DIRECTORY_SEPARATOR . $ conversionNa... | Get the path to the original media file . |
51,033 | public function getColumnMetadata ( string $ columnName ) : ColumnMetadata { if ( ! array_key_exists ( $ columnName , $ this -> columnMetadataList ) ) { throw new \ RuntimeException ( 'Table "' . $ this -> tableName . '" doesn\'t contain column "' . $ columnName . '"' ) ; } return $ this -> columnMetadataList [ $ colum... | Get the metadata for a single column . |
51,034 | public function hasStringTypeColumn ( ) : bool { $ hasStringType = false ; foreach ( $ this -> columnMetadataList as $ columnMetadata ) { $ hasStringType = $ hasStringType || $ columnMetadata -> isStringType ( ) ; } return $ hasStringType ; } | Returns true if the table has at least one column that is a string type . |
51,035 | public function getPrimaryKeyMetadata ( ) : ? ColumnMetadata { $ filteredColumnList = array_filter ( $ this -> columnMetadataList , function ( ColumnMetadata $ columnMetadata ) { return $ columnMetadata -> isPrimaryKey ( ) ; } ) ; return ( count ( $ filteredColumnList ) ) ? current ( $ filteredColumnList ) : null ; } | Returns the primary key column metadata . |
51,036 | public function moveImage ( $ photo , $ photoKey , $ model , $ request ) { $ path = $ this -> getUploadPath ( $ model ) ; $ photos [ 'fileName' ] = $ this -> fileName ; $ photos [ 'fileSize' ] = $ this -> fileSize ; $ photos [ 'original' ] = $ this -> original ( $ photo , $ path [ 'original' ] ) ; $ photos [ 'thumbnail... | move upload image |
51,037 | public function getUploadPath ( $ model ) { $ path = $ this -> options [ 'path' ] . '/' . $ model -> id ; $ paths = [ ] ; $ paths [ 'original' ] = $ path . '/original' ; $ paths [ 'thumbnails' ] = $ path . '/thumbnails' ; return $ paths ; } | get upload path |
51,038 | public function getCropTypeSize ( $ thumbnail , $ crop_type ) { if ( $ crop_type === 'square' ) { return [ 'width' => $ thumbnail [ 'width' ] , 'height' => $ thumbnail [ 'width' ] ] ; } $ ratio = $ thumbnail [ 'width' ] / $ thumbnail [ 'height' ] ; if ( $ crop_type === 'vertical' ) { return [ 'width' => $ ratio == 1 ||... | get crop type size |
51,039 | private function getSizeParameters ( $ request ) { $ input = isset ( $ this -> options [ 'group' ] ) ? "{$this->options['group']}.{$this->options['index']}" : ( isset ( $ this -> options [ 'inputPrefix' ] ) && $ this -> options [ 'inputPrefix' ] ? "{$this->options['inputPrefix']}" : '' ) ; return [ 'x' => is_array ( $ ... | get size request parameter |
51,040 | public function allFiles ( ) { $ files = $ this -> files -> all ( ) ; return $ this -> convertedFiles ? $ this -> convertedFiles : $ this -> convertedFiles = $ this -> convertUploadedFiles ( $ files ) ; } | Get an array of all of the files on the request . |
51,041 | protected function convertUploadedFiles ( array $ files ) { return array_map ( function ( $ file ) { if ( is_null ( $ file ) || ( is_array ( $ file ) && empty ( array_filter ( $ file ) ) ) ) return $ file ; return is_array ( $ file ) ? $ this -> convertUploadedFiles ( $ file ) : UploadedFile :: createFromBase ( $ file ... | Convert the given array of Symfony UploadedFiles to custom Framework UploadedFiles . |
51,042 | public function prefers ( $ contentTypes ) { $ accepts = $ this -> getAcceptableContentTypes ( ) ; $ contentTypes = ( array ) $ contentTypes ; foreach ( $ accepts as $ accept ) { if ( in_array ( $ accept , [ '*/*' , '*' ] ) ) return $ contentTypes [ 0 ] ; foreach ( $ contentTypes as $ contentType ) { $ type = $ content... | Return the most suitable content type from the given array based on content negotiation . |
51,043 | public function getRand ( $ min = 0 , $ max = 0x7fffffff ) { $ t = ( $ this -> x ^ ( $ this -> x << 11 ) ) & 0x7fffffff ; $ this -> x = $ this -> y ; $ this -> y = $ this -> z ; $ this -> z = $ this -> w ; $ this -> w = ( $ this -> w ^ ( $ this -> w >> 19 ) ^ ( $ t ^ ( $ t >> 8 ) ) ) ; return $ this -> w % ( $ max - $ ... | Function getTrand Return random number between max and min |
51,044 | public function close ( ) : Promised { return ( $ this -> pool ? $ this -> pool -> shutdown ( ) : ( $ this -> session ? $ this -> session -> close ( ) : Promise :: resolved ( ) ) ) -> sync ( $ this -> closed ( ) ) ; } | close pool connections or session client |
51,045 | public function appendChild ( $ child = null ) { $ arg_list = func_get_args ( ) ; foreach ( $ arg_list as $ arg ) { if ( $ arg instanceof AbstractElement ) { $ inject = $ arg ; } elseif ( is_scalar ( $ arg ) ) { $ inject = new Text ( $ arg ) ; } else { throw new \ InvalidArgumentException ; } $ inject -> _setParent ( $... | Inject One Or More Elements |
51,046 | public function removeChild ( AbstractElement $ element ) { $ index = $ this -> indexOf ( $ element ) ; if ( $ index !== null ) { unset ( $ this -> childElements [ $ index ] ) ; $ this -> childElements = array_values ( $ this -> childElements ) ; return true ; } return false ; } | Remove a child element |
51,047 | public function indexOf ( AbstractElement $ element ) { $ search_result = array_search ( $ element , $ this -> childElements , true ) ; return $ search_result === false ? null : $ search_result ; } | Get the index of a child element or null if not found . |
51,048 | public function childAtIndex ( $ index ) { if ( $ index !== null && isset ( $ this -> childElements [ $ index ] ) ) { return $ this -> childElements [ $ index ] ; } return null ; } | Gets the child element at a given index or null if not found . |
51,049 | public function getNextSiblingOf ( AbstractElement $ element ) { $ index = $ this -> indexOf ( $ element ) ; return $ this -> childAtIndex ( $ index + 1 ) ; } | Get the next sibling of a given child element or null if not found |
51,050 | public function getPreviousSiblingOf ( AbstractElement $ element ) { $ index = $ this -> indexOf ( $ element ) ; return $ this -> childAtIndex ( $ index - 1 ) ; } | Get the previous sibling of a given child element or null if not found |
51,051 | protected function initArrayCallbackOption ( $ options ) { if ( ! isset ( $ options [ 'callback' ] ) && ! isset ( $ options [ 'groups' ] ) && \ is_callable ( $ options ) ) { $ options = [ 'callback' => $ options ] ; } return $ options ; } | Init callback options . |
51,052 | public function fillData ( $ entity , ArrayHash $ values ) { $ properties = $ this -> getEntityProperties ( $ entity ) ; foreach ( $ properties as $ property ) { if ( array_key_exists ( $ property , $ values ) ) { if ( ! $ entity -> $ property instanceof Collection ) { $ entity -> $ property = $ values -> $ property ; ... | Fills entity with set data from form |
51,053 | public function getEntityArrayValues ( $ entity ) { $ values = [ ] ; $ properties = $ this -> getEntityProperties ( $ entity ) ; $ metadata = $ this -> em -> getClassMetadata ( get_class ( $ entity ) ) ; foreach ( $ properties as $ property ) { $ values [ $ property ] = $ metadata -> getFieldValue ( $ entity , $ proper... | Returns default values for forms |
51,054 | public function getEntityProperties ( $ entity ) { $ metadata = $ this -> em -> getClassMetadata ( get_class ( $ entity ) ) ; return array_merge ( $ metadata -> getFieldNames ( ) , $ metadata -> getAssociationNames ( ) ) ; } | Return entity properties names |
51,055 | public function getChartOfAccounts ( ) { $ organization = $ this -> oh -> getOrganization ( ) ; if ( ! $ organization -> getChartOfAccounts ( ) ) { $ chart = $ this -> createChartOfAccounts ( $ organization ) ; $ this -> em -> persist ( $ organization ) ; $ this -> em -> flush ( ) ; } return $ organization -> getChartO... | Get chart of accounts for current Organization |
51,056 | public function createChartOfAccounts ( OrganizationInterface $ organization ) { $ account = $ this -> accountFqcn ; $ chart = new $ account ( $ organization -> getName ( ) ) ; $ organization -> setChartOfAccounts ( $ chart ) ; $ chart -> addChild ( $ assets = new $ account ( 'Assets' ) ) ; $ assets -> addChild ( $ ban... | Create new chart of accounts |
51,057 | public function findAccountForPath ( $ path ) { $ dql = ' SELECT a,p,j,op FROM %s a LEFT JOIN a.postings p LEFT JOIN p.journal j LEFT JOIN j.postings op WHERE a.path = :path AND a.organization = :organization ' ; retur... | Find Account for path |
51,058 | public function createAccountsFromSegmentation ( $ segmentation ) { $ segments = explode ( ':' , $ segmentation ) ; $ account = $ this -> oh -> getOrganization ( ) -> getChartOfAccounts ( ) ; foreach ( $ segments as $ segment ) { $ parent = $ account ; if ( ! $ account = $ account -> getChildForName ( $ segment ) ) { $... | Create Account tree from segmentation |
51,059 | public function createAccount ( $ name = null ) { $ account = new $ this -> accountFqcn ( $ name ) ; $ account -> setOrganization ( $ this -> oh -> getOrganization ( ) ) ; return $ account ; } | Create new Account |
51,060 | public function renderArray ( AccountInterface $ account ) { $ array = array ( 'name' => $ account -> getName ( ) , ) ; foreach ( $ account -> getChildren ( ) as $ child ) { $ array [ 'children' ] [ ] = $ this -> renderArray ( $ child ) ; } return $ array ; } | Render Account tree as a multi - level array |
51,061 | public function getFavouriteAccountsForUser ( UserInterface $ user ) { $ criteria = new Criteria ( ) ; $ criteria -> where ( $ criteria -> expr ( ) -> in ( 'id' , $ user -> getMyFavouriteAccountIds ( ) ) ) ; return $ this -> oh -> getOrganization ( ) -> getAccounts ( ) -> matching ( $ criteria ) ; } | Get a collection of favourite Accounts for User |
51,062 | protected function getItemsOfDeletedFiles ( Storage $ storage , Finder $ finder ) { $ items = [ ] ; foreach ( $ storage -> getItems ( ) as $ item ) { foreach ( $ finder as $ file ) { if ( pathinfo ( $ item -> getPath ( ) , PATHINFO_BASENAME ) == $ file -> getFilename ( ) ) { continue 2 ; } } $ items [ ] = $ item ; } re... | Get items of deleted files . |
51,063 | protected function getItemFromFile ( Storage $ storage , SplFileInfo $ file ) { foreach ( $ storage -> getItems ( ) as $ item ) { if ( pathinfo ( $ item -> getPath ( ) , PATHINFO_BASENAME ) == $ file -> getFilename ( ) ) { return $ item ; } } return false ; } | Get item from files . |
51,064 | protected function isAllowFile ( SplFileInfo $ file ) { return in_array ( strtolower ( pathinfo ( $ file -> getFilename ( ) , PATHINFO_EXTENSION ) ) , $ this -> allow_ext ) ; } | Is allow file . |
51,065 | protected function checkStorageId ( $ path , Storage $ storage , StorageRepository $ rep ) { if ( ! file_exists ( $ path . StorageListener :: ID_FILE ) ) { file_put_contents ( $ path . StorageListener :: ID_FILE , $ storage -> getId ( ) ) ; } elseif ( file_get_contents ( $ path . StorageListener :: ID_FILE ) == $ stora... | Update storage id . |
51,066 | protected function getProgress ( InputInterface $ input , OutputInterface $ output ) { if ( $ input -> getOption ( 'no-progress' ) ) { $ output = new NullOutput ( ) ; } if ( ! $ input -> getArgument ( 'storage' ) ) { $ input -> setOption ( 'export' , null ) ; } if ( $ export_file = $ input -> getOption ( 'export' ) ) {... | Get progress . |
51,067 | public function indexAction ( ) { $ layoutGroups = array_map ( function ( $ elementType ) { return [ "title" => ucfirst ( $ elementType ) . "s" , "elementType" => $ elementType , "elements" => $ this -> elementTypesModel -> getListedElements ( $ elementType ) , ] ; } , $ this -> elementTypesModel -> getAllElementTypes ... | Handles the index action |
51,068 | public function showElementAction ( $ elementType , $ key ) { try { $ element = $ this -> elementTypesModel -> getElement ( $ key , $ elementType ) ; if ( ( null === $ element ) || $ element -> isHidden ( ) ) { throw new NotFoundHttpException ( "Element '{$key}' of type '{$elementType}' not found." ) ; } $ templateSuff... | Displays a preview file |
51,069 | public function elementsOverviewAction ( $ elementType ) { try { $ elementReferences = array_map ( function ( Element $ element ) { return $ element -> getReference ( ) ; } , $ this -> elementTypesModel -> getListedElements ( $ elementType ) ) ; return $ this -> twig -> render ( "@core/elements_overview_page.twig" , [ ... | Returns a list of all elements of the given type |
51,070 | public function setDirectory ( $ directory ) { if ( false === is_string ( $ directory ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ directory ) ) , E_USER_ERROR ) ; } $ this -> directory = new Directory ( $ directory ) ; if ( false =... | Sets the directory to write to |
51,071 | public function setExtension ( $ extension ) { if ( false === is_string ( $ extension ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ extension ) ) , E_USER_ERROR ) ; } $ extension = ( $ extension [ 0 ] === '.' ) ? $ extension : '.' . ... | Set file extension |
51,072 | public function setMode ( $ mode ) { if ( false === is_string ( $ mode ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ mode ) ) , E_USER_ERROR ) ; } $ this -> mode = $ mode ; return $ this ; } | Sets the log rotate mode |
51,073 | public function setSuffix ( $ suffix ) { if ( false === is_string ( $ suffix ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ suffix ) ) , E_USER_ERROR ) ; } $ this -> suffix = $ suffix ; return $ this ; } | Sets the suffix |
51,074 | private function generateFileName ( ) { return $ this -> directory -> entity ( ) -> getPath ( ) . date ( $ this -> getMode ( ) ) . $ this -> getSuffix ( ) . $ this -> getExtension ( ) ; } | Generates a filename with current rotation mode |
51,075 | public static function getDay ( $ day , $ langCode , $ style = self :: STYLE_LONG ) { $ langCode = static :: checkLanguageCode ( $ langCode ) ; return self :: $ i18n [ $ langCode ] [ 'day' ] [ $ style ] [ $ day ] ; } | Get translated day of the week . |
51,076 | public static function getMonth ( $ month , $ langCode , $ style = self :: STYLE_LONG ) { $ langCode = static :: checkLanguageCode ( $ langCode ) ; return self :: $ i18n [ $ langCode ] [ 'month' ] [ $ style ] [ $ month ] ; } | Get translated month . |
51,077 | public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ expr = $ this -> getOperand ( ) ; $ direction = $ this -> getDirection ( ) ; return $ params -> getDriver ( ) -> toSQL ( $ params , $ expr , false ) . " " . $ direction ; } | Write a order direction clause as SQL query syntax |
51,078 | public function log ( ) { $ content = call_user_func_array ( array ( $ this -> ladybug , 'dump' ) , func_get_args ( ) ) ; $ trace = debug_backtrace ( ) ; $ this -> data [ 'vars' ] [ ] = array ( 'file' => isset ( $ trace [ 0 ] [ 'file' ] ) ? $ trace [ 0 ] [ 'file' ] : '' , 'line' => isset ( $ trace [ 0 ] [ 'line' ] ) ? ... | Log an info . |
51,079 | public function load ( ) { static :: $ loaded = true ; $ container = $ this -> getContainer ( ) ; if ( $ container ) { $ config = $ container -> get ( 'config' ) ; $ events = $ config [ 'plugin-manager' ] ; foreach ( $ events as $ event => $ plugins ) { foreach ( $ plugins as $ type => $ plugin ) { $ this -> attach ( $... | load events with their plugins |
51,080 | protected function buildCacheKey ( array $ assets , array $ options ) { $ cachekey = $ this -> Request -> getServerName ( ) ; $ cachekey .= "(asset(" . implode ( '|' , $ assets ) . ")(" . implode ( '|' , $ options ) . "))" ; return $ cachekey ; } | Builds a unique cache key based on the asset array and options |
51,081 | public static function permanentRedirect ( $ url , $ externalRedirect = false ) { $ response = new static ( ) ; $ response -> redirect ( $ url , $ externalRedirect , self :: HTTP_PERMANENT_REDIRECT ) ; return $ response ; } | Convenience function to create a 301 response |
51,082 | public static function temporaryRedirect ( $ url , $ externalRedirect = false ) { $ response = new static ( ) ; $ response -> redirect ( $ url , $ externalRedirect , self :: HTTP_TEMPORARY_REDIRECT ) ; return $ response ; } | Convenience function to create a 302 response |
51,083 | public function expire ( $ name , $ path = '/' , $ domain = null ) { if ( null === $ path ) { $ path = '/' ; } if ( empty ( $ domain ) ) { $ domains = array_keys ( $ this -> cookieJar ) ; } else { $ domains = array ( $ domain ) ; } foreach ( $ domains as $ domain ) { unset ( $ this -> cookieJar [ $ domain ] [ $ path ] ... | Removes a cookie by name . |
51,084 | public function all ( ) { $ this -> flushExpiredCookies ( ) ; $ flattenedCookies = array ( ) ; foreach ( $ this -> cookieJar as $ path ) { foreach ( $ path as $ cookies ) { foreach ( $ cookies as $ cookie ) { $ flattenedCookies [ ] = $ cookie ; } } } return $ flattenedCookies ; } | Returns not yet expired cookies . |
51,085 | public function allValues ( $ uri , $ returnsRawValue = false ) { $ this -> flushExpiredCookies ( ) ; $ parts = array_replace ( array ( 'path' => '/' ) , parse_url ( $ uri ) ) ; $ cookies = array ( ) ; foreach ( $ this -> cookieJar as $ domain => $ pathCookies ) { if ( $ domain ) { $ domain = '.' . ltrim ( $ domain , '... | Returns not yet expired cookie values for the given URI . |
51,086 | public function getActiveAddress ( ) { if ( null === $ this -> getAddresses ( ) ) { return null ; } if ( 1 === count ( $ this -> getAddresses ( ) ) ) { foreach ( $ this -> getAddresses ( ) as $ address ) { return $ address ; } } if ( null === $ this -> response [ 'active_address' ] ) { return null ; } return $ this -> ... | Return the surname . |
51,087 | public function serialize ( ) { $ it = new SerializedTokenIterator ( [ ] ) ; $ this -> preSerialize ( $ it ) ; foreach ( $ this -> tokens as $ token ) { $ token -> serialize ( $ it ) ; } $ this -> postSerialize ( $ it ) ; return json_encode ( $ it -> getArrayCopy ( ) ) ; } | Serializes a token container into an encoded string that consumes a minimal amount of storage memory . |
51,088 | public function unserialize ( $ serialized ) { $ this -> tokens = [ ] ; $ tokenFactory = $ this -> getTokenFactory ( ) ; $ it = new SerializedTokenIterator ( json_decode ( $ serialized , true ) ) ; $ this -> preUnserialize ( $ it ) ; while ( $ it -> valid ( ) ) { $ this -> tokens [ ] = $ tokenFactory -> createToken ( $... | Reads a serialized token container and reconstitus all token objects . |
51,089 | public function offsetGet ( $ offset ) { if ( empty ( $ this -> tokens [ $ offset ] ) ) { throw new \ OutOfBoundsException ( 'No token found at offset ' . $ offset ) ; } return $ this -> tokens [ $ offset ] ; } | Get the token at the given position . |
51,090 | public function clearCache ( ) { $ dbInstace = $ this -> getDbInstance ( ) ; $ sql = ' DELETE FROM `cache`; VACUUM; ' ; $ stmt = $ dbInstace -> prepare ( $ sql ) ; if ( $ stmt -> execute ( ) ) { return ; } else { $ error = $ stmt -> errorInfo ( ) ; $ errorMsg = $ error [ 2 ] ; throw new \ R... | Clears all cache |
51,091 | public function startMeasure ( string $ name ) : void { if ( App :: $ Debug ) { App :: $ Debug -> startMeasure ( $ name ) ; } } | Start timeline measure |
51,092 | public function stopMeasure ( string $ name ) : void { if ( App :: $ Debug ) { App :: $ Debug -> stopMeasure ( $ name ) ; } } | Stop timeline measure |
51,093 | protected function load ( ) { $ data = array ( ) ; foreach ( $ this -> loaders as $ loader ) { try { $ data = array_merge ( $ data , $ loader -> load ( ) ) ; if ( $ loader -> stopPropagation ( ) ) { break ; } } catch ( LoaderException $ e ) { $ this -> getLogger ( ) -> error ( $ e -> getMessage ( ) ) ; } } return $ dat... | Loads and aggregates information from each registered loader . |
51,094 | public static function merge ( ) : array { $ arguments = [ ] ; foreach ( func_get_args ( ) as $ key => $ val ) { if ( ! Any :: isArray ( $ val ) ) { $ val = [ ] ; } $ arguments [ $ key ] = $ val ; } return call_user_func_array ( 'array_merge' , $ arguments ) ; } | Alternative function for array_merge - safe for use with any - type params . |
51,095 | public static function pluck ( ? string $ key = null , ? array $ array = null ) : array { if ( ! Any :: isArray ( $ array ) || ! Any :: isStr ( $ key ) ) { return [ ] ; } $ output = [ ] ; foreach ( $ array as $ item ) { $ object = $ item [ $ key ] ; if ( ! self :: in ( $ object , $ output ) ) { $ output [ ] = $ object ... | Extract from multi - array elements by key to single - level array |
51,096 | public static function exportVar ( $ var , $ indent = null , $ guessTypes = false ) { switch ( gettype ( $ var ) ) { case 'string' : if ( true === $ guessTypes ) { if ( $ var === '0' || $ var === '' ) { return 'false' ; } elseif ( $ var === '1' ) { return 'true' ; } } return '\'' . $ var . '\'' ; case 'array' : $ index... | Alternative var_export function for php > = 5 . 4 syntax |
51,097 | public function getApiRequest ( $ apiUrl , $ deferred ) { return new Request ( [ 'url' => $ apiUrl , 'resolveCallback' => function ( Response $ response ) use ( $ deferred ) { $ data = ( string ) $ response -> getBody ( ) ; $ headers = $ response -> getHeaders ( ) ; $ code = $ response -> getStatusCode ( ) ; $ shortUrl... | Create the API Request |
51,098 | public function fetch ( $ protected_resource_url , $ parameters = array ( ) , $ http_method = self :: HTTP_METHOD_GET , array $ http_headers = array ( ) , $ form_content_type = self :: HTTP_FORM_CONTENT_TYPE_MULTIPART ) { if ( $ this -> access_token ) { switch ( $ this -> access_token_type ) { case self :: ACCESS_TOKEN... | Fetch a protected resource |
51,099 | protected function configureRepository ( Config $ config ) : OptionRepository { $ repositories = [ ] ; foreach ( $ config -> getAll ( ) as $ class => $ optionsArray ) { $ prefix = array_key_exists ( OptionRepository :: PREFIX , $ optionsArray ) ? $ optionsArray [ OptionRepository :: PREFIX ] : '' ; $ options = $ this -... | Configure a single repository from a Config file . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.