idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
10,800 | public function addCookieObject ( Cookie $ cookie ) { $ name = $ cookie -> getName ( ) ; $ isNew = true ; foreach ( $ this -> cookies as $ index => $ value ) { if ( $ value -> getName ( ) === $ name ) { $ this -> cookies [ $ index ] = $ cookie ; $ isNew = false ; } } if ( $ isNew ) { $ index = array_search ( $ name , $... | Adds a Cookie object to the array of cookies for the object . |
10,801 | public function getCookieByName ( $ name ) { foreach ( $ this -> cookies as $ cookie ) { if ( $ cookie -> getName ( ) === $ name ) { return $ cookie ; } } return null ; } | Get the response cookie given its name . |
10,802 | public function clear ( $ name ) { if ( ! in_array ( $ name , $ this -> clearedCookies , true ) ) { $ this -> clearedCookies [ ] = $ name ; foreach ( $ this -> cookies as $ index => $ value ) { if ( $ value -> getName ( ) === $ name ) { unset ( $ this -> cookies [ $ index ] ) ; } } $ this -> cookies = array_values ( $ ... | Clear a cookie . |
10,803 | public function getByID ( $ id ) { $ id = ( int ) $ id ; return $ id > 0 ? $ this -> em -> find ( Geolocator :: class , $ id ) : null ; } | Get a geolocator library given its ID . |
10,804 | public function getByHandle ( $ handle ) { $ handle = ( string ) $ handle ; return $ handle === '' ? null : $ this -> repo -> findOneBy ( [ 'glHandle' => $ handle ] ) ; } | Get a geolocator library given its handle . |
10,805 | public function setCurrent ( Geolocator $ geolocator = null ) { $ currentGeolocator = $ this -> getCurrent ( ) ; if ( $ currentGeolocator !== $ geolocator ) { if ( $ currentGeolocator !== null ) { $ currentGeolocator -> setIsActive ( false ) ; if ( $ currentGeolocator -> getGeolocatorID ( ) !== null ) { $ this -> em ->... | Set the currently active geolocator library . |
10,806 | public function getList ( ) { $ result = $ this -> repo -> findAll ( ) ; $ comparer = new Comparer ( ) ; usort ( $ result , function ( Geolocator $ a , Geolocator $ b ) use ( $ comparer ) { return $ comparer -> compare ( $ a -> getGeolocatorDisplayName ( 'text' ) , $ b -> getGeolocatorDisplayName ( 'text' ) ) ; } ) ; r... | Get all the installed geolocator libraries . |
10,807 | protected function addDetails ( ) { $ this -> addDataTable ( 'Concrete5' , [ 'Version' => Config :: get ( 'concrete.version' ) , 'Installed Version' => Config :: get ( 'concrete.version_installed' ) , ] ) ; $ this -> addDataTable ( 'Concrete Configuration' , $ this -> flatConfig ( Config :: get ( 'concrete' ) , 'concre... | Add the c5 specific debug stuff . |
10,808 | private function get ( $ url ) { try { $ result = $ this -> fileHelper -> getContents ( $ url , $ this -> config -> get ( 'concrete.marektplace.request_timeout' ) ) ; } catch ( TimeoutException $ e ) { $ this -> connectionError = self :: E_CONNECTION_TIMEOUT ; return null ; } catch ( Exception $ e ) { $ this -> connect... | Get the contents of a URL |
10,809 | public static function checkPackageUpdates ( ) { $ em = \ ORM :: entityManager ( ) ; $ items = self :: getAvailableMarketplaceItems ( false ) ; foreach ( $ items as $ i ) { $ p = Package :: getByHandle ( $ i -> getHandle ( ) ) ; if ( is_object ( $ p ) ) { $ p -> setPackageAvailableVersion ( $ i -> getVersion ( ) ) ; $ ... | Runs through all packages on the marketplace sees if they re installed here and updates the available version number for them . |
10,810 | public function createFromPath ( $ path , $ open_mode = 'r+' ) { $ class = $ this -> writerClass ; return $ this -> prepare ( $ class :: createFromPath ( $ path , $ open_mode ) ) ; } | Create a CSV writer from a string . |
10,811 | public static function getByID ( $ fID ) { return $ fID ? Application :: getFacadeApplication ( ) -> make ( EntityManagerInterface :: class ) -> find ( FileEntity :: class , $ fID ) : null ; } | Return a file object for the given file ID . |
10,812 | public static function add ( File $ file , $ filename , $ prefix , $ data = [ ] ) { $ data += [ 'uID' => 0 , 'fvTitle' => '' , 'fvDescription' => '' , 'fvTags' => '' , 'fvIsApproved' => true , ] ; $ app = Application :: getFacadeApplication ( ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ dh = $ app -... | Add a new file version . You should call refreshAttributes in order to update the size extension type and other attributes . |
10,813 | public static function cleanTags ( $ tagsStr ) { $ tagsArray = explode ( "\n" , str_replace ( [ "\r" , ',' ] , "\n" , $ tagsStr ) ) ; $ cleanTags = [ ] ; foreach ( $ tagsArray as $ tag ) { $ tag = trim ( $ tag ) ; if ( $ tag !== '' ) { $ cleanTags [ ] = $ tag ; } } return isset ( $ cleanTags [ 0 ] ) ? "\n" . implode ( ... | Normalize the tags separator remove empty tags . |
10,814 | public function updateFile ( $ filename , $ prefix ) { $ this -> fvFilename = $ filename ; $ this -> fvPrefix = $ prefix ; $ this -> save ( ) ; $ this -> logVersionUpdate ( self :: UT_REPLACE_FILE ) ; } | Update the filename and the path prefix of the file . |
10,815 | public function deny ( ) { $ app = Application :: getFacadeApplication ( ) ; $ this -> fvIsApproved = false ; $ this -> save ( ) ; $ fve = new FileVersionEvent ( $ this ) ; $ app -> make ( EventDispatcherInterface :: class ) -> dispatch ( 'on_file_version_deny' , $ fve ) ; $ app -> make ( 'cache/request' ) -> delete ( ... | Mark this file version as not approved . |
10,816 | public function updateTitle ( $ title ) { $ app = Application :: getFacadeApplication ( ) ; $ this -> fvTitle = $ title ; $ this -> save ( ) ; $ this -> logVersionUpdate ( self :: UT_TITLE ) ; $ fve = new FileVersionEvent ( $ this ) ; $ app -> make ( EventDispatcherInterface :: class ) -> dispatch ( 'on_file_version_up... | Update the title of the file . |
10,817 | public function updateDescription ( $ descr ) { $ app = Application :: getFacadeApplication ( ) ; $ this -> fvDescription = $ descr ; $ this -> save ( ) ; $ this -> logVersionUpdate ( self :: UT_DESCRIPTION ) ; $ fve = new FileVersionEvent ( $ this ) ; $ app -> make ( EventDispatcherInterface :: class ) -> dispatch ( '... | Update the description of the file . |
10,818 | public function updateTags ( $ tags ) { $ app = Application :: getFacadeApplication ( ) ; $ tags = self :: cleanTags ( $ tags ) ; $ this -> fvTags = $ tags ; $ this -> save ( ) ; $ this -> logVersionUpdate ( self :: UT_TAGS ) ; $ fve = new FileVersionEvent ( $ this ) ; $ app -> make ( EventDispatcherInterface :: class ... | Update the tags associated to the file . |
10,819 | public function getMimeType ( ) { try { $ fre = $ this -> getFileResource ( ) ; $ result = $ fre -> getMimetype ( ) ; } catch ( FileNotFoundException $ x ) { $ result = false ; } return $ result ; } | Get the mime type of the file if known . |
10,820 | public function getTypeObject ( ) { $ app = Application :: getFacadeApplication ( ) ; $ fh = $ app -> make ( 'helper/file' ) ; $ ext = $ fh -> getExtension ( $ this -> fvFilename ) ; $ ftl = FileTypeList :: getType ( $ ext ) ; return $ ftl ; } | Get the type of the file . |
10,821 | public function logVersionUpdate ( $ updateTypeID , $ updateTypeAttributeID = 0 ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> executeQuery ( 'INSERT INTO FileVersionLog (fID, fvID, fvUpdateTypeID, fvUpdateTypeAttributeID) VALUES (?, ?, ?, ?)' , [ $ this -> ... | Log updates to files . |
10,822 | public function getVersionLogComments ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ updates = [ ] ; $ ga = $ db -> fetchAll ( 'SELECT fvUpdateTypeID, fvUpdateTypeAttributeID FROM FileVersionLog WHERE fID = ? AND fvID = ? ORDER BY fvlID ASC' , [ $ this -> getFil... | Get an array containing human - readable descriptions of everything that happened to this file version . |
10,823 | public function getDownloadURL ( ) { $ app = Application :: getFacadeApplication ( ) ; $ urlResolver = $ app -> make ( ResolverManagerInterface :: class ) ; $ c = Page :: getCurrentPage ( ) ; $ cID = $ c instanceof Page && ! $ c -> isError ( ) ? $ c -> getCollectionID ( ) : 0 ; return $ urlResolver -> resolve ( [ '/dow... | Get an URL that can be used to download the file . This passes through the download_file single page . |
10,824 | public function buildForceDownloadResponse ( ) { $ fre = $ this -> getFileResource ( ) ; $ fs = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) -> getFileSystemObject ( ) ; $ response = new FlysystemFileResponse ( $ fre -> getPath ( ) , $ fs ) ; $ response -> setContentDisposition ( ResponseHeaderBag :: DISPO... | Get a Response instance that will force the browser to download the file even if the browser can display it . |
10,825 | public function duplicateUnderlyingFile ( ) { $ app = Application :: getFacadeApplication ( ) ; $ importer = new Importer ( ) ; $ cf = $ app -> make ( 'helper/concrete/file' ) ; $ filesystem = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) -> getFileSystemObject ( ) ; $ fileName = $ this -> getFileName ( ) ;... | Duplicate the underlying file and assign its new position to this instance . |
10,826 | public function delete ( $ deleteFilesAndThumbnails = false ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ category = $ this -> getObjectAttributeCategory ( ) ; foreach ( $ this -> getAttributes ( ) as $ a... | Delete this version of the file . |
10,827 | public function updateContents ( $ contents , $ rescanThumbnails = true ) { $ this -> releaseImagineImage ( ) ; $ storage = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) ; if ( $ storage !== null ) { $ app = Application :: getFacadeApplication ( ) ; $ cf = $ app -> make ( 'helper/concrete/file' ) ; $ path =... | Update the contents of the file . |
10,828 | public function getFileContents ( ) { $ result = null ; $ fsl = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) ; if ( $ fsl !== null ) { $ app = Application :: getFacadeApplication ( ) ; $ cf = $ app -> make ( 'helper/concrete/file' ) ; try { $ result = $ fsl -> getFileSystemObject ( ) -> read ( $ cf -> pref... | Get the contents of the file . |
10,829 | public function refreshAttributes ( $ rescanThumbnails = true ) { $ app = Application :: getFacadeApplication ( ) ; $ storage = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) ; if ( $ storage !== null ) { $ fs = $ storage -> getFileSystemObject ( ) ; $ adapter = $ fs -> getAdapter ( ) ; if ( $ adapter instan... | Rescan all the attributes of this file version . This will run any type - based import routines and store those attributes generate thumbnails etc ... |
10,830 | public function getImagineImage ( ) { if ( null === $ this -> imagineImage ) { $ app = Application :: getFacadeApplication ( ) ; $ resource = $ this -> getFileResource ( ) ; $ mimetype = $ resource -> getMimeType ( ) ; $ imageLibrary = $ app -> make ( ImagineInterface :: class ) ; switch ( $ mimetype ) { case 'image/sv... | Get an \ Imagine \ Image \ ImageInterface representing the image . |
10,831 | public function releaseImagineImage ( ) { $ doGarbageCollection = $ this -> imagineImage ? true : false ; $ this -> imagineImage = null ; if ( $ doGarbageCollection ) { gc_collect_cycles ( ) ; } } | Unload the loaded Image instance . |
10,832 | public function importThumbnail ( ThumbnailTypeVersion $ version , $ path ) { $ app = Application :: getFacadeApplication ( ) ; $ config = $ app -> make ( 'config' ) ; $ thumbnailPath = $ version -> getFilePath ( $ this ) ; $ filesystem = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) -> getFileSystemObject ... | Import an existing file as a thumbnail type version . |
10,833 | public function getThumbnails ( ) { $ thumbnails = [ ] ; $ imageWidth = ( int ) $ this -> getAttribute ( 'width' ) ; $ imageHeight = ( int ) $ this -> getAttribute ( 'height' ) ; if ( $ imageWidth < 1 || $ imageHeight < 1 ) { throw new InvalidDimensionException ( $ this -> getFile ( ) , $ this , t ( 'Invalid dimensions... | Get the list of all the thumbnails . |
10,834 | public function deleteThumbnail ( $ type ) { $ app = Application :: getFacadeApplication ( ) ; $ config = $ app -> make ( 'config' ) ; if ( ! ( $ type instanceof ThumbnailTypeVersion ) ) { $ type = ThumbnailTypeVersion :: getByHandle ( $ type ) ; } $ fsl = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) -> ge... | Delete the thumbnail for a specific thumbnail type version . |
10,835 | public function updateThumbnailStorageLocation ( $ type , StorageLocation $ location ) { if ( ! ( $ type instanceof ThumbnailTypeVersion ) ) { $ type = ThumbnailTypeVersion :: getByHandle ( $ type ) ; } $ fsl = $ this -> getFile ( ) -> getFileStorageLocationObject ( ) -> getFileSystemObject ( ) ; $ path = $ type -> get... | Move the thumbnail of a specific thumbnail type version to a new storage location . |
10,836 | public function getJSONObject ( ) { $ app = Application :: getFacadeApplication ( ) ; $ urlResolver = $ app -> make ( ResolverManagerInterface :: class ) ; $ r = new stdClass ( ) ; $ fp = new Permissions ( $ this -> getFile ( ) ) ; $ r -> canCopyFile = $ fp -> canCopyFile ( ) ; $ r -> canEditFileProperties = $ fp -> ca... | Get a representation of this Version instance that s easily serializable . |
10,837 | protected function save ( $ flush = true ) { $ app = Application :: getFacadeApplication ( ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ em -> persist ( $ this ) ; if ( $ flush ) { $ em -> flush ( ) ; } } | Save the instance changes . |
10,838 | public function getPackageIconURL ( $ pkg ) { if ( $ pkg && file_exists ( $ pkg -> getPackagePath ( ) . '/' . FILENAME_BLOCK_ICON ) ) { return $ this -> getPackageURL ( $ pkg ) . '/' . FILENAME_BLOCK_ICON ; } else { return PACKAGE_GENERIC_ICON ; } } | Gets a full URL to an icon for a particular application . |
10,839 | public function getBlockTypeIconURL ( $ bt ) { $ url = $ this -> getBlockTypeAssetsURL ( $ bt , FILENAME_BLOCK_ICON ) ; if ( $ url != false ) { return $ url ; } else { return BLOCK_TYPE_GENERIC_ICON ; } } | Gets a full URL to an icon for a particular block type . |
10,840 | public function getBlockTypeAssetsURL ( $ bt , $ file = false ) { $ ff = '' ; if ( $ file != false ) { $ ff = '/' . $ file ; } $ url = '' ; $ packageHandle = null ; if ( file_exists ( DIR_FILES_BLOCK_TYPES . '/' . $ bt -> getBlockTypeHandle ( ) . $ ff ) ) { $ url = REL_DIR_APPLICATION . '/' . DIRNAME_BLOCKS . '/' . $ b... | Gets a full URL to the directory containing all of a block s items including JavaScript tools icons etc ... |
10,841 | protected function constructView ( $ mixed ) { if ( $ mixed instanceof Block ) { $ this -> blockType = $ mixed -> getBlockTypeObject ( ) ; $ this -> block = $ mixed ; $ this -> area = $ mixed -> getBlockAreaObject ( ) ; } else { $ this -> blockType = $ mixed ; if ( $ this -> blockType -> controller ) { $ this -> contro... | Construct a block view object |
10,842 | public function renderViewContents ( $ scopeItems ) { $ shouldRender = function ( ) { $ app = Application :: getFacadeApplication ( ) ; $ event = new BlockBeforeRender ( $ this -> block ) ; $ app -> make ( 'director' ) -> dispatch ( 'on_block_before_render' , $ event ) ; return $ event -> proceed ( ) ; } ; if ( ! $ sho... | Echo block contents |
10,843 | public function getBlockPath ( $ filename = null ) { $ obj = $ this -> blockType ; if ( file_exists ( DIR_FILES_BLOCK_TYPES . '/' . $ obj -> getBlockTypeHandle ( ) . '/' . $ filename ) ) { $ base = DIR_FILES_BLOCK_TYPES . '/' . $ obj -> getBlockTypeHandle ( ) ; } else { if ( $ obj -> getPackageID ( ) > 0 ) { if ( is_di... | Returns the path to the current block s directory . |
10,844 | public function getBlockURL ( $ filename = null ) { $ obj = $ this -> blockType ; if ( $ obj -> getPackageID ( ) > 0 ) { if ( is_dir ( DIR_PACKAGES_CORE . '/' . $ obj -> getPackageHandle ( ) ) ) { $ base = ASSETS_URL . '/' . DIRNAME_PACKAGES . '/' . $ obj -> getPackageHandle ( ) . '/' . DIRNAME_BLOCKS . '/' . $ obj -> ... | Returns a relative path to the current block s directory . If a filename is specified it will be appended and searched for as well . |
10,845 | private function fireOnBlockOutputEvent ( ) { $ event = new BlockOutput ( $ this -> block ) ; $ event -> setContents ( $ this -> outputContent ) ; $ app = Application :: getFacadeApplication ( ) ; $ app -> make ( 'director' ) -> dispatch ( 'on_block_output' , $ event ) ; $ this -> outputContent = $ event -> getContents... | Fire an event just before the block is outputted on the page |
10,846 | public function getChildFolderByName ( $ name , $ create = false ) { $ typeHandle = $ this -> getTreeNodeTypeHandle ( ) ; if ( $ this -> childNodesLoaded ) { $ childNodes = $ this -> childNodes ; } else { $ childNodesData = $ this -> getHierarchicalNodesOfType ( $ typeHandle , 1 , true , false , 1 ) ; $ childNodes = ar... | Get the first child folder this folder that has a specific name . |
10,847 | public function getChildFolderByPath ( array $ names , $ create = false ) { if ( count ( $ names ) === 0 ) { $ result = $ this ; } else { $ childName = array_shift ( $ names ) ; $ result = $ this -> getChildFolderByName ( $ childName , $ create ) ; if ( $ result !== null ) { $ result = $ result -> getChildFolderByPath ... | Get a descendent folder of this folder given its path . |
10,848 | public function asArray ( ) { $ error = $ this -> error ; if ( $ error -> has ( ) ) { $ o = [ 'error' => true , 'errors' => [ ] , 'htmlErrorIndexes' => [ ] , ] ; $ index = 0 ; foreach ( $ error -> getList ( ) as $ error ) { $ o [ 'errors' ] [ ] = ( string ) $ error ; if ( $ error instanceof HtmlAwareErrorInterface && $... | Build an array describing the errors . |
10,849 | public function getApiKey ( $ apiKeyIdentifier ) { return isset ( $ this -> apiKeys [ $ apiKeyIdentifier ] ) ? $ this -> apiKeys [ $ apiKeyIdentifier ] : null ; } | Gets API key |
10,850 | public function getApiKeyPrefix ( $ apiKeyIdentifier ) { return isset ( $ this -> apiKeyPrefixes [ $ apiKeyIdentifier ] ) ? $ this -> apiKeyPrefixes [ $ apiKeyIdentifier ] : null ; } | Gets API key prefix |
10,851 | public function addDefaultHeader ( $ headerName , $ headerValue ) { if ( ! is_string ( $ headerName ) ) { throw new \ InvalidArgumentException ( 'Header name must be a string.' ) ; } $ this -> defaultHeaders [ $ headerName ] = $ headerValue ; return $ this ; } | Adds a default header |
10,852 | public function setCurlTimeout ( $ seconds ) { if ( ! is_numeric ( $ seconds ) || $ seconds < 0 ) { throw new \ InvalidArgumentException ( 'Timeout value must be numeric and a non-negative number.' ) ; } $ this -> curlTimeout = $ seconds ; return $ this ; } | Sets the HTTP timeout value |
10,853 | public static function getV1BatchTokenFromHeaders ( $ http_headers ) { if ( is_array ( $ http_headers ) && isset ( $ http_headers [ 'Link' ] ) ) { $ connect_link_regexp = "/^<([^>]+)>;rel='next'$/" ; if ( preg_match ( $ connect_link_regexp , $ http_headers [ 'Link' ] , $ match ) === 1 ) { $ link_uri = $ match [ 1 ] ; i... | Return a batch_token if present on the Link header or null if no token is present |
10,854 | public function serializeCollection ( array $ collection , $ collectionFormat , $ allowCollectionFormatMulti = false ) { if ( $ allowCollectionFormatMulti && ( 'multi' === $ collectionFormat ) ) { return preg_replace ( '/%5B[0-9]+%5D=/' , '=' , http_build_query ( $ collection , '' , '&' ) ) ; } switch ( $ collectionFor... | Serialize an array to a string . |
10,855 | private static function handler ( $ uri ) { return function ( \ Exception $ e ) use ( $ uri ) { if ( $ e instanceof TimeoutException ) { throw new \ RuntimeException ( 'Connection to ' . $ uri . ' timed out after ' . $ e -> getTimeout ( ) . ' seconds' , \ defined ( 'SOCKET_ETIMEDOUT' ) ? \ SOCKET_ETIMEDOUT : 0 ) ; } th... | Creates a static rejection handler that reports a proper error message in case of a timeout . |
10,856 | protected function getValues ( array $ labels ) { if ( in_array ( strtolower ( $ this -> type ) , $ this -> specialDatasets ) ) { return Collection :: make ( $ this -> values ) -> map ( function ( $ value , $ key ) use ( $ labels ) { return [ 'name' => $ labels [ $ key ] , 'value' => $ value , ] ; } ) -> toArray ( ) ; ... | Get the formated values . |
10,857 | public function dataset ( string $ name , string $ type , $ data ) { if ( $ data instanceof Collection ) { $ data = $ data -> toArray ( ) ; } $ dataset = new $ this -> dataset ( $ name , $ type , $ data ) ; array_push ( $ this -> datasets , $ dataset ) ; return $ dataset ; } | Adds a new dataset to the chart . |
10,858 | public function labels ( $ labels ) { if ( $ labels instanceof Collection ) { $ labels = $ labels -> toArray ( ) ; } $ this -> labels = $ labels ; return $ this ; } | Set the chart labels . |
10,859 | public function options ( $ options , bool $ overwrite = false ) { if ( ! empty ( $ options [ 'plugins' ] ) ) { $ options [ 'plugins' ] = new Raw ( trim ( preg_replace ( '/\s\s+/' , ' ' , $ options [ 'plugins' ] ) ) ) ; } if ( $ options instanceof Collection ) { $ options = $ options -> toArray ( ) ; } if ( $ overwrite... | Set the chart options . |
10,860 | public function plugins ( $ plugins , bool $ overwrite = true ) { if ( $ plugins instanceof Collection ) { $ plugins = $ plugins -> toArray ( ) ; } if ( $ overwrite ) { $ this -> plugins = $ plugins ; } else { $ this -> plugins = array_replace_recursive ( $ this -> plugins , $ plugins ) ; } return $ this ; } | Set the plugins options . |
10,861 | public function container ( string $ container = null ) { if ( ! $ container ) { return View :: make ( $ this -> container , [ 'chart' => $ this ] ) ; } $ this -> container = $ container ; return $ this ; } | Set the chart container . |
10,862 | public function script ( string $ script = null ) { if ( count ( $ this -> datasets ) == 0 && ! $ this -> api_url ) { throw new \ Exception ( 'No datasets provided, please provide at least one dataset to generate a chart' ) ; } if ( ! $ script ) { return View :: make ( $ this -> script , [ 'chart' => $ this ] ) ; } $ t... | Set the chart script . |
10,863 | public function formatOptions ( bool $ strict = false , bool $ noBraces = false ) { if ( ! $ strict && count ( $ this -> options ) === 0 ) { return '' ; } $ options = Encoder :: encode ( $ this -> options ) ; return $ noBraces ? substr ( $ options , 1 , - 1 ) : $ options ; } | Formats the chart options . |
10,864 | public function formatPlugins ( bool $ strict = false , bool $ noBraces = false ) { if ( ! $ strict && count ( $ this -> plugins ) === 0 ) { return '' ; } $ plugins = str_replace ( '"' , '' , Encoder :: encode ( $ this -> plugins ) ) ; return $ noBraces ? substr ( $ plugins , 1 , - 1 ) : $ plugins ; } | Formats the plugins options . |
10,865 | public function formatDatasets ( ) { return Encoder :: encode ( Collection :: make ( $ this -> datasets ) -> each ( function ( $ dataset ) { $ dataset -> matchValues ( count ( $ this -> labels ) ) ; } ) -> map ( function ( $ dataset ) { return $ dataset -> format ( $ this -> labels ) ; } ) -> toArray ( ) ) ; } | Formats the datasets for the output . |
10,866 | public function setScriptAttribute ( string $ key , string $ value ) { $ this -> scriptAttributes [ $ key ] = $ value ; return $ this ; } | Sets an HTML attribute the the script tag of the chart . |
10,867 | public function formatContainerOptions ( string $ type = 'css' , bool $ maxIfNull = false ) { $ options = '' ; $ height = ( $ maxIfNull && ! $ this -> height ) ? '100%' : $ this -> height ; $ width = ( $ maxIfNull && ! $ this -> width ) ? '100%' : $ this -> width ; switch ( $ type ) { case 'css' : $ options .= " style=... | Formats the container options . |
10,868 | public function format ( array $ labels = [ ] ) { return array_merge ( $ this -> options , [ 'data' => $ this -> formatValues ( $ labels ) , 'seriesName' => $ this -> name , 'renderAs' => strtolower ( $ this -> type ) , ] ) ; } | Dataset representation . |
10,869 | protected function formatValues ( array $ labels ) { $ values = Collection :: make ( $ this -> values ) ; if ( in_array ( strtolower ( $ this -> type ) , $ this -> specialDatasets ) ) { $ colors = $ this -> getColors ( $ labels ) ; return $ values -> map ( function ( $ value , $ key ) use ( $ colors , $ labels ) { $ va... | Formats the chart values . |
10,870 | protected function getColors ( array $ labels ) { $ colors = Collection :: make ( array_key_exists ( 'color' , $ this -> options ) ? $ this -> options [ 'color' ] : [ ] ) ; while ( $ colors -> count ( ) < count ( $ labels ) ) { $ colors -> push ( $ this -> undefinedColor ) ; } return $ colors ; } | Get the chart colors . |
10,871 | public function export ( bool $ export , bool $ client = true ) { return $ this -> options ( [ 'exportenabled' => $ export , 'exportatclient' => $ client , ] ) ; } | Determines if the chart should show the export button . |
10,872 | public function values ( $ values ) { if ( $ values instanceof Collection ) { $ values = $ values -> toArray ( ) ; } $ this -> values = $ values ; return $ this ; } | Set the dataset values . |
10,873 | public function options ( $ options , bool $ overwrite = false ) { if ( $ overwrite ) { $ this -> options = $ options ; } else { $ this -> options = array_replace_recursive ( $ this -> options , $ options ) ; } return $ this ; } | Set the dataset options . |
10,874 | public function matchValues ( int $ values , bool $ strict = false ) { while ( count ( $ this -> values ) < $ values ) { array_push ( $ this -> values , 0 ) ; } if ( $ strict ) { $ this -> values = array_slice ( $ this -> values , 0 , $ values ) ; } } | Matches the values of the dataset with the given number . |
10,875 | public function minimalist ( bool $ minimalist = true ) { $ this -> displayAxes ( ! $ minimalist ) ; $ this -> displayLegend ( ! $ minimalist ) ; return $ this -> options ( [ 'xAxis' => [ 'axisLabel' => [ 'show' => ! $ minimalist , ] , 'splitLine' => [ 'show' => ! $ minimalist , ] , ] , 'yAxis' => [ 'axisLabel' => [ 's... | Show the minimalistic . |
10,876 | public function displayAxes ( bool $ display ) { return $ this -> options ( [ 'xAxis' => [ 'show' => $ display , 'axisLine' => [ 'show' => $ display , ] , 'axisTick' => [ 'show' => $ display , ] , ] , 'yAxis' => [ 'show' => $ display , 'axisLine' => [ 'show' => $ display , ] , 'axisTick' => [ 'show' => $ display , ] , ... | Display the chart axes . |
10,877 | public function export ( bool $ export = true , string $ title = ' ' ) { return $ this -> options ( [ 'toolbox' => [ 'show' => true , 'feature' => [ 'saveAsImage' => [ 'title' => $ title , ] , ] , ] , ] ) ; } | ALlow to export the chart . |
10,878 | public function formatDatasets ( ) { $ datasets = Collection :: make ( $ this -> datasets ) ; return json_encode ( [ 'columns' => Collection :: make ( $ this -> datasets ) -> each ( function ( $ dataset ) { $ dataset -> matchValues ( count ( $ this -> labels ) ) ; } ) -> map ( function ( $ dataset ) { return $ dataset ... | Formats the datasets . |
10,879 | public function displayAxes ( bool $ axes , bool $ strict = false ) { if ( $ strict ) { return $ this -> options ( [ 'scale' => [ 'display' => $ axes , ] , ] ) ; } return $ this -> options ( [ 'scales' => [ 'xAxes' => [ [ 'display' => $ axes , ] , ] , 'yAxes' => [ [ 'display' => $ axes , ] , ] , ] , ] ) ; } | Display the chart axis . |
10,880 | public function minimalist ( bool $ display = false ) { $ this -> displayLegend ( ! $ display ) ; return $ this -> displayAxes ( ! $ display ) ; } | Set the chart style to minimalist . |
10,881 | public function color ( $ color ) { if ( $ color instanceof Collection ) { $ color = $ color -> toArray ( ) ; } return $ this -> options ( [ 'color' => $ color , ] ) ; } | Set the dataset color . |
10,882 | public function formatOptions ( bool $ strict = false , bool $ noBraces = false ) { $ this -> options ( [ 'xAxis' => [ 'data' => json_decode ( $ this -> formatLabels ( ) ) , ] , ] ) ; return parent :: formatOptions ( $ strict , $ noBraces ) ; } | Formats the options . |
10,883 | public function formatOptions ( bool $ strict = false , bool $ noBraces = false ) { $ colors = [ ] ; $ default = 0 ; foreach ( $ this -> datasets as $ dataset ) { $ color = $ this -> default_colors [ $ default ] ; if ( array_key_exists ( 'color' , $ dataset -> options ) ) { $ color = $ dataset -> options [ 'color' ] ; ... | Format the datasets . |
10,884 | public function format ( ) { return array_merge ( $ this -> options , [ 'data' => $ this -> values , 'label' => $ this -> name , 'type' => $ this -> type , ] ) ; } | Formats the dataset for chartjs . |
10,885 | public function onPreFileDownload ( CPlugin \ PreFileDownloadEvent $ ev ) { if ( $ this -> disabled ) { return ; } $ scheme = parse_url ( $ ev -> getProcessedUrl ( ) , PHP_URL_SCHEME ) ; if ( ! in_array ( $ scheme , self :: $ supportedSchemes , true ) ) { return ; } $ rfs = $ ev -> getRemoteFilesystem ( ) ; $ curlrfs =... | Keep - Alived file downloader |
10,886 | public function onPostDependenciesSolving ( Installer \ InstallerEvent $ ev ) { if ( $ this -> disabled ) { return ; } $ prefetcher = new Prefetcher ; $ prefetcher -> fetchAllFromOperations ( $ this -> io , $ this -> config , $ ev -> getOperations ( ) ) ; } | pre - fetch parallel by curl_multi |
10,887 | public function extractContent ( $ content ) { $ regex = '~^(' . '---' . "){1}[\r\n|\n]*(.*?)[\r\n|\n]+(" . '---' . "){1}[\r\n|\n]*(.*)$~s" ; return preg_match ( $ regex , $ content , $ matches ) === 1 ? ltrim ( $ matches [ 4 ] ) : $ content ; } | Adapted from Mni \ FrontYAML . |
10,888 | private function dropVariants ( & $ Arr ) { if ( isset ( $ Arr [ 'GB18030' ] , $ Arr [ 'GB2312' ] ) ) { unset ( $ Arr [ 'GB2312' ] ) ; } if ( isset ( $ Arr [ 'UCS-2' ] ) && ( isset ( $ Arr [ 'UTF-16BE' ] ) || isset ( $ Arr [ 'UTF-16LE' ] ) ) ) { unset ( $ Arr [ 'UCS-2' ] ) ; } if ( isset ( $ Arr [ 'UCS-4' ] ) && ( isse... | Drop candidates belonging to encodings that are outdated subsets or variants of other encodings with valid candidates . |
10,889 | public function normalise ( $ String ) { $ this -> Last = '' ; $ this -> Len = strlen ( $ String ) ; $ Valid = [ ] ; set_error_handler ( function ( $ errno ) { return ; } ) ; foreach ( $ this -> supported ( ) as $ Encoding ) { if ( ! $ this -> checkConformity ( $ String , $ Encoding ) ) { continue ; } $ Attempt = iconv... | Attempts to normalise a string . |
10,890 | public function guard ( $ String ) { return ! function_exists ( 'iconv' ) || $ this -> checkConformity ( $ String , $ this -> NormaliseTo ) ? $ String : $ this -> normalise ( $ String ) ; } | Checks if the class requirements are met . If met then calls checkConformity . If the string is non - conformant then calls normalise . If the class requirements aren t met or if the string is already conformant return the original string immediately . |
10,891 | public function getEntry ( $ Entry ) { if ( $ this -> Using === 'APCu' ) { return $ this -> unserializeEntry ( apcu_fetch ( $ Entry ) ) ; } if ( $ this -> Using === 'Memcached' || $ this -> Using === 'Redis' ) { return $ this -> unserializeEntry ( $ this -> WorkingData -> get ( $ Entry ) ) ; } if ( $ this -> Using === ... | Get a cache entry . |
10,892 | public function setEntry ( $ Key , $ Value , $ TTL = 3600 ) { $ Value = $ this -> serializeEntry ( $ Value ) ; if ( $ this -> Using === 'APCu' ) { if ( apcu_store ( $ Key , $ Value , $ TTL ) ) { return $ this -> Modified = true ; } return false ; } if ( $ this -> Using === 'Memcached' ) { if ( $ TTL >= 2592000 ) { $ TT... | Set a cache entry . |
10,893 | public function deleteEntry ( $ Entry ) { if ( $ this -> Using === 'APCu' ) { if ( apcu_delete ( $ Entry ) ) { return $ this -> Modified = true ; } return false ; } if ( $ this -> Using === 'Memcached' || $ this -> Using === 'Redis' ) { if ( $ this -> WorkingData -> delete ( $ Entry ) ) { return $ this -> Modified = tr... | Delete a specific cache entry . |
10,894 | public function clearCache ( ) { if ( $ this -> Using === 'APCu' ) { return $ this -> Modified = apcu_clear_cache ( ) ; } if ( $ this -> Using === 'Memcached' ) { return ( $ this -> WorkingData -> flush ( ) && ( $ this -> Modified = true ) ) ; } if ( $ this -> Using === 'Redis' ) { return ( $ this -> WorkingData -> flu... | Clears the entire cache . |
10,895 | public function clearExpiredPDO ( ) { if ( $ this -> Using !== 'PDO' ) { return false ; } $ PDO = $ this -> WorkingData -> prepare ( self :: clearExpiredQuery ) ; if ( $ PDO !== false && $ PDO -> execute ( [ 'time' => time ( ) ] ) ) { return ( $ PDO -> rowCount ( ) > 0 ) ; } return false ; } | Clears expired entries stored via PDO . |
10,896 | public function unserializeEntry ( $ Entry ) { if ( ! $ Entry || ! is_string ( $ Entry ) || ! preg_match ( '~^a\:\d+\:\{.*\}$~' , $ Entry ) ) { return $ Entry ; } $ Arr = unserialize ( $ Entry ) ; if ( is_array ( $ Arr ) ) { $ this -> clearExpired ( $ Arr ) ; return $ Arr ; } return $ Entry ; } | Unserialize a returned cache entry if necessary . |
10,897 | public function generateMarkers ( $ Pattern ) { preg_match_all ( $ Pattern , $ this -> Input , $ this -> Markers , PREG_OFFSET_CAPTURE | PREG_SET_ORDER ) ; $ Start = 0 ; $ this -> Working = [ ] ; foreach ( $ this -> Markers as $ Marker ) { if ( ! is_array ( $ Marker [ 0 ] ) || ! isset ( $ Marker [ 0 ] [ 0 ] ) || is_arr... | Generate markers and working data . |
10,898 | public function iterateClosure ( $ Closure , $ Glue = false ) { if ( ! is_callable ( $ Closure ) || empty ( $ this -> Input ) ) { return ; } if ( ! $ Glue ) { foreach ( $ this -> Working as & $ Segment ) { $ Segment = $ Closure ( $ Segment ) ; } return ; } foreach ( $ this -> Markers as & $ Segment ) { if ( isset ( $ S... | Iterate over the working data using a given closure . |
10,899 | public function recompile ( ) { $ Output = '' ; $ Glue = 0 ; foreach ( $ this -> Working as $ Segment ) { $ Output .= $ Segment ; if ( isset ( $ this -> Markers [ $ Glue ] [ 0 ] [ 0 ] ) && ! is_array ( $ this -> Markers [ $ Glue ] [ 0 ] [ 0 ] ) ) { $ Output .= $ this -> Markers [ $ Glue ] [ 0 ] [ 0 ] ; $ Glue ++ ; } } ... | Recompile all data after all work has finished and return it . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.