idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
15,000
public function views ( ) { Artisan :: call ( 'view:clear' ) ; $ this -> log -> info ( sprintf ( "%s %s" , trans ( 'cms::utilities.views.success' ) , trans ( 'cms::utilities.field.executed_by' , [ 'name' => $ this -> getCurrentUserName ( ) ] ) ) ) ; return $ this -> notifySuccess ( trans ( 'cms::utilities.views.success' ) ) ; }
Clear views manually .
15,001
public function route ( $ task ) { if ( ! in_array ( $ task , [ 'cache' , 'clear' ] ) ) { $ this -> log -> info ( sprintf ( "%s %s" , trans ( 'cms::utilities.route.not_allowed' , [ 'task' => $ task ] ) , trans ( 'cms::utilities.field.executed_by' , [ 'name' => $ this -> getCurrentUserName ( ) ] ) ) ) ; return $ this -> notifyError ( $ message ) ; } $ message = $ task == 'cache' ? trans ( 'cms::utilities.route.cached' ) : trans ( 'cms::utilities.route.cleared' ) ; $ this -> log -> info ( sprintf ( "%s %s" , $ message , trans ( 'cms::utilities.field.executed_by' , [ 'name' => $ this -> getCurrentUserName ( ) ] ) ) ) ; try { Artisan :: call ( 'route:' . $ task ) ; } catch ( \ Exception $ e ) { return $ this -> notifyError ( $ e -> getMessage ( ) ) ; } return $ this -> notifySuccess ( $ message ) ; }
Clear routes manually .
15,002
public function logs ( Request $ request , DataTables $ dataTables ) { if ( $ request -> input ( 'l' ) ) { LaravelLogViewer :: setFile ( base64_decode ( $ request -> input ( 'l' ) ) ) ; } if ( $ request -> input ( 'dl' ) ) { return response ( ) -> download ( LaravelLogViewer :: pathToLogFile ( base64_decode ( $ request -> input ( 'dl' ) ) ) ) ; } elseif ( $ request -> has ( 'del' ) ) { File :: delete ( LaravelLogViewer :: pathToLogFile ( base64_decode ( $ request -> input ( 'del' ) ) ) ) ; return redirect ( ) -> to ( $ request -> url ( ) ) ; } $ logs = LaravelLogViewer :: all ( ) ; if ( $ request -> wantsJson ( ) ) { return $ dataTables -> collection ( collect ( $ logs ) ) -> editColumn ( 'stack' , '{!! nl2br($stack) !!}' ) -> editColumn ( 'level' , function ( $ log ) { $ content = html ( ) -> tag ( 'span' , '' , [ 'class' => "glyphicon glyphicon-{$log['level_img']}-sign" , ] ) ; $ content .= '&nbsp;' . $ log [ 'level' ] ; return html ( ) -> tag ( 'span' , $ content , [ 'class' => "text-{$log['level_class']}" ] ) ; } ) -> addColumn ( 'content' , function ( $ log ) { $ html = '' ; if ( $ log [ 'stack' ] ) { $ html = '<a class="pull-right expand btn btn-default btn-xs"><span class="glyphicon glyphicon-search"></span></a>' ; } $ html .= $ log [ 'text' ] ; if ( isset ( $ log [ 'in_file' ] ) ) { $ html .= '<br>' . $ log [ 'in_file' ] ; } return $ html ; } ) -> rawColumns ( [ 'content' ] ) -> toJson ( ) ; } return view ( 'administrator.utilities.log' , [ 'logs' => $ logs , 'files' => LaravelLogViewer :: getFiles ( true ) , 'current_file' => LaravelLogViewer :: getFileName ( ) , ] ) ; }
Log viewer .
15,003
public function generate ( $ input , $ output , array $ options = array ( ) , $ overwrite = false ) { $ this -> log ( sprintf ( 'Generate from file (%s) to file (%s)' , $ input , $ output ) ) ; return $ this -> getGenerator ( ) -> generate ( $ input , $ output , $ options , $ overwrite ) ; }
Generates the output media file from the specified input HTML file
15,004
public function generateFromHtml ( $ html , $ output , array $ options = array ( ) , $ overwrite = false ) { $ this -> log ( sprintf ( 'Generate output in file (%s) from html.' , $ output ) ) ; return $ this -> getGenerator ( ) -> generateFromHtml ( $ html , $ output , $ options , $ overwrite ) ; }
Generates the output media file from the given HTML
15,005
public function getOutput ( $ input , array $ options = array ( ) ) { $ this -> log ( sprintf ( 'Getting output from file (%s)' , $ input ) ) ; return $ this -> getGenerator ( ) -> getOutput ( $ input , $ options ) ; }
Returns the output of the media generated from the specified input HTML file
15,006
public function getOutputFromView ( $ view , array $ parameters = array ( ) , array $ options = array ( ) ) { $ this -> log ( sprintf ( 'Get converted output from view (%s).' , $ view ) ) ; $ html = $ this -> getTemplatingEngine ( ) -> render ( $ view , $ parameters ) ; return $ this -> getOutputFromHtml ( $ html , $ options ) ; }
Retrieve the output from a Symfony view . This uses the selected template engine and renders it trough that .
15,007
public function downloadFromView ( $ view , array $ parameters = array ( ) , array $ options = array ( ) ) { $ this -> log ( sprintf ( 'Download pdf from view (%s).' , $ view ) ) ; $ contentDisposition = 'attachment; filename="' . $ this -> getName ( ) . '"' ; return $ this -> generateResponse ( $ view , $ contentDisposition , $ parameters , $ options ) ; }
From a given view and parameters create the proper response so we can easily download the file .
15,008
private function generateResponse ( $ view , $ contentDisposition , $ parameters , $ options ) { return new Response ( $ this -> getOutputFromView ( $ view , $ parameters , $ options ) , 200 , array ( 'Content-Type' => 'application/pdf' , 'Content-Disposition' => $ contentDisposition , ) ) ; }
Create a Response object for the inputted data .
15,009
protected function bootCustomBladeDirectives ( ) { $ blade = $ this -> app [ 'blade.compiler' ] ; $ blade -> directive ( 'tooltip' , function ( $ expression ) { return "<?php echo app('Yajra\\CMS\\View\\Directives\\TooltipDirective')->handle({$expression}); ?>" ; } ) ; $ blade -> directive ( 'pageHeader' , function ( $ expression ) { return "<?php echo app('Yajra\\CMS\\View\\Directives\\PageHeaderDirective')->handle({$expression}); ?>" ; } ) ; $ blade -> directive ( 'error' , function ( $ expression ) { return "<?php echo app('Yajra\\CMS\\View\\Directives\\ErrorDirective')->handle({$expression}); ?>" ; } ) ; }
Boot custom blade directives .
15,010
protected function registerProviders ( ) { $ this -> app -> register ( ConfigurationServiceProvider :: class ) ; $ this -> app -> register ( RouteServiceProvider :: class ) ; $ this -> app -> register ( ViewComposerServiceProvider :: class ) ; $ this -> app -> register ( BaumServiceProvider :: class ) ; $ this -> app -> register ( RepositoryServiceProvider :: class ) ; $ this -> app -> register ( FormServiceProvider :: class ) ; $ this -> app -> register ( WidgetServiceProvider :: class ) ; $ this -> app -> register ( TaggingServiceProvider :: class ) ; }
Registered required administrator providers .
15,011
protected function registerBindings ( ) { $ this -> app -> singleton ( PageHeaderDirective :: class , PageHeaderDirective :: class ) ; $ this -> app -> singleton ( TooltipDirective :: class , TooltipDirective :: class ) ; $ this -> app -> singleton ( SearchEngine :: class , LocalSearch :: class ) ; }
Register IOC bindings .
15,012
public function create ( ) { $ role = new Role ; $ permissions = Permission :: all ( ) ; $ selectedPermissions = $ this -> request -> old ( 'permissions' , [ ] ) ; return view ( 'administrator.roles.create' , compact ( 'role' , 'permissions' , 'selectedPermissions' ) ) ; }
Show role form .
15,013
public function store ( ) { $ this -> validate ( $ this -> request , [ 'name' => 'required' , 'slug' => 'required|unique:roles,slug' , ] ) ; $ role = Role :: create ( $ this -> request -> all ( ) ) ; $ role -> syncPermissions ( $ this -> request -> get ( 'permissions' , [ ] ) ) ; flash ( ) -> success ( 'Role ' . $ role -> name . ' successfully created!' ) ; return redirect ( ) -> route ( 'administrator.roles.index' ) ; }
Store a newly created role .
15,014
public function update ( Role $ role ) { $ this -> validate ( $ this -> request , [ 'name' => 'required' , 'slug' => 'required|unique:roles,slug,' . $ role -> id , ] ) ; $ role -> name = $ this -> request -> get ( 'name' ) ; if ( ! $ role -> system ) { $ role -> slug = $ this -> request -> get ( 'slug' ) ; } $ role -> save ( ) ; $ role -> syncPermissions ( $ this -> request -> get ( 'permissions' , [ ] ) ) ; flash ( ) -> success ( 'Role ' . $ role -> name . ' successfully updated!' ) ; return redirect ( ) -> route ( 'administrator.roles.index' ) ; }
Update role permission .
15,015
public function destroy ( Role $ role ) { if ( ! $ role -> system ) { try { $ role -> delete ( ) ; return $ this -> notifySuccess ( 'Role successfully deleted!' ) ; } catch ( QueryException $ e ) { return $ this -> notifyError ( $ e -> getMessage ( ) ) ; } } return $ this -> notifyError ( 'Role is protected and cannot be deleted!' ) ; }
Remove selected role .
15,016
public function printPHPCSUsage ( ) { ob_start ( ) ; parent :: printPHPCSUsage ( ) ; $ help = ob_get_contents ( ) ; ob_end_clean ( ) ; echo $ this -> fixHelp ( $ help ) ; }
Prints out the usage information for PHPCS .
15,017
private function fixHelp ( $ help ) { $ help = $ this -> fixCLIName ( $ help ) ; $ help = $ this -> fixStandard ( $ help ) ; return $ help ; }
alter the PHP_CodeSniffer_CLI usage message to match FuelPHPCS
15,018
public function getThumbnailImage ( $ alias , $ options = [ ] ) { $ thumbnail = $ this -> getThumbnailModel ( ) ; if ( empty ( $ thumbnail ) ) { return '' ; } return $ thumbnail -> getThumbImage ( $ alias , $ options ) ; }
Html thumbnail image tag
15,019
private function getDeclaringClass ( \ Reflector $ reflector ) : ? \ ReflectionClass { if ( $ reflector instanceof \ ReflectionClass ) { return $ reflector ; } if ( $ reflector instanceof \ ReflectionProperty ) { return $ reflector -> getDeclaringClass ( ) ; } if ( $ reflector instanceof \ ReflectionMethod ) { return $ reflector -> getDeclaringClass ( ) ; } if ( $ reflector instanceof \ ReflectionParameter ) { return $ reflector -> getDeclaringClass ( ) ; } return null ; }
Returns the ReflectionClass of the given Reflector .
15,020
public function getUrl ( $ id , $ options = [ ] ) { $ cloudinary = $ this -> cloudinary ; return $ cloudinary :: cloudinary_url ( $ id , $ options ) ; }
Get the cloudinary URL .
15,021
public static function getAssertionIdentifier ( $ identifier = null ) { $ methodName = static :: $ suite -> getName ( ) ; static :: $ assertionsInTest [ $ methodName ] = isset ( static :: $ assertionsInTest [ $ methodName ] ) ? static :: $ assertionsInTest [ $ methodName ] : - 1 ; $ name = $ methodName . '-' . ++ static :: $ assertionsInTest [ $ methodName ] ; $ name = $ identifier ? $ name . ': ' . $ identifier : $ name ; return $ name ; }
Get an unique identifier for this particular assertion .
15,022
protected function generateMenu ( $ menuBuilder , $ menu ) { $ subMenu = $ this -> registerMenu ( $ menuBuilder , $ menu ) ; $ menu -> children -> each ( function ( Menu $ subItem ) use ( $ subMenu ) { $ subMenuChild = $ this -> registerMenu ( $ subMenu , $ subItem ) ; if ( count ( $ subItem -> children ) ) { $ this -> generateMenu ( $ subMenuChild , $ subItem ) ; } } ) ; }
Generate the menu .
15,023
public function convertToString ( $ html ) { $ externalJavaScript = $ this -> extractExternalJavaScript ( $ html ) ; return $ this -> replaceJavaScriptTags ( $ html , $ externalJavaScript ) ; }
Extract all the linked JS files and put them in the proper place on the given HTML string .
15,024
public function extractExternalJavaScript ( $ html ) { $ matches = array ( ) ; preg_match_all ( '!' . $ this -> getExternalJavaScriptRegex ( ) . '!isU' , $ html , $ matches ) ; $ links = $ this -> createJavaScriptPaths ( $ matches [ 'links' ] ) ; return array ( 'tags' => $ matches [ 0 ] , 'links' => $ links ) ; }
Given a HTML string find all the JS files that should be loaded .
15,025
private function createJavaScriptPaths ( array $ javascripts ) { $ files = array ( ) ; foreach ( $ javascripts as $ file ) { if ( ! $ this -> isExternalJavaScriptFile ( $ file ) ) { if ( false !== strpos ( $ file , '?' ) ) { $ file = strstr ( $ file , '?' , true ) ; } $ file = $ this -> getBasePath ( ) . $ file ; } $ files [ ] = $ file ; } return $ files ; }
Check if a JavaScript file is a local or externalJavaScript file or . If it is a local file prepend our basepath to the link so we can properly fetch the data to insert .
15,026
private function getJavaScriptContent ( $ path ) { if ( $ this -> isExternalJavaScriptFile ( $ path ) ) { $ fileData = $ this -> getRequestHandler ( ) -> getContent ( $ path ) ; } else { $ fileData = '' ; if ( file_exists ( $ path ) ) { $ fileData = file_get_contents ( $ path ) ; } } return "<script type=\"text/javascript\">\n" . $ fileData . "</script>" ; }
Fetch the content of a JavaScript file from a given path .
15,027
private function replaceJavaScriptTags ( $ html , array $ javaScriptFiles ) { foreach ( $ javaScriptFiles [ 'links' ] as $ key => $ file ) { if ( ! $ this -> isExternalJavaScriptFile ( $ file ) ) { $ html = str_replace ( $ javaScriptFiles [ 'tags' ] [ $ key ] , $ this -> getJavaScriptContent ( $ file ) , $ html ) ; } } return $ html ; }
Replace the JavaScript tags that do external requests with inline script blocks .
15,028
public static function key ( $ key ) { $ config = static :: where ( 'key' , $ key ) -> first ( ) ; return $ config -> value ?? config ( $ key , null ) ; }
Get value by key .
15,029
public function slugList ( ) { $ categories = explode ( '/' , $ this -> alias ( ) ) ; $ html = [ ] ; foreach ( $ categories as $ category ) { $ html [ ] = new HtmlString ( '<span class="label label-info">' . e ( Str :: title ( $ category ) ) . '</span>&nbsp;' ) ; } return new HtmlString ( implode ( '' , $ html ) ) ; }
Display nested categories of the article .
15,030
public function start ( ) { $ server = $ this -> createServerManager ( ) ; if ( $ server -> isRunning ( ) ) { $ serverOpts = $ server -> getServerSetting ( ) ; \ output ( ) -> writeln ( "<error>The server have been running!(PID: {$serverOpts['masterPid']})</error>" , true , true ) ; } else { $ serverOpts = $ server -> getServerSetting ( ) ; } $ this -> configServer ( $ server ) ; $ ws = $ server -> getWsSettings ( ) ; $ tcp = $ server -> getTcpSetting ( ) ; $ workerNum = $ server -> setting [ 'worker_num' ] ; $ wsHost = $ ws [ 'host' ] ; $ wsPort = $ ws [ 'port' ] ; $ wsMode = $ ws [ 'mode' ] ; $ wsType = $ ws [ 'type' ] ; $ httpStatus = $ ws [ 'enable_http' ] ? '<info>Enabled</info>' : '<warning>Disabled</warning>' ; $ tcpHost = $ tcp [ 'host' ] ; $ tcpPort = $ tcp [ 'port' ] ; $ tcpType = $ tcp [ 'type' ] ; $ tcpStatus = $ serverOpts [ 'tcpable' ] ? '<info>Enabled</info>' : '<warning>Disabled</warning>' ; $ lines = [ ' Server Information ' , '************************************************************************************' , "* WS | host: <note>$wsHost</note>, port: <note>$wsPort</note>, type: <note>$wsType</note>, worker: <note>$workerNum</note>, mode: <note>$wsMode</note> (http is $httpStatus)" , "* TCP | host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, type: <note>$tcpType</note>, worker: <note>$workerNum</note> ($tcpStatus)" , '************************************************************************************' , ] ; \ output ( ) -> writeln ( implode ( "\n" , $ lines ) ) ; $ server -> start ( ) ; }
Start the webSocket server
15,031
public function reload ( ) { $ server = $ this -> createServerManager ( ) ; if ( ! $ server -> isRunning ( ) ) { \ output ( ) -> writeln ( '<error>The server is not running! cannot reload</error>' , true , true ) ; } \ output ( ) -> writeln ( sprintf ( '<info>Server %s is reloading</info>' , input ( ) -> getScript ( ) ) ) ; $ reloadTask = input ( ) -> hasOpt ( 't' ) ; $ server -> reload ( $ reloadTask ) ; \ output ( ) -> writeln ( sprintf ( '<success>Server %s reload success</success>' , input ( ) -> getScript ( ) ) ) ; }
Reload worker processes for the running server
15,032
public function stop ( ) { $ server = $ this -> createServerManager ( ) ; if ( ! $ server -> isRunning ( ) ) { \ output ( ) -> writeln ( '<error>The server is not running! cannot stop</error>' , true , true ) ; } $ serverOpts = $ server -> getServerSetting ( ) ; $ pidFile = $ serverOpts [ 'pfile' ] ; \ output ( ) -> writeln ( sprintf ( '<info>Swoft %s is stopping ...</info>' , input ( ) -> getScript ( ) ) ) ; $ result = $ server -> stop ( ) ; if ( ! $ result ) { \ output ( ) -> writeln ( sprintf ( '<error>Swoft %s stop fail</error>' , input ( ) -> getScript ( ) ) , true , true ) ; } @ unlink ( $ pidFile ) ; \ output ( ) -> writeln ( sprintf ( '<success>Swoft %s stop success!</success>' , input ( ) -> getScript ( ) ) ) ; }
Stop the running server
15,033
public function restart ( ) { $ server = $ this -> createServerManager ( ) ; if ( $ server -> isRunning ( ) ) { $ this -> stop ( ) ; } $ server -> setDaemonize ( ) ; $ this -> start ( ) ; }
Restart the running server
15,034
public static function cutStr ( $ str , $ length = 100 , $ postfix = '...' ) { if ( strlen ( $ str ) < $ length ) return $ str ; $ temp = substr ( $ str , 0 , $ length ) ; return substr ( $ temp , 0 , strrpos ( $ temp , ' ' ) ) . $ postfix ; }
Truncates the string to a certain number of characters without breaking words .
15,035
public static function isJustInstalled ( ) { $ types = Type :: find ( ) -> all ( ) ; $ categories = Category :: find ( ) -> all ( ) ; return empty ( $ types ) || empty ( $ categories ) ? : false ; }
Check that blog just installed
15,036
public function getAvailableSetFiles ( ) { $ arrSets = array ( ) ; foreach ( $ GLOBALS [ 'TL_CONFIG' ] [ 'advancedClassesSets' ] as $ key => $ value ) { if ( ! strpos ( $ value , "system/" ) !== false ) { $ arrSets [ $ value ] = basename ( $ value ) . ' (custom)' ; continue ; } $ arrSets [ $ value ] = basename ( $ value ) ; } return $ arrSets ; }
Return all available sets
15,037
protected function authorizeResource ( $ resource ) { if ( $ this -> isEditing ( $ resource ) ) { return $ this -> user ( ) -> can ( $ resource . '.update' ) ; } return $ this -> user ( ) -> can ( $ resource . '.create' ) ; }
Check if user is authorized to perform the action .
15,038
public function setParametersAttribute ( $ parameters ) { if ( is_array ( $ parameters ) ) { $ this -> attributes [ 'parameters' ] = json_encode ( $ parameters ) ; } else { $ this -> attributes [ 'parameters' ] = $ parameters ; } }
Parameters attribute setter .
15,039
public function index ( Request $ request ) { $ currentPath = $ request -> get ( 'path' ) ; $ dir = storage_path ( 'app/public/' . $ currentPath ) ; $ imageFiles = $ this -> getImageFiles ( $ dir ) ; foreach ( Finder :: create ( ) -> in ( $ dir ) -> sortByType ( ) -> directories ( ) as $ file ) { $ imageFiles -> name ( $ file -> getBaseName ( ) ) ; } $ files = new Collection ; $ parts = explode ( '/' , $ currentPath ) ; array_pop ( $ parts ) ; if ( $ parts <> '' && $ currentPath <> '' ) { $ files -> push ( [ 'name' => '.. Up' , 'relPath' => implode ( '/' , $ parts ) , 'type' => 'dir' , 'url' => \ Storage :: url ( $ currentPath ) , ] ) ; } foreach ( $ imageFiles as $ file ) { $ path = str_replace ( storage_path ( 'app/public/' ) , '' , $ file -> getRealPath ( ) ) ; $ files -> push ( [ 'name' => $ file -> getFilename ( ) , 'relPath' => $ path , 'type' => $ file -> getType ( ) , 'url' => \ Storage :: url ( $ path ) , ] ) ; } return response ( ) -> json ( $ files -> groupBy ( 'type' ) ) ; }
Get files by directory path .
15,040
protected function getImageFiles ( $ path ) { $ finder = Finder :: create ( ) -> in ( $ path ) -> sortByType ( ) -> depth ( 0 ) ; foreach ( config ( 'media.images_ext' ) as $ file ) { $ finder -> name ( '*' . $ file ) ; } return $ finder ; }
Get image files by path .
15,041
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( 'postSaved' ) ; } if ( $ model -> type -> show_category ) { $ model -> setScenario ( 'required_category' ) ; } return $ this -> render ( 'update' , [ 'model' => $ model ] ) ; }
Updates an existing Post model . If update is successful the browser will be redirected to the view page .
15,042
protected function renderProperties ( OutputInterface $ output , Response $ response ) { $ table = new Table ( $ output ) ; $ table -> setHeaders ( [ 'Property' , 'Value' ] ) ; foreach ( $ response as $ property => $ value ) { if ( is_scalar ( $ value ) ) { $ table -> addRow ( [ $ property , $ value ] ) ; } } $ table -> render ( ) ; }
Render the general properties .
15,043
protected function renderDerivedResources ( OutputInterface $ output , array $ derivedResources ) { $ table = new Table ( $ output ) ; $ table -> setHeaders ( [ [ new TableCell ( 'Derived resources' , [ 'colspan' => 5 ] ) ] , [ 'ID' , 'Format' , 'Size' , 'Transformation' , 'URL' ] , ] ) ; foreach ( $ derivedResources as $ resource ) { $ table -> addRow ( [ $ resource [ 'id' ] , $ resource [ 'format' ] , $ this -> formatSize ( $ resource [ 'bytes' ] ) , $ resource [ 'transformation' ] , $ resource [ 'url' ] , ] ) ; } $ table -> render ( ) ; }
Render the derived resources .
15,044
private function formatSize ( $ bytes ) { $ unit = 1024 ; if ( $ bytes <= $ unit ) { return $ bytes . ' b' ; } $ exp = ( int ) ( log ( $ bytes ) / log ( $ unit ) ) ; $ pre = 'kMGTPE' ; $ pre = $ pre [ $ exp - 1 ] ; return sprintf ( '%.1f %sB' , $ bytes / pow ( $ unit , $ exp ) , $ pre ) ; }
Format the size of a file .
15,045
public function authenticated ( Request $ request , $ user ) { if ( $ user -> is_blocked || ! $ user -> is_activated ) { if ( $ user -> is_blocked ) { $ message = 'Your account is currently banned from accessing the site!' ; } else { $ message = 'Your account is not yet activated!' ; } $ this -> guard ( ) -> logout ( ) ; flash ( ) -> error ( $ message ) ; return redirect ( ) -> route ( 'administrator.login' ) -> withErrors ( $ message ) ; } return redirect ( ) -> intended ( $ this -> redirectPath ) ; }
Handle event when the user was authenticated .
15,046
public function filter ( array $ information ) { $ information = $ this -> filterBots ( $ information ) ; $ information = $ this -> filterBrowserNames ( $ information ) ; $ information = $ this -> filterBrowserVersions ( $ information ) ; $ information = $ this -> filterBrowserEngines ( $ information ) ; $ information = $ this -> filterOperatingSystems ( $ information ) ; $ information = $ this -> filterDevices ( $ information ) ; return $ information ; }
Filters the results to increase accuracy .
15,047
protected function filterBrowserNames ( array $ userAgent ) { if ( empty ( $ userAgent [ 'browser_name' ] ) && $ userAgent [ 'browser_engine' ] === 'trident' && strpos ( $ userAgent [ 'string' ] , 'rv:' ) ) { $ userAgent [ 'browser_name' ] = 'msie' ; $ userAgent [ 'browser_version' ] = preg_replace ( '|.+rv:([0-9]+(?:\.[0-9]+)+).+|' , '$1' , $ userAgent [ 'string' ] ) ; return $ userAgent ; } return $ userAgent ; }
Filters browser names to increase accuracy .
15,048
protected function filterBrowserVersions ( array $ userAgent ) { if ( in_array ( $ userAgent [ 'browser_name' ] , [ 'safari' , 'opera' ] ) && stripos ( $ userAgent [ 'string' ] , ' version/' ) ) { $ userAgent [ 'browser_version' ] = preg_replace ( '|.+ version/([0-9]+(?:\.[0-9]+)?).*|i' , '$1' , $ userAgent [ 'string' ] ) ; return $ userAgent ; } return $ userAgent ; }
Filters browser versions to increase accuracy .
15,049
public function destroy ( $ module ) { $ module = $ this -> modules -> find ( $ module ) ; $ module -> delete ( ) ; return $ this -> notifySuccess ( trans ( 'cms::module.destroy' , [ 'module' => ( string ) $ module ] ) ) ; }
Remove selected module .
15,050
public function toggle ( $ module ) { $ module = $ this -> modules -> findByAlias ( $ module ) ; if ( $ module -> disabled ( ) ) { $ module -> enable ( ) ; } else { $ module -> disable ( ) ; } $ message = 'cms::module.toggle.' . ( $ module -> enabled ( ) ? 'enable' : 'disable' ) ; return $ this -> notifySuccess ( trans ( $ message , [ 'module' => ( string ) $ module ] ) ) ; }
Toggle module active status .
15,051
public function updateBadges ( $ badges ) { if ( $ this -> owner -> SecurityAlerts ( ) -> exists ( ) ) { $ badges -> push ( ArrayData :: create ( [ 'Title' => _t ( __CLASS__ . '.BADGE_SECURITY' , 'RISK: Security' ) , 'Type' => 'warning security-alerts__toggler' , ] ) ) ; } }
updates the badges that render as part of the screen targeted summary for this Package
15,052
public function updateDataSchema ( & $ schema ) { $ keysToPass = [ 'Identifier' , 'ExternalLink' ] ; $ alerts = [ ] ; foreach ( $ this -> owner -> SecurityAlerts ( ) -> toNestedArray ( ) as $ alert ) { $ alerts [ ] = array_intersect_key ( $ alert , array_flip ( $ keysToPass ) ) ; } $ schema [ 'securityAlerts' ] = $ alerts ; }
Adds security alert notifications into the schema
15,053
public function sendToAll ( string $ data , int $ sender = 0 , int $ pageSize = 50 ) : int { $ startFd = 0 ; $ count = 0 ; $ fromUser = $ sender < 1 ? 'SYSTEM' : $ sender ; $ this -> log ( "(broadcast)The #{$fromUser} send a message to all users. Data: {$data}" ) ; while ( true ) { $ fdList = $ this -> server -> connection_list ( $ startFd , $ pageSize ) ; if ( $ fdList === false || ( $ num = \ count ( $ fdList ) ) === 0 ) { break ; } $ count += $ num ; $ startFd = \ end ( $ fdList ) ; foreach ( $ fdList as $ fd ) { $ info = $ this -> getClientInfo ( $ fd ) ; if ( isset ( $ info [ 'websocket_status' ] ) && $ info [ 'websocket_status' ] > 0 ) { $ this -> server -> push ( $ fd , $ data ) ; } } } return $ count ; }
send message to all connections
15,054
public function writeTo ( $ fd , string $ data ) : int { return $ this -> server -> send ( $ fd , $ data ) ? 0 : 1 ; }
response data to client by socket connection
15,055
public function getContent ( $ url ) { $ this -> getRequest ( ) -> setHost ( $ url ) ; $ this -> getClient ( ) -> send ( $ this -> getRequest ( ) , $ this -> getResponse ( ) ) ; return $ this -> getResponse ( ) -> getContent ( ) ; }
Retrieve the contents from a given url .
15,056
public function handshake ( Request $ request , Response $ response ) : array { try { $ path = $ request -> getUri ( ) -> getPath ( ) ; list ( $ className , ) = $ this -> getHandler ( $ path ) ; } catch ( \ Throwable $ e ) { if ( $ e instanceof WsRouteException ) { return [ HandlerInterface :: HANDSHAKE_FAIL , $ response -> withStatus ( 404 ) -> withAddedHeader ( 'Failure-Reason' , 'Route not found' ) ] ; } throw $ e ; } $ handler = \ bean ( $ className ) ; if ( ! \ method_exists ( $ handler , 'checkHandshake' ) ) { return [ HandlerInterface :: HANDSHAKE_OK , $ response -> withAddedHeader ( 'swoft-ws-handshake' , 'auto' ) ] ; } return $ handler -> checkHandshake ( $ request , $ response ) ; }
dispatch handshake request
15,057
public function message ( Server $ server , Frame $ frame ) { $ fd = $ frame -> fd ; try { if ( ! $ path = WebSocketContext :: getMeta ( 'path' , $ fd ) ) { throw new ContextLostException ( "The connection info has lost of the fd#$fd, on message" ) ; } $ className = $ this -> getHandler ( $ path ) [ 0 ] ; $ handler = \ bean ( $ className ) ; $ handler -> onMessage ( $ server , $ frame ) ; } catch ( \ Throwable $ e ) { if ( App :: hasBean ( 'eventManager' ) && \ bean ( 'eventManager' ) -> hasListenerQueue ( WsEvent :: ON_ERROR ) ) { App :: trigger ( WsEvent :: ON_ERROR , $ frame , $ e ) ; } else { App :: error ( $ e -> getMessage ( ) , [ 'fd' => $ fd , 'data' => $ frame -> data ] ) ; $ server -> close ( $ fd ) ; } } }
dispatch ws message
15,058
public function close ( Server $ server , int $ fd ) { try { if ( ! $ path = WebSocketContext :: getMeta ( 'path' , $ fd ) ) { throw new ContextLostException ( "The connection info has lost of the fd#$fd, on connection closed" ) ; } $ className = $ this -> getHandler ( $ path ) [ 0 ] ; $ handler = \ bean ( $ className ) ; if ( \ method_exists ( $ handler , 'onClose' ) ) { $ handler -> onClose ( $ server , $ fd ) ; } } catch ( \ Throwable $ e ) { App :: error ( $ e -> getMessage ( ) , [ 'fd' => $ fd ] ) ; } }
dispatch ws close
15,059
public function parse ( $ string , $ strict = true ) { $ information = $ this -> doParse ( $ string ) ; if ( $ strict ) { $ information = $ this -> definition -> filter ( $ information ) ; } return $ information ; }
Parses a user agent string .
15,060
public function parseFromGlobal ( $ strict = true ) { $ string = isset ( $ _SERVER [ 'HTTP_USER_AGENT' ] ) ? $ _SERVER [ 'HTTP_USER_AGENT' ] : null ; return $ this -> parse ( $ string , $ strict ) ; }
Parses the user agent string provided by the global .
15,061
protected function doParse ( $ string ) { $ userAgent = array ( 'string' => $ this -> cleanString ( $ string ) , 'browser_name' => null , 'browser_version' => null , 'browser_engine' => null , 'operating_system' => null , 'device' => 'Other' ) ; if ( empty ( $ userAgent [ 'string' ] ) ) { return $ userAgent ; } $ browsers = $ this -> definition -> getKnownBrowsers ( ) ; $ bots = $ this -> definition -> getKnownBots ( ) ; $ userAgents = $ browsers + $ bots ; foreach ( $ userAgents as $ name => $ regexes ) { if ( $ matches = $ this -> matchBrowser ( $ regexes , $ userAgent [ 'string' ] ) ) { if ( isset ( $ matches [ 3 ] ) ) { $ name = str_replace ( '*' , strtolower ( $ matches [ 2 ] ) , $ name ) ; } $ userAgent [ 'browser_name' ] = $ name ; $ userAgent [ 'browser_version' ] = end ( $ matches ) ; break ; } } $ engines = $ this -> definition -> getKnownEngines ( ) ; if ( $ result = $ this -> find ( $ engines , $ userAgent [ 'string' ] ) ) { $ userAgent [ 'browser_engine' ] = $ result ; } $ operatingSystems = $ this -> definition -> getKnownOperatingSystems ( ) ; if ( $ result = $ this -> find ( $ operatingSystems , $ userAgent [ 'string' ] ) ) { $ userAgent [ 'operating_system' ] = $ result ; } $ devices = $ this -> definition -> getKnownDevices ( ) ; if ( $ result = $ this -> find ( $ devices , $ userAgent [ 'string' ] , true ) ) { $ userAgent [ 'device' ] = $ result ; } return $ userAgent ; }
Extracts information from the user agent string .
15,062
protected function matchBrowser ( array $ regexes , $ string ) { $ pattern = '#(' . join ( '|' , $ regexes ) . ')[/ ]+([0-9]+(?:\.[0-9]+)?)#i' ; if ( preg_match ( $ pattern , $ string , $ matches ) ) { return $ matches ; } return false ; }
Matches the list of browser regexes against the given User Agent string .
15,063
private function removeByPrefix ( InputInterface $ input , OutputInterface $ output ) { $ prefix = $ input -> getOption ( 'prefix' ) ; $ output -> writeln ( sprintf ( '<comment>Removing all resources from <info>%s</info></comment>' , $ prefix ) ) ; $ api = $ this -> getCloudinaryApi ( ) ; $ response = $ api -> delete_resources_by_prefix ( $ prefix ) ; $ this -> outputApiResponse ( $ response , 'deleted' , $ output ) ; }
Remove resources by prefix .
15,064
private function removeResource ( InputInterface $ input , OutputInterface $ output ) { $ resource = $ input -> getOption ( 'resource' ) ; $ output -> writeln ( sprintf ( '<comment>Removing resource <info>%s</info></comment>' , $ resource ) ) ; $ api = $ this -> getCloudinaryApi ( ) ; $ response = $ api -> delete_resources ( $ resource ) ; $ this -> outputApiResponse ( $ response , 'deleted' , $ output ) ; }
Remove a resource .
15,065
private function outputApiResponse ( Response $ response , $ part , OutputInterface $ output ) { $ table = new Table ( $ output ) ; $ table -> setHeaders ( [ 'Resource' , 'Status' ] ) ; foreach ( $ response [ $ part ] as $ file => $ status ) { $ table -> addRow ( [ $ file , $ status ] ) ; } $ table -> render ( ) ; }
Output the API response .
15,066
public function publish ( Category $ category ) { $ category -> togglePublishedState ( ) ; $ category -> getDescendants ( ) -> each ( function ( Category $ cat ) use ( $ category ) { $ cat -> published = $ category -> published ; $ cat -> save ( ) ; } ) ; $ message = $ category -> published ? trans ( 'cms::categories.publish.success' ) : trans ( 'cms::categories.publish.error' ) ; return $ this -> notifySuccess ( $ message ) ; }
Button Response from DataTable request to publish status .
15,067
public function isActiveGuard ( Request $ request , $ guard ) { $ name = Auth :: guard ( $ guard ) -> getName ( ) ; return ( $ this -> sessionHas ( $ request , $ name ) && $ this -> sessionGet ( $ request , $ name ) === $ this -> getAuthIdentifier ( $ guard ) ) ; }
Check if a particular guard is active .
15,068
public function open ( $ id , $ label = null ) { return $ this -> webService -> post ( "SELECT FROM 'PUSH'.'DOCUMENT'" , array_filter ( [ "id" => $ id , "label" => $ label ] ) ) ; }
Abre um documento criado
15,069
public function changeInterval ( $ id , $ interval ) { return $ this -> webService -> post ( "UPDATE 'PUSH'.'PUSHINTERVAL'" , [ self :: PARAMETER_PUSH_ID => $ id , self :: PARAMETER_PUSH_INTERVAL => $ interval ] ) ; }
Muda o intervalo do PUSH
15,070
public function url ( ) { $ repository = app ( 'extensions' ) ; $ extension = $ repository -> findOrFail ( $ this -> entity -> extension_id ) ; $ class = $ extension -> param ( 'class' ) ; if ( class_exists ( $ class ) ) { $ entity = app ( $ class ) -> findOrNew ( $ this -> entity -> param ( 'id' ) ) ; if ( $ entity instanceof UrlGenerator ) { if ( ! $ entity -> exists ) { return '#' ; } return $ entity -> getUrl ( $ this -> entity -> param ( 'data' ) ) ; } } return url ( $ this -> entity -> url ) ; }
Generate menu url depending on type the menu .
15,071
public function linkTitle ( ) { return $ this -> entity -> param ( 'link_title' ) ? $ this -> entity -> param ( 'link_title' ) : $ this -> entity -> title ; }
Get menu link title .
15,072
public function store ( Request $ request ) { $ config = $ request -> input ( 'config' ) ; foreach ( array_dot ( $ request -> input ( 'data' ) ) as $ key => $ value ) { $ path = $ config . '.' . $ key ; $ this -> destroy ( $ path ) ; if ( is_array ( $ value ) ) { $ value = implode ( ',' , $ value ) ; } Configuration :: create ( [ 'key' => $ path , 'value' => $ value ] ) ; } return $ this -> notifySuccess ( trans ( 'cms::config.success' , [ 'config' => $ config ] ) ) ; }
Store submitted configurations .
15,073
public function show ( $ key ) { $ config = config ( $ key ) ?? [ ] ; if ( ! isset ( $ this -> limits [ $ key ] ) ) { return $ this -> filter ( $ config ) ; } return response ( ) -> json ( $ this -> filter ( array_only ( $ config , $ this -> limits [ $ key ] ) ) ) ; }
Show configuration by key .
15,074
protected function filter ( array $ array ) { $ config = collect ( array_dot ( $ array ) ) -> map ( function ( $ value , $ key ) { if ( str_contains ( $ key , $ this -> hidden ) ) { return '' ; } if ( in_array ( $ key , $ this -> boolean ) ) { return ( bool ) $ value ; } return $ value ; } ) ; $ array = [ ] ; foreach ( $ config as $ key => $ value ) { array_set ( $ array , $ key , $ value ) ; } return $ array ; }
Filter array response .
15,075
public function removeAvatar ( ) { $ profile = auth ( ) -> user ( ) ; $ profile -> avatar = '' ; $ profile -> save ( ) ; event ( new ProfileWasUpdated ( $ profile ) ) ; return redirect ( ) -> route ( 'administrator.profile.edit' ) ; }
Remove current user s avatar .
15,076
public function configureFromUserAgentString ( $ string , UserAgentStringParser $ parser = null ) { $ parser = $ parser ? : new UserAgentStringParser ( ) ; $ result = $ string !== null ? $ parser -> parse ( $ string ) : $ parser -> parseFromGlobal ( ) ; $ this -> setUserAgentString ( $ string ) ; $ this -> fromArray ( $ result ) ; }
Configures the user agent information from a user agent string .
15,077
public function toArray ( ) { return array ( 'browser_name' => $ this -> getBrowserName ( ) , 'browser_version' => $ this -> getBrowserVersion ( ) , 'browser_engine' => $ this -> getBrowserEngine ( ) , 'operating_system' => $ this -> getOperatingSystem ( ) , 'device' => $ this -> getDevice ( ) ) ; }
Converts the user agent information to an array .
15,078
private function fromArray ( array $ data ) { $ this -> browserName = $ data [ 'browser_name' ] ; $ this -> browserVersion = $ data [ 'browser_version' ] ; $ this -> browserEngine = $ data [ 'browser_engine' ] ; $ this -> operatingSystem = $ data [ 'operating_system' ] ; $ this -> device = $ data [ 'device' ] ; }
Configures the user agent information from an array .
15,079
protected function registerBundleDependencies ( ContainerBuilder $ container ) { if ( true === $ this -> booted ) { return ; } $ this -> bundles = $ container -> getParameter ( 'kernel.bundles' ) ; if ( $ this -> createBundles ( $ this -> getBundleDependencies ( ) ) ) { $ container -> setParameter ( 'kernel.bundles' , $ this -> bundles ) ; $ this -> initializeBundles ( $ container ) ; $ pass = new Compiler \ ExtensionLoadPass ( $ this -> instances ) ; $ container -> addCompilerPass ( $ pass ) ; } $ this -> booted = true ; }
Register the bundle dependencies .
15,080
protected function createBundles ( array $ dependencies ) { foreach ( $ dependencies as $ bundleClass ) { $ name = substr ( $ bundleClass , strrpos ( $ bundleClass , '\\' ) + 1 ) ; if ( false === isset ( $ this -> bundles [ $ name ] ) ) { $ bundle = new $ bundleClass ( ) ; $ this -> bundles [ $ name ] = $ bundleClass ; $ this -> instances [ $ name ] = $ bundle ; if ( $ bundle instanceof BundleDependencyInterface ) { $ this -> createBundles ( $ bundle -> getBundleDependencies ( ) ) ; } } } return count ( $ this -> instances ) > 0 ; }
Creating the instances of bundle dependencies .
15,081
public function extractFromFile ( $ filePath ) { if ( ! is_file ( $ filePath ) ) { throw new FileNotFoundException ( $ filePath ) ; } $ extension = pathinfo ( $ filePath , PATHINFO_EXTENSION ) ; $ this -> checkDirectory ( ) ; $ extractorAdapterNamespace = $ this -> getAdapterNamespaceGivenExtension ( $ extension ) ; $ extractorAdapter = $ this -> instanceExtractorAdapter ( $ extractorAdapterNamespace ) ; if ( ! $ extractorAdapter -> isAvailable ( ) ) { throw new AdapterNotAvailableException ( $ extractorAdapter -> getIdentifier ( ) ) ; } return $ extractorAdapter -> extract ( $ filePath ) ; }
Extract files from compressed file
15,082
protected function checkDirectory ( ) { $ directoryPath = $ this -> directory -> getDirectoryPath ( ) ; if ( ! is_dir ( $ directoryPath ) ) { mkdir ( $ directoryPath ) ; } return $ this ; }
Check directory existence and integrity
15,083
protected function getAdapterNamespaceGivenExtension ( $ fileExtension ) { $ adapterNamespace = '\Mmoreram\Extractor\Adapter\\' ; switch ( $ fileExtension ) { case 'zip' : $ adapterNamespace .= 'ZipExtractorAdapter' ; break ; case 'rar' : $ adapterNamespace .= 'RarExtractorAdapter' ; break ; case 'phar' : $ adapterNamespace .= 'PharExtractorAdapter' ; break ; case 'tar' : $ adapterNamespace .= 'TarExtractorAdapter' ; break ; case 'gz' : $ adapterNamespace .= 'TarGzExtractorAdapter' ; break ; case 'bz2' : $ adapterNamespace .= 'TarBz2ExtractorAdapter' ; break ; default : throw new ExtensionNotSupportedException ( $ fileExtension ) ; } return $ adapterNamespace ; }
Return a extractor adapter namespace given an extension
15,084
public static function widget ( $ name ) { $ builder = static :: query ( ) ; return $ builder -> where ( 'type' , 'widget' ) -> whereRaw ( 'LOWER(name) = ?' , [ Str :: lower ( $ name ) ] ) -> first ( ) ; }
Get a widget by name .
15,085
public function prettify ( $ json , $ flags = null , $ indent = "\t" , $ is_json = null ) { if ( ! isset ( $ is_json ) ) { $ is_json = $ this -> isJson ( $ json ) ; } if ( ! $ is_json ) { return $ this -> process ( json_encode ( $ json , $ flags ) , $ indent ) ; } return $ this -> process ( $ json , $ indent ) ; }
Checks if input is string if so straight runs process else it encodes the input as json then runs prettify .
15,086
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'title' => 'required|max:255' , 'type' => 'required|max:255|alpha|unique:navigation,type' , ] ) ; $ navigation = new Navigation ; $ navigation -> fill ( $ request -> all ( ) ) ; $ navigation -> published = $ request -> get ( 'published' , false ) ; $ navigation -> save ( ) ; flash ( ) -> success ( trans ( 'cms::navigation.store.success' ) ) ; return redirect ( ) -> route ( 'administrator.navigation.index' ) ; }
Store a newly created navigation .
15,087
public function html ( array $ options = [ ] , array $ namespaces = [ ] ) { $ this -> addNamespace ( 'og' , 'http://ogp.me/ns#' ) ; $ this -> addNamespace ( 'fb' , 'http://ogp.me/ns/fb#' ) ; if ( $ namespaces ) { foreach ( $ namespaces as $ ns => $ url ) { $ this -> addNamespace ( $ ns , $ url ) ; } } $ this -> setType ( $ this -> config ( 'type' ) ) ; $ this -> setUri ( $ this -> request -> here ) ; $ this -> setTitle ( $ this -> _View -> fetch ( 'title' ) ) ; if ( $ appId = $ this -> config ( 'app_id' ) ) { $ this -> setAppId ( $ appId ) ; } return $ this -> Html -> tag ( 'html' , null , $ this -> config ( 'namespaces' ) + $ options ) ; }
Generate HTML tag .
15,088
public function cedente ( $ nome , $ documento , Endereco $ endereco ) { $ this -> cedente = new Cedente ( $ nome , $ documento , $ endereco ) ; return $ this ; }
Define o cedente .
15,089
public function banco ( $ agencia , $ conta ) { $ reflection = new ReflectionClass ( $ this -> namespace . '\\' . $ this -> type ) ; $ this -> banco = $ reflection -> newInstanceArgs ( array ( $ agencia , $ conta ) ) ; return $ this ; }
Define o banco .
15,090
public function carteira ( $ carteira ) { $ reflection = new ReflectionClass ( $ this -> namespace . '\\Carteira\\Carteira' . $ carteira ) ; $ this -> carteira = $ reflection -> newInstanceArgs ( ) ; return $ this ; }
Define a carteira .
15,091
public function getPublished ( ) { return $ this -> getModel ( ) -> with ( [ 'menus' => function ( $ query ) { $ query -> limitDepth ( 1 ) -> orderBy ( 'order' , 'asc' ) ; } , 'menus.permissions' , 'menus.children' , ] ) -> published ( ) -> get ( ) ; }
Get all published navigation .
15,092
public static function isUnderscoreName ( $ string ) { if ( strpos ( $ string , ' ' ) !== false ) { return false ; } if ( $ string !== strtolower ( $ string ) ) { return false ; } $ validName = true ; $ nameBits = explode ( '_' , $ string ) ; foreach ( $ nameBits as $ bit ) { if ( $ bit === '' ) { continue ; } if ( $ bit { 0 } !== strtolower ( $ bit { 0 } ) ) { $ validName = false ; break ; } } return $ validName ; }
Returns true if the specified string is in the underscore caps format .
15,093
public function getByteCodeCache ( ) { if ( count ( $ this -> data ) === 0 ) { return $ this -> byteCodeCache ; } $ mapper = new ArrayMapper ( ) ; return $ mapper -> fromArray ( $ this -> data ) ; }
Provides information about the byte code cache .
15,094
protected function mapWebRoutes ( Router $ router ) { $ this -> mapArticleRoutes ( $ router ) ; $ this -> mapCategoryRoutes ( $ router ) ; $ this -> mapTagsRoutes ( $ router ) ; $ this -> mapAdministratorAuthenticationRoutes ( $ router ) ; $ this -> mapAdministratorRoutes ( $ router ) ; $ this -> mapFrontendRoutes ( $ router ) ; }
Define the web routes for the application . These routes all receive session state CSRF protection etc .
15,095
protected function mapAdministratorAuthenticationRoutes ( Router $ router ) { $ router -> group ( [ 'prefix' => admin_prefix ( ) , 'middleware' => 'web' ] , function ( ) use ( $ router ) { $ router -> get ( 'login' , AuthController :: class . '@showLoginForm' ) -> name ( 'administrator.login' ) ; $ router -> get ( 'logout' , AuthController :: class . '@logout' ) -> name ( 'administrator.logout' ) ; $ router -> post ( 'login' , AuthController :: class . '@login' ) -> name ( 'administrator.login' ) ; } ) ; }
Map administrator authentication routes .
15,096
public function getClassMethods ( \ ReflectionClass $ class ) : array { $ classes = $ this -> getClassHierarchy ( $ class ) ; $ methods = [ ] ; foreach ( $ classes as $ hClass ) { $ hClassName = $ hClass -> getName ( ) ; foreach ( $ hClass -> getMethods ( ) as $ method ) { if ( $ method -> isStatic ( ) ) { continue ; } if ( $ method -> getDeclaringClass ( ) -> getName ( ) !== $ hClassName ) { continue ; } $ methods [ ] = $ method ; } } return $ this -> filterReflectors ( $ methods ) ; }
Returns reflections of all the non - static methods that make up one object .
15,097
public function getClassProperties ( \ ReflectionClass $ class ) : array { $ classes = $ this -> getClassHierarchy ( $ class ) ; $ properties = [ ] ; foreach ( $ classes as $ hClass ) { $ hClassName = $ hClass -> getName ( ) ; foreach ( $ hClass -> getProperties ( ) as $ property ) { if ( $ property -> isStatic ( ) ) { continue ; } if ( $ property -> getDeclaringClass ( ) -> getName ( ) !== $ hClassName ) { continue ; } $ properties [ ] = $ property ; } } return $ this -> filterReflectors ( $ properties ) ; }
Returns reflections of all the non - static properties that make up one object .
15,098
private function filterReflectors ( array $ reflectors ) : array { $ filteredReflectors = [ ] ; foreach ( $ reflectors as $ index => $ reflector ) { if ( $ reflector -> isPrivate ( ) ) { $ filteredReflectors [ ] = $ reflector ; continue ; } foreach ( $ reflectors as $ index2 => $ reflector2 ) { if ( $ index2 <= $ index ) { continue ; } if ( $ reflector -> getName ( ) === $ reflector2 -> getName ( ) ) { continue 2 ; } } $ filteredReflectors [ ] = $ reflector ; } return $ filteredReflectors ; }
Filters a list of ReflectionProperty or ReflectionMethod objects .
15,099
public function getFunctionParameterTypes ( \ ReflectionFunctionAbstract $ function ) : array { return $ this -> cache ( __FUNCTION__ , $ function , static function ( ) use ( $ function ) { $ docComment = $ function -> getDocComment ( ) ; if ( $ docComment === false ) { return [ ] ; } preg_match_all ( '/@param\s+(\S+)\s+\$(\S+)/' , $ docComment , $ matches , PREG_SET_ORDER ) ; $ types = [ ] ; foreach ( $ matches as $ match ) { $ types [ $ match [ 2 ] ] = explode ( '|' , $ match [ 1 ] ) ; } return $ types ; } ) ; }
Returns an associative array of the types documented on a function .