idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
227,800 | protected function display ( $ data = [ ] ) { $ function = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 2 ) [ 1 ] [ 'function' ] ; $ event = lcfirst ( substr ( $ function , 2 ) ) ; $ id = $ this -> getId ( ) ; $ name = '@' . $ id . '/' . $ id . '/' . $ event . $ this -> view -> getExtension ( ) ; $ this -> view -> d... | Output a rendered template by current event template |
227,801 | public function getBasePath ( ) { if ( ! $ this -> basePath ) { $ class = new \ ReflectionClass ( $ this ) ; $ this -> basePath = substr ( dirname ( $ class -> getFileName ( ) ) , strlen ( getcwd ( ) ) + 1 ) ; if ( substr ( $ class -> getName ( ) , 0 , 8 ) == 'Miaoxing' ) { $ this -> basePath = dirname ( $ this -> base... | Returns the web path for this plugin |
227,802 | public function isInCidrRange ( string $ cidrIpShort , $ cidrMask ) : bool { if ( is_string ( $ cidrMask ) && ! ctype_digit ( $ cidrMask ) ) { throw new \ InvalidArgumentException ( 'cidrMask must be of type int or a string losslessly' . ' convertible to int.' ) ; } list ( $ lower , $ upper ) = $ this -> calculateIpRan... | checks if IP address is in given CIDR range |
227,803 | private function calculateIpRange ( int $ cidrIpLong , int $ cidrMask ) : array { $ netWork = $ cidrIpLong & $ this -> netMask ( $ cidrMask ) ; $ lower = $ netWork + 1 ; $ upper = ( $ netWork | $ this -> inverseNetMask ( $ cidrMask ) ) - 1 ; return array ( $ lower , $ upper ) ; } | returns lower and upper ip for IP range as long |
227,804 | public function openSocket ( int $ port , int $ timeout = 5 , callable $ openWith = null ) : Stream { $ socket = new Socket ( $ this -> ip , $ port , null ) ; if ( null !== $ openWith ) { $ socket -> openWith ( $ openWith ) ; } return $ socket -> connect ( ) -> setTimeout ( $ timeout ) ; } | opens socket to this ip address |
227,805 | public function form ( array $ args = [ ] , $ implode = false ) { $ attributes = $ this -> parseAttributes ( self :: FORM_ATTRIBUTES , $ args ) ; return $ this -> maybeImplode ( $ attributes , $ implode ) ; } | Normalize form attributes |
227,806 | public function input ( array $ args = [ ] , $ implode = false ) { $ this -> filterInputType ( ) ; $ attributes = $ this -> parseAttributes ( self :: INPUT_ATTRIBUTES , $ args ) ; return $ this -> maybeImplode ( $ attributes , $ implode ) ; } | Normalize input attributes |
227,807 | public function maybeImplode ( array $ attributes , $ implode = true ) { if ( ! $ implode || $ implode !== 'implode' ) { return $ attributes ; } $ results = [ ] ; foreach ( $ attributes as $ key => $ value ) { $ quotes = false !== stripos ( $ key , 'data-' ) ? "'" : '"' ; if ( is_array ( $ value ) ) { $ value = json_en... | Possibly implode attributes into a string |
227,808 | public function select ( array $ args = [ ] , $ implode = false ) { $ attributes = $ this -> parseAttributes ( self :: SELECT_ATTRIBUTES , $ args ) ; return $ this -> maybeImplode ( $ attributes , $ implode ) ; } | Normalize select attributes |
227,809 | public function textarea ( array $ args = [ ] , $ implode = false ) { $ attributes = $ this -> parseAttributes ( self :: TEXTAREA_ATTRIBUTES , $ args ) ; return $ this -> maybeImplode ( $ attributes , $ implode ) ; } | Normalize textarea attributes |
227,810 | protected function filterAttributes ( array $ attributeKeys ) { $ filtered = array_intersect_key ( $ this -> args , array_flip ( $ attributeKeys ) ) ; foreach ( $ filtered as $ key => $ value ) { if ( ! in_array ( $ key , self :: BOOLEAN_ATTRIBUTES ) ) continue ; if ( $ value !== false ) { $ filtered [ $ key ] = '' ; c... | Filter attributes by the provided attrribute keys and remove any non - boolean keys with empty values |
227,811 | private function requireProvider ( $ message = '' ) { if ( empty ( $ this -> cacheProvider ) ) { if ( ! empty ( $ this -> log ) ) $ this -> log -> notice ( "Cache provider is not available. " . $ message ) ; return false ; } return true ; } | Require a provider |
227,812 | public function execute ( Request $ request ) { if ( ! $ this -> requireProvider ( "Executing cache request" ) ) return null ; $ cacheKey = $ request -> getCacheKey ( ) ; if ( empty ( $ cacheKey ) ) { if ( ! empty ( $ this -> log ) ) $ this -> log -> error ( "Invalid or missing cache key." ) ; return null ; } $ cacheRe... | Do a cache request |
227,813 | protected function validateKey ( $ key ) { $ reserved = [ 'type' , 'id' ] ; if ( in_array ( strtolower ( $ key ) , $ reserved ) ) { throw MetadataException :: reservedFieldKey ( $ key , $ reserved ) ; } } | Validates that the field key is not reserved . |
227,814 | public function executeHandler ( $ request , $ handler ) { if ( ! is_array ( $ handler ) || is_callable ( $ handler ) ) { $ handler = [ $ handler , \ Bit55 \ Midcore \ Middleware \ NotFoundHandler :: class ] ; } $ dispatcher = new Dispatcher ( $ handler , $ this -> container ) ; return $ dispatcher -> dispatch ( $ requ... | Executing application action . |
227,815 | protected function RemovalObject ( ) { $ id = Request :: PostData ( 'delete' ) ; return $ id ? Layout :: Schema ( ) -> ByID ( $ id ) : null ; } | Gets the layout that is requested to be removed |
227,816 | protected function CanDelete ( Layout $ layout ) { return self :: Guard ( ) -> Allow ( BackendAction :: Delete ( ) , $ layout ) && self :: Guard ( ) -> Allow ( BackendAction :: UseIt ( ) , new LayoutForm ( ) ) ; } | True if layout can be deleted |
227,817 | public function resolve ( RouteInterface $ route ) { if ( is_string ( $ handler = $ route -> handler ( ) ) ) { $ handler = explode ( '@' , $ handler ) ; } $ parameters = ( array ) $ route -> parameters ( ) ; list ( $ handler , $ reflection ) = $ this -> reflection ( $ handler ) ; $ parameters = $ this -> arguments ( $ ... | Resolves the specified route instance . |
227,818 | protected function instance ( $ class ) { $ reflection = new \ ReflectionClass ( $ class ) ; $ arguments = array ( ) ; $ constructor = $ reflection -> getConstructor ( ) ; if ( $ this -> container -> has ( $ class ) ) { return $ this -> container -> get ( $ class ) ; } if ( $ constructor !== null ) { $ arguments = $ th... | Returns the instance of the identifier from the container . |
227,819 | protected function reflection ( $ handler ) { if ( ! is_array ( $ handler ) ) { $ instance = new \ ReflectionFunction ( $ handler ) ; return array ( $ handler , $ instance ) ; } list ( $ class , $ method ) = ( array ) $ handler ; $ instance = new \ ReflectionMethod ( $ class , $ method ) ; $ handler = array ( $ this ->... | Returns a ReflectionFunctionAbstract instance . |
227,820 | public function indexAction ( Request $ request ) { $ query = $ this -> get ( 'ydle.logger' ) -> createViewLogQuery ( ) ; $ paginator = $ this -> get ( 'knp_paginator' ) ; $ pagination = $ paginator -> paginate ( $ query , $ this -> get ( 'request' ) -> query -> get ( 'page' , 1 ) , 25 ) ; $ logs = new Logs ( ) ; $ for... | Homepage for logs |
227,821 | public function getDefinition ( ) { $ definition [ 'KeySchema' ] = $ this -> getDefinitionKeySchema ( ) ; if ( $ this -> isPrimary ( ) ) { $ definition [ 'AttributeDefinitions' ] = $ this -> getDefinitionAttributes ( ) ; } else { $ definition [ 'IndexName' ] = $ this -> getName ( ) ; $ definition [ 'Projection' ] = $ t... | Return the index definition formatted for AWS SDK . |
227,822 | public static function createBrickFromPostValues ( $ postValues ) { if ( isset ( $ postValues [ 'title' ] ) ) { $ brickObject = new \ stdClass ( ) ; $ brickObject -> title = $ postValues [ 'title' ] ; $ brickObject -> slug = StringUtil :: slugify ( $ postValues [ 'title' ] ) ; $ brickObject -> fields = array ( ) ; if (... | Create a brick from post values |
227,823 | public function manage ( ) { if ( ! ( $ this -> processManagerDto instanceof ProcessManagerDto ) ) { throw new ProcessManagerException ( "ProcessManagerDto wasn't set." ) ; } $ this -> executionDto = new ExecutionDto ( ) ; $ this -> reactControlDto = $ this -> processManagerDto ; $ this -> initStartMethods ( ) ; $ this... | Manage processes creation and termination during to load manager info and tasks number |
227,824 | public function render ( ElementInterface $ element ) { $ captcha = $ element -> getCaptcha ( ) ; if ( $ captcha === null || ! $ captcha instanceof CaptchaAdapter ) { throw new Exception \ DomainException ( sprintf ( '%s requires that the element has a "captcha" attribute of type Zend\Captcha\Image; none found' , __MET... | Render the captcha |
227,825 | public function createView ( ExpressViewRenderer $ renderer , $ resource ) { $ resource = ( string ) $ resource ; if ( ! is_file ( $ resource ) ) { throw new \ RuntimeException ( sprintf ( 'Express view not found: "%s"' , $ resource ) ) ; } $ key = $ this -> createKey ( $ resource ) ; $ typeName = $ this -> createTypeN... | Create an express view from the given XML view will utilize the cache directory to dump and load a template compiled into plain PHP code . |
227,826 | protected function parseView ( ExpressViewRenderer $ renderer , $ data , $ resource = '' ) { try { $ reader = new XmlStreamReader ( ) ; $ reader -> XML ( $ data ) ; $ buffer = '<?xml version="1.0"?>' . "\n" ; while ( $ reader -> read ( ) ) { switch ( $ reader -> nodeType ) { case XmlStreamReader :: ELEMENT : $ buffer .... | Compile the given XML source and return a compiler object . |
227,827 | protected function Init ( ) { $ sql = Access :: SqlBuilder ( ) ; $ tbl = Membergroup :: Schema ( ) -> Table ( ) ; $ order = $ sql -> OrderList ( $ sql -> OrderAsc ( $ tbl -> Field ( 'Name' ) ) ) ; $ this -> groups = Membergroup :: Schema ( ) -> Fetch ( false , null , $ order ) ; return parent :: Init ( ) ; } | Initiaizes the set of groups |
227,828 | protected function resolveSubQueryClosure ( \ Closure $ callback ) : Query { if ( $ this -> closureResolver === null ) { return $ this -> makeCopyForSubQuery ( ) -> apply ( $ callback ) ; } else { return $ this -> closureResolver -> resolveSubQueryClosure ( $ callback ) ; } } | Retrieves the query object from a closure given instead of a subquery . |
227,829 | protected function resolveCriteriaGroupClosure ( \ Closure $ callback ) : Query { if ( $ this -> closureResolver === null ) { return $ this -> makeCopyForCriteriaGroup ( ) -> apply ( $ callback ) ; } else { return $ this -> closureResolver -> resolveCriteriaGroupClosure ( $ callback ) ; } } | Retrieves the query object from a closure given instead of a criteria group query . |
227,830 | public function configure ( array $ data ) { $ this -> checkData ( $ data ) ; $ body = new MimeMessage ( ) ; $ body -> addPart ( $ this -> getPart ( $ data ) ) ; $ this -> setBody ( $ body ) ; $ this -> addTo ( $ data [ 'to' ] ) ; $ this -> setSubject ( utf8_decode ( $ this -> subject ) ) ; return $ this ; } | Configure amil message with passed data |
227,831 | public function execute ( Request $ request ) : Response { $ host = $ request -> getHost ( ) ; $ socket = new ClientSocket ( $ host , 80 ) ; $ socket -> connect ( ) ; $ communicator = $ socket -> getCommunicator ( ) ; $ communicator -> write ( $ request ) ; $ communicator -> writeLine ( '' ) ; $ communicator -> writeLi... | Executes a http request on success a Response object will be returned |
227,832 | public function hasNext ( ) { if ( parent :: hasNext ( ) && ( $ this -> getItemPosition ( ) < ( $ this -> getItemOffset ( ) + $ this -> getItemCount ( ) ) - 1 ) ) { return true ; } return false ; } | return true if iterator has a next items |
227,833 | public function valid ( ) { if ( $ this -> getItemPosition ( ) >= $ this -> getItemOffset ( ) && $ this -> getItemPosition ( ) < ( $ this -> getItemOffset ( ) + $ this -> getItemCount ( ) ) ) { return parent :: valid ( ) ; } return false ; } | return true if current item is valid |
227,834 | public function count ( ) { $ countItems = $ this -> countItems ( ) - $ this -> getItemOffset ( ) ; if ( $ countItems >= $ this -> getItemCount ( ) ) { $ countItems = $ this -> getItemCount ( ) ; } return $ countItems ; } | return the number of items in the subset |
227,835 | public function loadHeaders ( ) { $ this -> headers = array ( ) ; foreach ( $ this -> pluginPaths as $ pluginPath ) { if ( ! file_exists ( $ pluginPath ) || ! is_dir ( $ pluginPath ) ) { continue ; } $ pluginPathContents = array_diff ( scandir ( $ pluginPath ) , array ( '..' , '.' ) ) ; foreach ( $ pluginPathContents a... | Load the header files of all plugins . |
227,836 | public function removePluginPath ( $ directory ) { if ( ( $ key = array_search ( $ directory , $ this -> pluginPaths ) ) !== false ) { unset ( $ this -> pluginPaths [ $ key ] ) ; } } | Remove a path where plugins can be found |
227,837 | static public function create ( ServiceLocator $ serviceLocator , $ requestedClass , array $ options = null ) { if ( class_exists ( $ requestedClass ) ) { $ reflection = new \ ReflectionClass ( $ requestedClass ) ; $ arguments = [ ] ; $ constructor = $ reflection -> getConstructor ( ) ; if ( $ constructor ) { $ constru... | Attempts to create a new class based on constructor typehints and parameter names |
227,838 | public function findAllByGroupQuery ( GroupInterface $ group , bool $ active = true ) : Query { $ qb = $ this -> createQueryBuilder ( 'r' ) ; return $ qb -> join ( 'r.groups' , 'g' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'g' , ':group' ) ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'r.active' , ':active' ) ) -> setParamet... | Get the query to find all resources by group . |
227,839 | protected function file ( string $ namespace ) : FileInterface { $ meta = $ this -> getNamespace ( $ namespace ) ; return $ this -> path -> get ( $ namespace . '.' . $ meta [ 'format' ] ) ; } | Get storage file for the given namespace |
227,840 | public static function register ( ) { Container :: extensionMethod ( 'addDate' , function ( $ container , $ name , $ label = NULL ) { $ picker = $ container [ $ name ] = new DatePicker ( $ label ) ; return $ picker ; } ) ; } | Registers this control |
227,841 | public function check ( $ name ) { if ( array_key_exists ( $ name , static :: $ marks ) ) { return number_format ( ( microtime ( true ) - static :: $ marks [ $ name ] ) * 1000 , 2 ) ; } return 0.0 ; } | Gets elapsed time in milliseconds for given benchmark . |
227,842 | public static function valueToString ( $ value ) { if ( null === $ value ) { return 'null' ; } if ( true === $ value ) { return 'true' ; } if ( false === $ value ) { return 'false' ; } if ( is_array ( $ value ) ) { return 'array(' . count ( $ value ) . ')' ; } if ( is_object ( $ value ) ) { return get_class ( $ value )... | Transform a value into a user friendly string . |
227,843 | public function checkType ( $ value ) { if ( isset ( $ this -> name ) && null !== $ this -> name ) { $ fn = 'is_' . $ this -> name ; return $ fn ( $ value ) ; } throw new \ Exception ( 'Invalid name or name not defined for primitive type.' ) ; } | Is the value type the same of this object? |
227,844 | public function get_prop_width ( $ resized_height ) { $ width = intval ( ( $ this -> width * $ resized_height ) / $ this -> height ) ; if ( ! $ width ) $ width = 1 ; return $ width ; } | Returns calculated proportional width from the given height |
227,845 | public function get_prop_height ( $ resized_width ) { $ height = intval ( ( $ this -> height * $ resized_width ) / $ this -> width ) ; if ( ! $ height ) $ height = 1 ; return $ height ; } | Returns calculated proportional height from the given width |
227,846 | public function resize ( $ width , $ height ) { if ( ! $ width ) $ width = 1 ; if ( ! $ height ) $ height = 1 ; return ( ( false !== ( $ img = new gd ( array ( $ width , $ height ) ) ) ) && $ img -> imagecopyresampled ( $ this ) && ( false !== ( $ this -> image = $ img -> get_image ( ) ) ) && ( false !== ( $ this -> wi... | Resize image . Returns TRUE on success or FALSE on failure |
227,847 | public function resize_fit ( $ width , $ height ) { if ( ( ! $ width && ! $ height ) || ( ( $ width == $ this -> width ) && ( $ height == $ this -> height ) ) ) return true ; if ( ! $ width || ( ( $ height / $ width ) < ( $ this -> height / $ this -> width ) ) ) $ width = intval ( ( $ this -> width * $ height ) / $ thi... | Resize image to fit in given resolution . Returns TRUE on success or FALSE on failure |
227,848 | public function useCookies ( ) { if ( ! headers_sent ( ) ) { if ( count ( $ this -> getCookies ( ) ) ) { foreach ( $ this -> getCookies ( ) as $ cookie ) { header ( $ cookie ) ; } } return $ this ; } else { throw new HeadersAlreadySendedException ( ' Başlıklarınız zaten gönderilmiş, cookie kullanılamaz.... | Cookie leri header olarak atar |
227,849 | public static function createDetachedEntity ( string $ objectName , array $ data ) { $ detachedEntity = new $ objectName ; self :: updateEntityFromArray ( $ detachedEntity , $ data ) ; return $ detachedEntity ; } | Creates new entity based on object name sets object parameter from data |
227,850 | public static function updateEntityFromArray ( $ entity , array $ data ) { foreach ( $ data as $ field => $ value ) { $ method = 'set' . self :: formatStringToMethodName ( $ field ) ; if ( method_exists ( $ entity , $ method ) ) { $ entity -> $ method ( $ value ) ; } } return $ entity ; } | Updates Entity from data calling setters based on data keys |
227,851 | public static function formatStringToMethodName ( string $ input ) : string { $ methodName = implode ( '' , array_map ( 'ucfirst' , explode ( '_' , strtolower ( $ input ) ) ) ) ; return $ methodName ; } | Generates camel - case method names from string |
227,852 | public function dump ( array $ options = array ( ) ) { $ this -> document = new \ DOMDocument ( '1.0' , 'utf-8' ) ; $ this -> document -> formatOutput = true ; $ container = $ this -> document -> createElementNS ( 'http://symfony.com/schema/dic/services' , 'container' ) ; $ container -> setAttribute ( 'xmlns:xsi' , 'ht... | Dumps the service container as an XML string . |
227,853 | private function escape ( array $ arguments ) { $ args = array ( ) ; foreach ( $ arguments as $ k => $ v ) { if ( is_array ( $ v ) ) { $ args [ $ k ] = $ this -> escape ( $ v ) ; } elseif ( is_string ( $ v ) ) { $ args [ $ k ] = str_replace ( '%' , '%%' , $ v ) ; } else { $ args [ $ k ] = $ v ; } } return $ args ; } | Escapes arguments . |
227,854 | public static function phpToXml ( $ value ) { switch ( true ) { case null === $ value : return 'null' ; case true === $ value : return 'true' ; case false === $ value : return 'false' ; case $ value instanceof Parameter : return '%' . $ value . '%' ; case is_object ( $ value ) || is_resource ( $ value ) : throw new Run... | Converts php types to xml types . |
227,855 | public function primeReferences ( ClassMetadata $ class , $ documents , $ attributeName , $ refresh , $ readOnly , $ primer = null ) { $ data = $ this -> parseDotSyntaxForPrimer ( $ attributeName , $ class , $ documents ) ; $ mapping = $ data [ 'mapping' ] ; $ attributeName = $ data [ 'attributeName' ] ; $ class = $ da... | Prime references within a mapped attribute of one or more documents . |
227,856 | public function sum ( ) : Segment { return AlKashi :: side ( $ this -> firstSegment , $ this -> degree , $ this -> secondSegment ) ; } | It sums the segments like we would sum vectors except here we don t use vectors as it would need a plan to express a direction |
227,857 | public function transform ( $ entity ) { if ( null === $ entity ) { return '' ; } if ( ! is_subclass_of ( $ entity , $ this -> entityClass ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unsupported entity "%s" into "%s" loader.' , get_class ( $ entity ) , __CLASS__ ) ) ; } return $ entity -> getId ( ) ; } | Model - > View |
227,858 | public function reverseTransform ( $ id ) { if ( ! $ id ) { return null ; } if ( ! $ entity = $ this -> retrieve ( $ id ) ) { throw new TransformationFailedException ( sprintf ( '%s#%s cannot be found.' , $ this -> entityClass , $ id ) ) ; } return $ entity ; } | View - > Model |
227,859 | protected function execute ( \ Symfony \ Component \ Console \ Input \ InputInterface $ input , \ Symfony \ Component \ Console \ Output \ OutputInterface $ output ) { $ this -> setOut ( $ output ) ; $ this -> logInfo ( "Command '" . $ this -> getName ( ) . "' is started." ) ; try { $ req = new ARequest ( ) ; $ this ->... | Override execute method to prevent DDL statements are not allowed in transactions error . |
227,860 | public function toArray ( ) { return [ $ this -> id , $ this -> filterName , $ this -> operator , serialize ( $ this -> value ) , ] ; } | Returns the array representation of the active filter . |
227,861 | static public function createFromArray ( array $ data ) { if ( 4 != count ( $ data ) ) { throw new InvalidArgumentException ( "Expected data as a 4 length array." ) ; } $ filter = new static ( $ data [ 0 ] , $ data [ 1 ] ) ; $ filter -> setOperator ( $ data [ 2 ] ) ; $ filter -> setValue ( unserialize ( $ data [ 3 ] ) ... | Creates the active filter from the given data array . |
227,862 | public function getFromPath ( $ path , $ depth = 0 , $ withParents = false ) { if ( isset ( $ this -> fs [ $ path ] ) ) { return $ this -> fs [ $ path ] ; } } | Get a file object by the given path |
227,863 | public function getById ( $ id , $ depth = 0 , $ withParents = false ) { foreach ( $ this -> fs as $ file ) { if ( $ file -> getId ( ) == $ id ) { return $ file ; } } } | Get a file by its unique id . In normal filesystems its unique id is the path . In Database driven filesystems its easier to work with primary keys etc . |
227,864 | public function getByHash ( $ hash ) { foreach ( $ this -> fs as $ file ) { if ( $ file -> getHash ( ) == $ hash ) { return $ file ; } } } | Get a file by its hash |
227,865 | public function delete ( FileInterface $ file ) { if ( isset ( $ this -> fs [ $ file -> getPath ( ) ] ) ) { unset ( $ this -> fs [ $ file -> getPath ( ) ] ) ; } if ( $ dir = $ file -> getDir ( ) ) { $ dir -> removeChild ( $ file ) ; } return $ this ; } | Delete the file . If it is a directory recursively delete it |
227,866 | public function beforeDeleteById ( \ Magento \ Customer \ Api \ CustomerRepositoryInterface $ subject , $ customerId ) { $ this -> deleteSnaps ( $ customerId ) ; $ this -> deleteChange ( $ customerId ) ; $ result = [ $ customerId ] ; return $ result ; } | Remove customer related data from Downline on customer delete from adminhtml . |
227,867 | static function sendXmlHttpResponseHeaders ( $ contenttype = "application/json" , $ charset = 'utf-8' ) { if ( is_null ( $ charset ) ) $ charset = mb_internal_encoding ( ) ; header ( "Content-Type: $contenttype; charset=$charset" ) ; header ( "Expires: Sat, 1 Jan 2005 00:00:00 GMT" ) ; header ( "Last-Modified: " . gmda... | Output http headers suitable for xmlhttp |
227,868 | static function appendToUrl ( $ url , $ append ) { if ( $ append ) { $ regs = [ ] ; if ( preg_match ( '|^(.+?)(?:\?(.*?))?(#.*)?$|' , $ url , $ regs ) ) { $ u = $ regs [ 1 ] ; $ q = $ regs [ 2 ] ; $ a = $ regs [ 3 ] ; if ( $ q ) $ q = $ q . "&" . $ append ; else $ q = $ append ; return $ u . '?' . $ q . $ a ; } else re... | Append a parameter to an url |
227,869 | public function getFilters ( ) { if ( $ this -> progressive ) { $ fc = new FilterChain ( ) ; $ fc -> add ( new Interlace ( ImageInterface :: INTERLACE_PLANE ) ) ; return $ fc ; } else { return null ; } } | Return a FilterChain with Filters for postprocessing the image |
227,870 | public function getExecutionTimeProportion ( ) { if ( $ this -> getExecutionTime ( ) && $ this -> getProcess ( ) -> getAvgExecutionTime ( ) ) { return round ( $ this -> getExecutionTime ( ) / $ this -> getProcess ( ) -> getAvgExecutionTime ( ) , 2 ) ; } elseif ( $ this -> getExecutionTime ( ) ) { return $ this -> getEx... | Returns proportion between execution time and avg execution time |
227,871 | public function countErrorsForProcess ( LifecycleEventArgs $ event ) { $ entityManager = $ event -> getEntityManager ( ) ; $ repository = $ entityManager -> getRepository ( get_class ( $ this ) ) ; $ repository -> countByProcessIdAndStatus ( $ this -> getProcess ( ) , [ self :: STATUS_FAILED , self :: STATUS_ABORTED ] ... | Gets triggered only after update |
227,872 | private function buildRenderer ( $ render = 'foil' , array $ renderingInfo = [ ] ) { switch ( $ render ) { case "raw" : $ renderer = new RawRenderer ( ) ; $ renderInfo = [ ] ; break ; case "json" : $ renderer = new JsonRenderer ( ) ; $ renderInfo = [ ] ; break ; case "foil" : default : $ renderer = new FoilRenderer ( )... | Build setup and return renderer |
227,873 | function Insert ( $ item , $ parent = null , $ previous = null ) { if ( $ previous ) { $ parent = $ this -> provider -> ParentOf ( $ previous ) ; } $ oldNext = $ this -> provider -> NextOf ( $ item ) ; $ oldPrev = $ this -> provider -> PreviousOf ( $ item ) ; $ oldFirst = $ this -> provider -> FirstChildOf ( $ parent )... | Inserts the item |
227,874 | function Remove ( $ item ) { $ prev = $ this -> provider -> PreviousOf ( $ item ) ; $ next = $ this -> provider -> NextOf ( $ item ) ; if ( $ next ) { $ this -> provider -> SetPrevious ( $ next , $ prev ) ; } $ this -> provider -> Delete ( $ item ) ; if ( $ next ) { $ this -> provider -> Save ( $ next ) ; } } | Removes the item |
227,875 | public function getPhoto ( $ attributes = [ ] , $ type = 'original' , $ onlyUrl = false , $ modelSlug = null , $ relation = null ) { $ this -> setAttributes ( $ modelSlug , 'photo' ) ; $ photo = $ this -> getFile ( ) ; if ( ! is_null ( $ photo ) ) { $ src = $ this -> getFileSrc ( $ photo , $ relation , $ type ) ; } els... | get the html photo element |
227,876 | public function getDocument ( $ attributes = [ ] , $ onlyUrl = false , $ modelSlug = null , $ relation = null ) { $ this -> setAttributes ( $ modelSlug , 'file' ) ; $ file = $ this -> getFile ( ) ; if ( is_null ( $ file ) ) { return '' ; } $ src = $ this -> getFileDownloadSrc ( $ file , $ relation ) ; $ attr = $ this -... | get the html document element |
227,877 | private function setAttributes ( $ modelSlug , $ type ) { $ this -> module = getModule ( get_class ( $ this ) ) ; $ this -> modelSlug = is_null ( $ modelSlug ) ? getModelSlug ( $ this ) : $ modelSlug ; $ this -> options = config ( "{$this->module}.{$this->modelSlug}.uploads.{$type}" ) ; $ this -> column = $ this -> opt... | set the model specific attribute |
227,878 | private function getFileSrc ( $ file , $ relation , $ type = null ) { $ id = is_null ( $ relation ) ? $ this -> id : $ this -> $ relation ; $ src = $ this -> options [ 'path' ] . "/{$id}/" ; if ( is_null ( $ type ) ) { return $ src . $ file ; } $ src .= $ type === 'original' ? "original/{$file}" : "thumbnails/{$type}_{... | get the file src |
227,879 | private function getFileDownloadSrc ( $ file , $ relation ) { $ id = is_null ( $ relation ) ? $ this -> id : $ this -> $ relation ; return route ( 'download.document' , [ 'id' => $ id ] ) ; } | get the file download src |
227,880 | private function getHTMLAttributes ( $ attributes ) { $ attr = '' ; foreach ( $ attributes as $ key => $ value ) { $ attr .= $ key . '="' . $ value . '" ' ; } return $ attr ; } | get html attribute for file |
227,881 | public function scopeExtrasWithValues ( $ query , $ model ) { $ modelSlug = $ model ? getModelSlug ( $ model ) : false ; return $ query -> with ( [ 'extras' => function ( $ query ) use ( $ model , $ modelSlug ) { if ( ! $ model ) return $ query ; return $ query -> with ( [ "{$modelSlug}s" => function ( $ query ) use ( ... | get extra column datas with model values |
227,882 | public function setSlugAttribute ( $ slug ) { if ( ! $ slug ) { $ title = is_null ( $ this -> name ) ? $ this -> title : $ this -> name ; $ slug = str_slug ( $ title , '-' ) ; } $ this -> attributes [ 'slug' ] = $ slug ; } | Set slug encrypted |
227,883 | public function setIsActiveAttribute ( $ value ) { $ this -> attributes [ 'is_active' ] = $ value == 1 || $ value === 'true' || $ value === true ? true : false ; } | Set the is_active attribute . |
227,884 | public function setIsPublishAttribute ( $ is_publish ) { $ this -> attributes [ 'is_publish' ] = $ is_publish == 1 || $ is_publish === 'true' || $ is_publish === true ? true : false ; } | Set the is_publish attribute . |
227,885 | public function getCreatedAtAttribute ( $ date ) { $ module = getModule ( get_class ( ) ) ; return Carbon :: parse ( $ date ) -> format ( config ( "{$module}.date_format" ) ) ; } | Get the created_at attribute . |
227,886 | public function getAspectRatioAttribute ( ) { if ( $ this -> photo_width == 0 || $ this -> photo_height == 0 ) { return null ; } return $ this -> photo_width / $ this -> photo_height ; } | get the aspect ration with photo width and photo height |
227,887 | public function setModel ( Model $ model , $ capsule ) { $ this -> _model = $ model ; $ this -> _capsule = $ capsule ; return $ this ; } | Sets the model instance for the Pagination class . |
227,888 | public function paginate ( ) { $ count = count ( $ this -> _model -> all ( ) ) ; $ this -> _totalPages = ceil ( $ count / $ this -> _limit ) ; $ page_at_offset = floor ( $ this -> _page + 1 / $ this -> _limit ) ; $ this -> _offset = ( $ page_at_offset - 1 ) * $ this -> _limit ; $ this -> _results = $ this -> _model -> ... | Handles the pagination . |
227,889 | public function render ( $ path = 'basic' , $ views = null ) { $ view = new View ( ) ; if ( is_null ( $ views ) ) { $ views = __DIR__ . '/views/' ; } $ view -> createBlade ( $ views , $ this -> _config -> get ( 'cache' ) ) ; return $ view -> with ( 'pagination' , [ 'currentPage' => $ this -> _page , 'totalPages' => $ t... | Renders pagination links . |
227,890 | public function set ( $ key , $ value = null , $ group = '' ) { $ this -> checkLoaded ( ) ; $ this -> modified = true ; if ( is_array ( $ key ) ) { foreach ( $ key as $ k => $ v ) { SettingsUtilities :: set ( $ this -> storage , $ k , $ v ) ; } } else { SettingsUtilities :: set ( $ this -> storage , $ key , $ value ) ;... | Store an item in the configuration for a given number of minutes . |
227,891 | public function add ( Request $ request ) { $ this -> stack = array_slice ( $ this -> stack , 0 , $ this -> position + 1 ) ; $ this -> stack [ ] = clone $ request ; $ this -> position = count ( $ this -> stack ) - 1 ; } | Adds a Request to the history . |
227,892 | public function forward ( ) { if ( $ this -> position > count ( $ this -> stack ) - 2 ) { throw new \ LogicException ( 'You are already on the last page.' ) ; } return clone $ this -> stack [ ++ $ this -> position ] ; } | Goes forward in the history . |
227,893 | public function fetchAllEntities ( ) { $ select = $ this -> tableGateway -> getSql ( ) -> select ( ) ; return $ this -> tableGateway -> fetchCollection ( $ select ) ; } | Fetch all entities |
227,894 | public function fetchEntityById ( $ id ) { $ select = $ this -> tableGateway -> getSql ( ) -> select ( ) ; $ select -> where -> equalTo ( $ this -> tableGateway -> getPrimaryKey ( ) , $ id ) ; return $ this -> tableGateway -> fetchEntity ( $ select ) ; } | Fetch entity by id |
227,895 | public static function htmlArrayFlatten ( $ array_to_flatten , $ parents = array ( ) ) { $ flattened = array ( ) ; foreach ( $ array_to_flatten as $ key => $ value ) { if ( is_array ( $ value ) ) { $ parent_with_child = $ parents ; $ parent_with_child [ ] = $ key ; $ flattened = array_merge ( $ flattened , self :: html... | Returns an array that has been flattened suitable for use in html forms . |
227,896 | public static function arrayMultiMergeKeys ( ) { $ args = func_get_args ( ) ; $ result = array ( ) ; foreach ( $ args as $ array ) { foreach ( $ array as $ key => $ row ) { foreach ( $ row as $ name => $ value ) { $ result [ $ key ] [ $ name ] = $ value ; } } } return $ result ; } | Performs a recursive array_merge . Keys with the same value will be over - written with the later value |
227,897 | public static function arrayKeyAssoc ( $ array_map , $ value ) { if ( is_string ( $ value ) ) { if ( ( $ val = array_search ( $ value , $ array_map ) ) === false ) throw new Exception ( 'Value string undefined: ' . $ value ) ; return $ val ; } else if ( is_int ( $ value ) ) { if ( ! array_key_exists ( '' . $ value , $ ... | Returns the associated value from the array based on the type of value given |
227,898 | public static function arraySortUsingKeys ( $ arrayToSort , $ arrayKeysInOrder ) { $ result = array ( ) ; foreach ( $ arrayKeysInOrder as $ key ) if ( array_key_exists ( $ key , $ arrayToSort ) ) $ result [ ] = $ arrayToSort [ $ key ] ; return $ result ; } | Sorts an array using another array as a guide for key order |
227,899 | public static function getList ( ) { $ calledClass = get_called_class ( ) ; if ( ! isset ( static :: $ list [ $ calledClass ] ) ) { $ refClass = new \ ReflectionClass ( $ calledClass ) ; $ labels = static :: getLabels ( ) ; foreach ( $ refClass -> getConstants ( ) as $ constName => $ constValue ) { if ( isset ( $ label... | Get list constants |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.