idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
231,900 | public function createStreamFromArray ( array $ params ) { $ string = "" ; foreach ( $ params as $ key => $ value ) { $ string .= $ key . '=' . urlencode ( trim ( $ value ) ) . '&' ; } $ string = rtrim ( $ string , "&" ) ; return $ this -> createStream ( $ string ) ; } | Helper method to create a string stream from given array . |
231,901 | public function callMethod ( $ name , $ httpMethod = "POST" , $ params = array ( ) , $ payload = null , $ returnClass = null , $ expectedExceptions = null ) { $ objectToFormatConverter = $ this -> dataFormat == self :: DATA_FORMAT_JSON ? new ObjectToJSONConverter ( ) : new ObjectToXMLConverter ( ) ; $ formatToObjectCon... | Implement the call method to call a proxy service |
231,902 | public function setTemplateFile ( string $ sRelativePathToFile ) : void { if ( ! is_file ( $ sRelativePathToFile ) ) { throw new \ Exception ( 'Template file not found.' ) ; } $ sFileContent = file_get_contents ( $ sRelativePathToFile ) ; $ this -> setTemplate ( $ sFileContent ) ; } | This method is used to set the template from a relative path . |
231,903 | public function render ( ) : string { $ sOutput = preg_replace_callback ( '/{(.*?)}/' , function ( $ aResult ) { $ aToSearch = explode ( '.' , $ aResult [ 1 ] ) ; $ aSearchIn = $ this -> getData ( ) ; foreach ( $ aToSearch as $ sKey ) { list ( $ sFormattedKey , $ mParam ) = self :: getFunctionNameAndParameter ( $ sKey ... | This method replaces the placeholders in the template string with the values from the data object and returns the new string . |
231,904 | private function safelyReadData ( $ path ) { $ fp = fopen ( $ path , 'r' ) ; $ retries = 0 ; do { if ( $ retries > 0 ) { usleep ( static :: MS_BETWEEN_RETRIES * 1000 ) ; } $ retries ++ ; } while ( ! flock ( $ fp , LOCK_SH | LOCK_NB ) && $ retries <= static :: MAX_RETRIES ) ; if ( $ retries == static :: MAX_RETRIES ) { ... | Safely read data from a file |
231,905 | private function safelyWriteData ( $ path , $ mode , $ data ) { $ fp = fopen ( $ path , $ mode ) ; $ retries = 0 ; if ( empty ( $ fp ) ) { return false ; } do { if ( $ retries > 0 ) { usleep ( static :: MS_BETWEEN_RETRIES * 1000 ) ; } $ retries ++ ; } while ( ! flock ( $ fp , LOCK_EX ) && $ retries <= static :: MAX_RET... | Safely write data to a file |
231,906 | protected function processKey ( $ key ) { $ key = trim ( strtolower ( $ key ) ) ; $ key = preg_replace ( '#[^a-z0-9\.]#' , '-' , $ key ) . '~' . $ this -> keySuffix ; return $ key ; } | Process the key to be filename safe |
231,907 | protected function closePrevious ( ) { static $ previous = [ ] ; $ id = spl_object_hash ( $ this -> getDriver ( ) ) ; if ( isset ( $ previous [ $ id ] ) && $ previous [ $ id ] !== $ this -> prepared ) { $ this -> realClose ( $ previous [ $ id ] ) ; } $ previous [ $ id ] = $ this -> prepared ; return $ this ; } | Close previous prepared statement |
231,908 | protected function setError ( $ resource ) { if ( is_string ( $ resource ) ) { $ this -> getDriver ( ) -> setError ( $ resource , - 1 ) ; } else { $ this -> getDriver ( ) -> setError ( $ this -> realError ( $ resource ) , $ this -> realErrorCode ( $ resource ) ) ; } } | Set driver error |
231,909 | public static function createGeocodingProvider ( $ provider_code = GeocodingProviders :: GOOGLE_MAPS ) { if ( GeocodingProviders :: GOOGLE_MAPS != $ provider_code ) { throw new GeocodingException ( 'Geocoding provider \'' . $ provider_code . '\' not found.' ) ; } return new \ BlueBlazeAssociates \ Geocoding \ PostalCod... | Creates a geocoding provider based on a set code . |
231,910 | public static function createGeocoder ( $ country_code = CountryCodes :: US , $ provider_code = GeocodingProviders :: GOOGLE_MAPS ) { if ( CountryCodes :: US != $ country_code ) { throw new GeocodingException ( 'PostalCode geocoder for country \'' . $ country_code . '\' not found.' ) ; } $ geocoding_provider = static :... | Create a country specific geocoder for postal codes . |
231,911 | public static function create ( array $ parameters , Configuration $ configuration = null ) { if ( isset ( $ parameters [ 'driver_class' ] ) ) { if ( ! in_array ( 'Fridge\DBAL\Driver\DriverInterface' , class_implements ( $ parameters [ 'driver_class' ] ) ) ) { throw FactoryException :: driverMustImplementDriverInterfac... | Creates a DBAL connection . |
231,912 | public function getName ( ) { switch ( $ this -> ofWeek ) { case Carbon :: MONDAY : $ name = 'Monday' ; break ; case Carbon :: TUESDAY : $ name = 'Tuesday' ; break ; case Carbon :: WEDNESDAY : $ name = 'Wednesday' ; break ; case Carbon :: THURSDAY : $ name = 'Thursday' ; break ; case Carbon :: FRIDAY : $ name = 'Friday... | Gets the day s name . |
231,913 | public function get ( $ name ) { if ( isset ( $ this -> items [ $ name ] ) ) { return $ this -> items [ $ name ] ; } if ( ! isset ( $ this -> itemSetting [ $ name ] ) ) { return null ; } $ itemSetting = $ this -> itemSetting [ $ name ] ; if ( is_callable ( $ itemSetting ) ) { $ item = $ itemSetting ( ) ; } elseif ( is_... | Get an item from container |
231,914 | public function set ( $ name , $ value = null ) { $ values = is_array ( $ name ) ? $ name : [ $ name => $ value ] ; foreach ( $ values as $ name => $ value ) { $ this -> itemSetting [ $ name ] = $ value ; } unset ( $ this -> items [ $ name ] ) ; } | Set one or multiple items or factory function of items or class of items into DI container . |
231,915 | public function setRouting ( array $ routings = [ ] ) { $ this -> dispatcher = null ; $ this -> routings = $ routings + $ this -> routings ; foreach ( $ this -> routings as $ name => & $ routing ) { if ( 1 == count ( $ routing ) ) { array_unshift ( $ routing , '/' . ltrim ( $ name , '/' ) ) ; } if ( 2 == count ( $ rout... | Set app routing . |
231,916 | public function handlerAlias ( $ name , $ value = null ) { $ alias = is_array ( $ name ) ? $ name : [ $ name => $ value ] ; $ this -> handlerAlias = $ alias + $ this -> handlerAlias ; } | Set alias name for request handlers |
231,917 | public function route ( $ method , $ uri ) { $ baseDir = $ this -> get ( ' .baseDir' ) ; if ( "/" !== $ baseDir && 0 === strpos ( $ uri , $ baseDir ) ) { $ uri = substr ( $ uri , strlen ( $ baseDir ) ) ; } $ routings = $ this -> routings ; $ this -> dispatcher = $ this -> dispatcher ? : \ FastRoute \ simpleDispatcher (... | Determin which route to use and parameters in uri . |
231,918 | private function patternToPath ( $ pattern , $ params ) { $ routeParser = new RouteParserStd ; $ routes = $ routeParser -> parse ( $ pattern ) ; for ( $ i = count ( $ routes ) - 1 ; $ i >= 0 ; $ i -- ) { $ url = '' ; foreach ( $ routes [ $ i ] as $ part ) { if ( is_array ( $ part ) ) { $ part = @ $ params [ $ part [ 0 ... | Convert url pattern to actual path |
231,919 | public function run ( $ options = [ ] ) { $ method = @ $ options [ 'method' ] ? : $ _SERVER [ 'REQUEST_METHOD' ] ; $ uri = @ $ options [ 'uri' ] ? : rawurldecode ( $ _SERVER [ 'REQUEST_URI' ] ) ; if ( false !== $ pos = strpos ( $ uri , '?' ) ) { $ uri = substr ( $ uri , 0 , $ pos ) ; } $ routeInfo = $ this -> route ( $... | Entry point for application |
231,920 | public function runAs ( $ routeName , $ params = [ ] ) { if ( ! isset ( $ this -> routings [ $ routeName ] ) ) { throw new \ Exception ( "Route name '{$routeName}' not found!" ) ; } $ handler = end ( $ this -> routings [ $ routeName ] ) ; $ this -> appendHandlerQueue ( $ handler ) ; $ output = null ; while ( $ handler ... | Handle current request using specificed route handler |
231,921 | public function executeHandler ( $ handler , $ params , $ prevOutput = null ) { if ( is_callable ( $ handler ) ) { return $ handler ( $ this , $ params , $ prevOutput ) ; } if ( $ actualHandler = @ $ this -> handlerAlias [ $ handler ] ) { return $ this -> executeHandler ( $ actualHandler , $ params , $ prevOutput ) ; }... | Parse and execute request handler |
231,922 | public function hashCode ( ) { $ h = $ this -> hash ; $ l = $ this -> length ( ) ; if ( $ h == 0 && $ l > 0 ) { for ( $ i = 0 ; $ i < $ l ; $ i ++ ) { $ h = ( int ) ( 31 * $ h + $ this -> charCodeAt ( $ i ) ) ; } $ this -> hash = $ h ; } return $ h ; } | Returns a hash code for this string . |
231,923 | public function indexOf ( $ sequence , $ fromIndex = 0 , $ ignoreCase = false ) { if ( $ fromIndex < 0 ) { $ fromIndex = 0 ; } else if ( $ fromIndex >= $ this -> length ( ) ) { return - 1 ; } if ( $ ignoreCase == false ) { $ index = strpos ( $ this -> value , $ sequence , $ fromIndex ) ; } else { $ index = stripos ( $ ... | Returns the index within this string of the first occurrence of the specified string optionally starting the search at the specified index . |
231,924 | public function lastIndexOf ( $ sequence , $ fromIndex = 0 , $ ignoreCase = false ) { if ( $ fromIndex < 0 ) { $ fromIndex = 0 ; } else if ( $ fromIndex >= $ this -> length ( ) ) { return - 1 ; } if ( $ ignoreCase == false ) { $ index = strrpos ( $ this -> value , $ sequence , $ fromIndex ) ; } else { $ index = strripo... | Returns the index within this string of the last occurrence of the specified string searching backward starting at the specified index . |
231,925 | public function matches ( $ regex , & $ matches = null ) { $ match = preg_match ( $ regex , $ this -> value , $ matches ) ; for ( $ i = 0 , $ l = count ( $ matches ) ; $ i < $ l ; $ i ++ ) { $ matches [ $ i ] = new GString ( $ matches [ $ i ] ) ; } return $ match == 1 ; } | Tells whether or not this string matches the given regular expression . |
231,926 | public function padLeft ( $ length , $ padString ) { return new GString ( str_pad ( $ this -> value , $ length , $ padString , STR_PAD_LEFT ) ) ; } | Returns the left padded string to a certain length with the specified string . |
231,927 | public function padRight ( $ length , $ padString ) { return new GString ( str_pad ( $ this -> value , $ length , $ padString , STR_PAD_RIGHT ) ) ; } | Returns the right padded string to a certain length with the specified string . |
231,928 | public function regionCompare ( $ offseta , $ str , $ offsetb , $ length , $ ignoreCase = false ) { $ a = $ this -> substring ( $ offseta ) ; $ b = new GString ( $ str ) ; $ b = $ b -> substring ( $ offsetb ) ; if ( $ ignoreCase == false ) { return strncmp ( $ a , $ b , $ length ) ; } else { return strncasecmp ( $ a , ... | Compare two string regions . |
231,929 | public function regionCompareIgnoreCase ( $ offseta , $ str , $ offsetb , $ length ) { return $ this -> regionCompare ( $ offseta , $ str , $ offsetb , $ length , true ) ; } | Compare two string regions ignoring case differences . |
231,930 | public function regionMatches ( $ offseta , $ str , $ offsetb , $ length ) { return $ this -> regionCompare ( $ offseta , $ str , $ offsetb , $ length ) == 0 ; } | Tests if two string regions are equal . |
231,931 | 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 . |
231,932 | 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 . |
231,933 | 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 . |
231,934 | 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 . |
231,935 | 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 . |
231,936 | 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 . |
231,937 | 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 . |
231,938 | 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 . |
231,939 | 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 |
231,940 | 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 . |
231,941 | 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 |
231,942 | 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 |
231,943 | 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 |
231,944 | 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 |
231,945 | 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 . |
231,946 | 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 . |
231,947 | 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 . |
231,948 | 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 . |
231,949 | 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 . |
231,950 | 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 . |
231,951 | 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 . |
231,952 | public function make ( $ input , $ rules = [ ] ) { $ this -> _input = $ input ; foreach ( $ rules as $ key => $ value ) { $ this -> validateInput ( $ input , $ rules , $ key ) ; } return $ this ; } | Creates validation . |
231,953 | 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 . |
231,954 | 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 . |
231,955 | 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 . |
231,956 | 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 |
231,957 | 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 . |
231,958 | 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 . |
231,959 | 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 . |
231,960 | 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 |
231,961 | 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 |
231,962 | 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 . |
231,963 | 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 . |
231,964 | 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 . |
231,965 | 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 . |
231,966 | 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 |
231,967 | public function getUploadPath ( $ model ) { $ path = $ this -> options [ 'path' ] . '/' . $ model -> id ; $ paths = [ ] ; $ paths [ 'original' ] = $ path . '/original' ; $ paths [ 'thumbnails' ] = $ path . '/thumbnails' ; return $ paths ; } | get upload path |
231,968 | 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 |
231,969 | 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 |
231,970 | 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 . |
231,971 | 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 . |
231,972 | 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 . |
231,973 | 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 |
231,974 | 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 |
231,975 | 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 |
231,976 | 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 |
231,977 | 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 . |
231,978 | 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 . |
231,979 | 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 |
231,980 | 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 |
231,981 | protected function initArrayCallbackOption ( $ options ) { if ( ! isset ( $ options [ 'callback' ] ) && ! isset ( $ options [ 'groups' ] ) && \ is_callable ( $ options ) ) { $ options = [ 'callback' => $ options ] ; } return $ options ; } | Init callback options . |
231,982 | 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 |
231,983 | 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 |
231,984 | public function getEntityProperties ( $ entity ) { $ metadata = $ this -> em -> getClassMetadata ( get_class ( $ entity ) ) ; return array_merge ( $ metadata -> getFieldNames ( ) , $ metadata -> getAssociationNames ( ) ) ; } | Return entity properties names |
231,985 | 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 |
231,986 | 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 |
231,987 | 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 |
231,988 | 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 |
231,989 | public function createAccount ( $ name = null ) { $ account = new $ this -> accountFqcn ( $ name ) ; $ account -> setOrganization ( $ this -> oh -> getOrganization ( ) ) ; return $ account ; } | Create new Account |
231,990 | 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 |
231,991 | 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 |
231,992 | 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 . |
231,993 | 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 . |
231,994 | protected function isAllowFile ( SplFileInfo $ file ) { return in_array ( strtolower ( pathinfo ( $ file -> getFilename ( ) , PATHINFO_EXTENSION ) ) , $ this -> allow_ext ) ; } | Is allow file . |
231,995 | 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 . |
231,996 | 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 . |
231,997 | 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 |
231,998 | 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 |
231,999 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.