idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
5,100
public function addStorageExceededFormError ( Form $ form , $ fileSize , Workspace $ workspace ) { $ filesize = $ this -> ut -> getRealFileSize ( $ fileSize ) ; $ maxSize = $ this -> ut -> getRealFileSize ( $ workspace -> getMaxStorageSize ( ) ) ; $ usedSize = $ this -> ut -> getRealFileSize ( $ this -> container -> ge...
Adds the storage exceeded error in a form .
5,101
public function getNodeScheduledForInsert ( Workspace $ workspace , $ name , $ parent = null ) { $ scheduledForInsert = $ this -> om -> getUnitOfWork ( ) -> getScheduledEntityInsertions ( ) ; $ res = null ; foreach ( $ scheduledForInsert as $ entity ) { if ( get_class ( $ entity ) === 'Claroline\CoreBundle\Entity\Resou...
Search a ResourceNode wich is persisted but not flushed yet
5,102
public function getDefaultUploadDestinations ( ) { $ user = $ this -> container -> get ( 'security.token_storage' ) -> getToken ( ) -> getUser ( ) ; if ( $ user == 'anon.' ) return array ( ) ; $ pws = $ user -> getPersonalWorkspace ( ) ; $ defaults = [ ] ; if ( $ pws ) { $ defaults = array_merge ( $ defaults , $ this -...
Returns the list of file upload destination choices
5,103
public function setName ( $ name ) { if ( strpos ( self :: PATH_SEPARATOR , $ name ) !== false ) { throw new \ InvalidArgumentException ( 'Invalid character "' . self :: PATH_SEPARATOR . '" in resource name.' ) ; } $ this -> name = $ name ; }
Sets the resource name .
5,104
private function checkAnswer ( $ secretKey , $ remoteip , $ response ) { if ( $ remoteip == null || $ remoteip == "" ) { throw new ValidatorException ( "vihuvac_recaptcha.validator.remote_ip" ) ; } if ( $ response == null || strlen ( $ response ) == 0 ) { return false ; } $ response = $ this -> httpGet ( self :: RECAPT...
Calls an HTTP POST function to verify if the user s guess was correct .
5,105
private function httpGet ( $ host , $ path , $ data ) { $ host = sprintf ( "%s%s?%s" , $ host , $ path , http_build_query ( $ data , null , "&" ) ) ; $ context = $ this -> getResourceContext ( ) ; return file_get_contents ( $ host , false , $ context ) ; }
Submits an HTTP POST to a reCAPTCHA server .
5,106
private function getResourceContext ( ) { if ( null === $ this -> httpProxy [ "host" ] || null === $ this -> httpProxy [ "port" ] ) { return null ; } $ options = array ( ) ; foreach ( array ( "http" , "https" ) as $ protocol ) { $ options [ $ protocol ] = array ( "method" => "GET" , "proxy" => sprintf ( "tcp://%s:%s" ,...
Resource context .
5,107
private function resize ( $ newWidth , $ newHeight , $ srcImg , $ filename ) { $ oldX = imagesx ( $ srcImg ) ; $ oldY = imagesy ( $ srcImg ) ; if ( $ oldX > $ oldY ) { $ thumbWidth = $ newWidth ; $ thumbHeight = $ oldY * ( $ newHeight / $ oldX ) ; } else { if ( $ oldX <= $ oldY ) { $ thumbWidth = $ oldX * ( $ newWidth ...
Create a copy of a resized image according to the parameters .
5,108
public function rename ( User $ user , $ username ) { $ userRole = $ this -> roleManager -> getUserRoleByUser ( $ user ) ; if ( $ userRole ) $ this -> roleManager -> renameUserRole ( $ userRole , $ user -> getUsername ( ) ) ; $ user -> setUsername ( $ username ) ; $ personalWorkspaceName = $ this -> translator -> trans...
Rename a user .
5,109
public function deleteUser ( User $ user ) { $ userRole = $ this -> roleManager -> getUserRoleByUser ( $ user ) ; $ user -> setMail ( 'mail#' . $ user -> getId ( ) ) ; $ user -> setFirstName ( 'firstname#' . $ user -> getId ( ) ) ; $ user -> setLastName ( 'lastname#' . $ user -> getId ( ) ) ; $ user -> setPlainPassword...
Removes a user .
5,110
public function convertUsersToArray ( array $ users ) { $ content = array ( ) ; $ i = 0 ; foreach ( $ users as $ user ) { $ content [ $ i ] [ 'id' ] = $ user -> getId ( ) ; $ content [ $ i ] [ 'username' ] = $ user -> getUsername ( ) ; $ content [ $ i ] [ 'lastname' ] = $ user -> getLastName ( ) ; $ content [ $ i ] [ '...
Serialize a user . Use JMS serializer from entities instead
5,111
public function logUser ( User $ user ) { $ this -> strictEventDispatcher -> dispatch ( 'log' , 'Log\LogUserLogin' , array ( $ user ) ) ; $ token = new UsernamePasswordToken ( $ user , null , 'main' , $ user -> getRoles ( ) ) ; $ this -> container -> get ( 'security.token_storage' ) -> setToken ( $ token ) ; }
Logs the current user
5,112
public function openPermsAction ( ResourceNode $ node ) { $ collection = new ResourceCollection ( array ( $ node ) ) ; $ this -> checkAccess ( 'ADMINISTRATE' , $ collection ) ; $ this -> rightsManager -> editPerms ( 1 , $ this -> roleManager -> getRoleByName ( 'ROLE_USER' ) , $ node , false ) ; $ this -> rightsManager ...
Use only when create a new resource
5,113
public function setUserLocale ( $ locale ) { $ locales = $ this -> getAvailableLocales ( ) ; $ this -> userManager -> setLocale ( $ this -> getCurrentUser ( ) , $ locale ) ; }
Set locale setting for current user if this locale is present in the platform
5,114
public function getUserLocale ( Request $ request ) { $ locales = $ this -> getAvailableLocales ( ) ; $ preferred = explode ( '_' , $ request -> getPreferredLanguage ( ) ) ; if ( $ request -> attributes -> get ( '_locale' ) ) { $ locale = $ request -> attributes -> get ( '_locale' ) ; } elseif ( ( $ user = $ this -> ge...
This method returns the user locale and store it in session if there is no user this method return default language or the browser language if it is present in translations .
5,115
public function workspaceParameters ( $ workspaceId ) { $ workspace = $ this -> workspaceManager -> getWorkspaceById ( $ workspaceId ) ; $ tools = $ this -> toolManager -> getToolByCriterias ( array ( 'isConfigurableInWorkspace' => true , 'isDisplayableInWorkspace' => true ) ) ; $ canOpenResRights = true ; if ( $ works...
Renders the workspace properties page .
5,116
public function desktopParameters ( ) { $ desktopTools = $ this -> toolManager -> getToolByCriterias ( array ( 'isConfigurableInDesktop' => true , 'isDisplayableInDesktop' => true ) ) ; $ tools = array ( ) ; foreach ( $ desktopTools as $ desktopTool ) { $ toolName = $ desktopTool -> getName ( ) ; if ( $ toolName !== 'h...
Displays the Info desktop tab .
5,117
protected function execute ( $ method , $ path , $ body = null , array $ customHeaders = [ ] ) { $ this -> lastHttpRequest = null ; $ this -> lastHttpResponse = null ; $ request = $ this -> buildRequest ( $ method , $ path , $ body , $ customHeaders ) ; $ this -> lastHttpRequest = $ request -> withHeader ( 'Authorizati...
Execute a call against the Heroku Platform API .
5,118
protected function buildRequest ( $ method , $ path , $ body = null , array $ customHeaders = [ ] ) { $ headers = [ ] ; if ( isset ( $ body ) ) { $ headers [ 'Content-Type' ] = 'application/json' ; $ body = json_encode ( $ body ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new JsonEncodingException ( 'JSON...
Build an API request .
5,119
protected function processResponse ( ResponseInterface $ httpResponse ) { $ apiResponse = json_decode ( $ httpResponse -> getBody ( ) -> getContents ( ) ) ; $ httpResponse -> getBody ( ) -> rewind ( ) ; if ( $ httpResponse -> getStatusCode ( ) >= 400 ) { throw new BadHttpStatusException ( sprintf ( 'Heroku API error: H...
Build the final return object from the raw HTTP response .
5,120
private function isOrganizationManager ( TokenInterface $ token , User $ user ) { $ adminOrganizations = $ token -> getUser ( ) -> getAdministratedOrganizations ( ) ; $ userOrganizations = $ user -> getOrganizations ( ) ; foreach ( $ adminOrganizations as $ adminOrganization ) { foreach ( $ userOrganizations as $ userO...
I should find a way to speed that up
5,121
public function load ( ObjectManager $ manager ) { $ roles = $ manager -> getRepository ( 'ClarolineCoreBundle:Role' ) -> findAllPlatformRoles ( ) ; $ items = array ( array ( 'core_resource_logger' , true , true , true ) , array ( 'simple_text' , true , true , true ) , array ( 'my_workspaces' , false , true , false ) ,...
Loads the core widgets .
5,122
public function getDrivers ( ) { $ drivers = array ( ) ; $ files = $ this -> finder -> files ( ) -> in ( $ this -> driverPath ) -> name ( $ this -> fileTypes ) ; foreach ( $ files as $ file ) { $ driver = str_replace ( '.yml' , '' , $ file -> getRelativePathname ( ) ) ; $ service = $ this -> getService ( $ driver ) ; i...
Get authentication drivers
5,123
public function getService ( $ driver ) { if ( $ driver = explode ( ':' , $ driver ) and isset ( $ driver [ 0 ] ) and $ driver = explode ( '.' , $ driver [ 0 ] ) and isset ( $ driver [ 1 ] ) ) { return $ this -> container -> get ( $ driver [ 0 ] . '.' . $ driver [ 1 ] . '_bundle.manager.' . $ driver [ 1 ] . '_manager' ...
Return authentication driver manager
5,124
public function getRoles ( ) { if ( count ( $ this -> rolesStringAsArray ) > 0 ) { return $ this -> rolesStringAsArray ; } $ roleNames = array ( ) ; foreach ( $ this -> getEntityRoles ( true ) as $ role ) { $ roleNames [ ] = $ role -> getName ( ) ; } return $ roleNames ; }
Returns the subject roles as an array of sting values
5,125
public function renderExternalAuthenticatonButtonAction ( ) { $ event = $ this -> dispatcher -> dispatch ( 'render_external_authentication_button' , 'RenderAuthenticationButton' ) ; $ eventContent = $ event -> getContent ( ) ; if ( ! empty ( $ eventContent ) ) { $ eventContent = '<div class="external_authentication"><h...
not routed ...
5,126
public function createAction ( ) { $ this -> assertIsGranted ( 'ROLE_WS_CREATOR' ) ; $ user = $ this -> tokenStorage -> getToken ( ) -> getUser ( ) ; $ form = $ this -> formFactory -> create ( FormFactory :: TYPE_WORKSPACE , array ( $ user ) ) ; $ form -> handleRequest ( $ this -> request ) ; $ ds = DIRECTORY_SEPARATOR...
Creates a workspace from a form sent by POST .
5,127
public function setPlaceHolders ( array $ files , & $ _data ) { $ formattedFiles = [ ] ; foreach ( $ files as $ key => $ file ) { $ ext = pathinfo ( $ file , PATHINFO_EXTENSION ) ; $ newFile = $ file ; if ( $ ext === 'txt' ) { $ text = $ this -> setPlaceHolder ( $ file , $ _data , $ formattedFiles ) ; $ newFile = sys_g...
For now we only look parse . txt . in the archive . It s way easier that way .
5,128
private function setPlaceHolder ( $ file , & $ _data , & $ _files ) { $ text = file_get_contents ( $ file ) ; $ baseUrl = $ this -> router -> getContext ( ) -> getBaseUrl ( ) ; $ regex = '#' . $ baseUrl . '/file/resource/media/([^\'"]+)#' ; preg_match_all ( $ regex , $ text , $ matches , PREG_SET_ORDER ) ; if ( count (...
If we find an resource id wich is a file and not in the export yet then we export is aswell . It s a link towards something else .
5,129
public function removeAllUsersFromGroup ( Group $ group ) { $ users = $ group -> getUsers ( ) ; foreach ( $ users as $ user ) { $ group -> removeUser ( $ user ) ; } $ this -> om -> persist ( $ group ) ; $ this -> om -> flush ( ) ; }
Removes all users from a group .
5,130
public function removeUsersFromGroup ( Group $ group , array $ users ) { foreach ( $ users as $ user ) { $ group -> removeUser ( $ user ) ; $ this -> eventDispatcher -> dispatch ( 'log' , 'Log\LogGroupRemoveUser' , array ( $ group , $ user ) ) ; } $ this -> om -> persist ( $ group ) ; $ this -> om -> flush ( ) ; }
Removes an array of user from a group .
5,131
public function convertGroupsToArray ( array $ groups ) { $ content = array ( ) ; $ i = 0 ; foreach ( $ groups as $ group ) { $ content [ $ i ] [ 'id' ] = $ group -> getId ( ) ; $ content [ $ i ] [ 'name' ] = $ group -> getName ( ) ; $ rolesString = '' ; $ roles = $ group -> getEntityRoles ( ) ; $ rolesCount = count ( ...
Serialize a group array .
5,132
public function validate ( array $ data , $ validateProperties = true ) { $ groupsImporter = $ this -> getImporterByName ( 'groups' ) ; $ rolesImporter = $ this -> getImporterByName ( 'roles' ) ; $ toolsImporter = $ this -> getImporterByName ( 'tools' ) ; $ importer = $ this -> getImporterByName ( 'workspace_properties...
Import a workspace
5,133
public function populateWorkspace ( Workspace $ workspace , Configuration $ configuration , Directory $ root , array $ entityRoles , $ isValidated = false , $ importRoles = true ) { $ this -> om -> startFlushSuite ( ) ; $ data = $ configuration -> getData ( ) ; $ data = $ this -> reorderData ( $ data ) ; $ this -> data...
Populates a workspace content with the content of an zip archive . In other words it ignores the many properties of the configuration object and use an existing workspace as base .
5,134
public function importRichText ( ) { $ this -> log ( 'Parsing rich texts...' ) ; $ data = $ this -> data ; $ this -> container -> get ( 'claroline.importer.rich_text_formatter' ) -> setData ( $ data ) ; $ this -> container -> get ( 'claroline.importer.rich_text_formatter' ) -> setWorkspace ( $ this -> workspace ) ; for...
refactor how workspace are created because this sucks
5,135
public function export ( Workspace $ workspace ) { foreach ( $ this -> listImporters as $ importer ) { $ importer -> setListImporters ( $ this -> listImporters ) ; } $ data = [ ] ; $ files = [ ] ; $ data [ 'roles' ] = $ this -> getImporterByName ( 'roles' ) -> export ( $ workspace , $ files , null ) ; $ data [ 'tools' ...
Full workspace export
5,136
private function setImporters ( Configuration $ configuration , array $ data ) { foreach ( $ this -> listImporters as $ importer ) { $ importer -> setRootPath ( $ configuration -> getExtractPath ( ) ) ; if ( $ owner = $ configuration -> getOwner ( ) ) { $ importer -> setOwner ( $ owner ) ; } else { $ importer -> setOwn...
Inject the rootPath
5,137
public function insert ( PluginBundle $ pluginBundle , array $ pluginConfiguration ) { $ pluginEntity = new Plugin ( ) ; $ pluginEntity -> setVendorName ( $ pluginBundle -> getVendorName ( ) ) ; $ pluginEntity -> setBundleName ( $ pluginBundle -> getBundleName ( ) ) ; $ pluginEntity -> setHasOptions ( $ pluginConfigura...
Persists a plugin in the database .
5,138
private function addMissingRights ( array $ permissions , $ target ) { $ expectedKeys = $ target === 'resource' ? $ this -> expectedKeysForResource : $ this -> expectedKeysForWorkspace ; foreach ( $ expectedKeys as $ expected ) { if ( ! isset ( $ permissions [ $ expected ] ) ) { $ permissions [ $ expected ] = false ; }...
Adds the missing permissions to an array of permissions setting missing ones to false .
5,139
public function findAdminChildrenFromTags ( array $ tags ) { if ( count ( $ tags ) === 0 ) { throw new \ InvalidArgumentException ( 'Array argument cannot be empty' ) ; } $ index = 0 ; $ eol = PHP_EOL ; $ tagsTest = '(' ; foreach ( $ tags as $ tag ) { $ tagsTest .= $ index > 0 ? ' OR ' : ' ' ; $ tagsTest .= "p.id...
Find all admin tags that are children of given tags id Given admin tags are included
5,140
public function findChildrenFromTags ( User $ user , array $ tags ) { if ( count ( $ tags ) === 0 ) { throw new \ InvalidArgumentException ( 'Array argument cannot be empty' ) ; } $ index = 0 ; $ eol = PHP_EOL ; $ tagsTest = '(' ; foreach ( $ tags as $ tag ) { $ tagsTest .= $ index > 0 ? ' OR ' : ' ' ; $ tagsTest...
Find all tags that are children of given tags id Given tags are included
5,141
public function getPaginatedData ( $ tableName , $ page = 1 , $ limit = 10 , $ orderAttribute = null , $ order = 'ASC' ) { Paginator :: currentPageResolver ( function ( ) use ( $ page ) { return $ page ; } ) ; $ data = $ this -> database -> table ( $ tableName ) ; if ( null === $ orderAttribute ) { return $ data -> pag...
Fetch data form table using pagination
5,142
public function logException ( $ exception ) { $ category = get_class ( $ exception ) ; if ( $ exception instanceof HttpException ) { $ category = 'yii\\web\\HttpException:' . $ exception -> statusCode ; } elseif ( $ exception instanceof \ ErrorException ) { $ category .= ':' . $ exception -> getSeverity ( ) ; } if ( $...
Logs the given exception
5,143
function & _getInlineTags ( $ text ) { $ return = NULL ; $ tagStrings = preg_split ( '/{(@.+)}/sU' , $ text , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; if ( $ tagStrings ) { $ inlineTags = NULL ; $ phpdoctor = & $ this -> _root -> phpdoctor ( ) ; foreach ( $ tagStrings as $ tag ) { if ( substr ( $ tag , 0 , 1 ) == '@' ) { $ p...
Parse out inline tags from within a text string
5,144
private function makeTableBody ( $ headers , $ rows ) { $ body = [ ] ; $ tableCellWidth = ( $ this -> option ( 'w' ) ) ? $ this -> option ( 'w' ) : 10 ; for ( $ i = 0 ; $ i < count ( $ rows ) ; $ i ++ ) { $ row = [ ] ; for ( $ j = 0 ; $ j < count ( $ headers ) ; $ j ++ ) { $ column = $ headers [ $ j ] ; $ row [ $ j ] =...
Make formatted body for table
5,145
public function execute ( $ params ) { $ this -> method = array_shift ( $ params ) ; $ this -> prepare ( $ params ) ; return $ this -> httpClient -> setMethod ( 'post' ) -> setEndPoint ( static :: ENDPOINT . $ this -> method . '/' ) -> authHeaders ( ) -> addHeader ( [ 'Content-Type' => 'application/json' ] ) -> setPara...
Invoke the HTTP client to Execute the API request
5,146
public function packageIndexWriter ( & $ doclet ) { parent :: htmlWriter ( $ doclet ) ; $ phpdoctor = & $ this -> _doclet -> phpdoctor ( ) ; $ this -> _sections [ 0 ] = array ( 'title' => 'Overview' , 'selected' => TRUE ) ; $ this -> _sections [ 1 ] = array ( 'title' => 'Namespace' ) ; $ this -> _sections [ 2 ] = array...
Build the package index .
5,147
public function getChannel ( $ channel_id = null ) { $ index = $ channel_id ? : 'default' ; if ( ! array_key_exists ( $ index , $ this -> channels ) ) { $ this -> channels [ $ index ] = $ this -> connection -> channel ( $ channel_id ) ; } return $ this -> channels [ $ index ] ; }
Returns AMQP connection .
5,148
public function listen ( $ exchange , $ routing_key , $ callback , $ type = self :: TYPE_TOPIC ) { list ( $ queueName ) = $ this -> channel -> queue_declare ( ) ; if ( $ type == Amqp :: TYPE_DIRECT ) { $ this -> channel -> exchange_declare ( $ exchange , $ type , false , true , false ) ; } $ this -> channel -> queue_bi...
Listens the exchange for messages .
5,149
public function prepareMessage ( $ message , $ properties = null ) { if ( empty ( $ message ) ) { throw new Exception ( 'AMQP message can not be empty' ) ; } if ( is_array ( $ message ) || is_object ( $ message ) ) { $ message = Json :: encode ( $ message ) ; } return new AMQPMessage ( $ message , $ properties ) ; }
Returns prepaired AMQP message .
5,150
public function editRolePermissions ( $ id ) { if ( Shinobi :: can ( config ( 'watchtower.acl.role.permissions' , false ) ) ) { $ role = Role :: findOrFail ( $ id ) ; $ permissions = $ role -> permissions ; $ available_permissions = Permission :: whereDoesntHave ( 'roles' , function ( $ query ) use ( $ id ) { $ query -...
Show the form for editing the role permissions .
5,151
public function updateRolePermissions ( $ id , Request $ request ) { $ level = "danger" ; $ message = " You are not permitted to update role permissions." ; if ( Shinobi :: can ( config ( 'watchtower.acl.role.permissions' , false ) ) ) { $ role = Role :: findOrFail ( $ id ) ; if ( $ request -> has ( 'slug' ) ) { $ role...
Sync roles and permissions .
5,152
public function editRoleUsers ( $ id ) { if ( Shinobi :: can ( config ( 'watchtower.acl.role.users' , false ) ) ) { $ role = Role :: findOrFail ( $ id ) ; $ users = $ role -> users ; $ available_users = User :: whereDoesntHave ( 'roles' , function ( $ query ) use ( $ id ) { $ query -> where ( 'role_id' , $ id ) ; } ) -...
Show the form for editing the role users .
5,153
public function showRoleMatrix ( ) { if ( Shinobi :: can ( config ( 'watchtower.acl.role.viewmatrix' , false ) ) ) { $ roles = Role :: all ( ) ; $ perms = Permission :: all ( ) ; $ prs = DB :: table ( 'permission_role' ) -> select ( 'role_id as r_id' , 'permission_id as p_id' ) -> get ( ) ; $ pivot = [ ] ; foreach ( $ ...
A full matrix of roles and permissions .
5,154
public function paramTags ( ) { if ( isset ( $ this -> _tags [ '@param' ] ) ) { if ( is_array ( $ this -> _tags [ '@param' ] ) ) { return $ this -> _tags [ '@param' ] ; } else { return array ( $ this -> _tags [ '@param' ] ) ; } } else { return NULL ; } }
Return the param tags in this function .
5,155
public function throwsTags ( ) { if ( isset ( $ this -> _tags [ '@throws' ] ) ) { if ( is_array ( $ this -> _tags [ '@throws' ] ) ) { return $ this -> _tags [ '@throws' ] ; } else { return array ( $ this -> _tags [ '@throws' ] ) ; } } else { return NULL ; } }
Return the throws tags in this function .
5,156
public function signature ( ) { $ signature = '(' ; $ myPackage = & $ this -> containingPackage ( ) ; foreach ( $ this -> _parameters as $ param ) { $ type = $ param -> type ( ) ; $ classDoc = & $ type -> asClassDoc ( ) ; if ( $ classDoc ) { $ packageDoc = & $ classDoc -> containingPackage ( ) ; $ signature .= '<a href...
Get the signature . It is the parameter list type is qualified .
5,157
public function authHeaders ( array $ headers = [ ] ) { if ( count ( $ headers ) == 0 ) { $ headers = [ 'X-Application' => Auth :: $ appKey , 'X-Authentication' => Auth :: $ sessionToken ] ; } $ this -> options [ 'headers' ] = array_merge ( $ this -> options [ 'headers' ] , $ headers ) ; return $ this ; }
Setter for authentication headers .
5,158
public function setParams ( $ params ) { if ( ! empty ( $ params ) ) { foreach ( $ params as $ key => $ value ) { $ this -> options [ 'json' ] [ $ key ] = $ value ; } } return $ this ; }
Setter for params .
5,159
public function send ( ) { try { $ response = $ this -> guzzleClient -> request ( $ this -> method , $ this -> uri , $ this -> options ) ; } catch ( ClientException $ e ) { $ this -> handleApiException ( $ e -> getResponse ( ) -> getBody ( ) -> getContents ( ) ) ; } return $ this -> getBody ( $ response ) ; }
Dispatch the request and provide hooks for error handling for the response .
5,160
public function qualifiedName ( ) { $ parent = & $ this -> containingClass ( ) ; if ( $ parent && $ parent -> name ( ) != '' && $ this -> _package != $ parent -> name ( ) ) { return $ this -> _package . '\\' . $ parent -> name ( ) . '\\' . $ this -> _name ; } else { return $ this -> _package . '\\' . $ this -> _name ; ...
Get the fully qualified name .
5,161
public function modifiers ( $ showPublic = TRUE ) { $ modifiers = '' ; if ( $ showPublic || $ this -> _access != 'public' ) { $ modifiers .= $ this -> _access . ' ' ; } if ( $ this -> _final ) { $ modifiers .= 'final ' ; } if ( isset ( $ this -> _abstract ) && $ this -> _abstract ) { $ modifiers .= 'abstract ' ; } if (...
Get modifiers string .
5,162
public function asPath ( ) { if ( $ this -> isClass ( ) || $ this -> isInterface ( ) || $ this -> isTrait ( ) || $ this -> isException ( ) ) { return strtolower ( str_replace ( '.' , '/' , str_replace ( '\\' , '/' , $ this -> _package ) ) . '/' . $ this -> _name . '.html' ) ; } elseif ( $ this -> isField ( ) ) { $ clas...
Return the element path .
5,163
function & _allItems ( & $ rootDoc ) { ob_start ( ) ; echo '<body id="frame">' , "\n\n" ; echo "<h1>All Items</h1>\n\n" ; $ classes = & $ rootDoc -> classes ( ) ; if ( $ classes ) { ksort ( $ classes ) ; echo "<h2>Classes</h2>\n" ; echo "<ul>\n" ; foreach ( $ classes as $ name => $ class ) { $ package = & $ classes [ $...
Build all items frame
5,164
public function depth ( ) { $ depth = substr_count ( $ this -> _name , '.' ) ; $ depth += substr_count ( $ this -> _name , '\\' ) ; $ depth += substr_count ( $ this -> _name , '/' ) ; return $ depth ; }
Calculate the depth of this package from the root .
5,165
public function addClass ( & $ class ) { if ( isset ( $ this -> _classes [ $ class -> name ( ) ] ) ) { $ phpdoctor = & $ this -> _root -> phpdoctor ( ) ; echo "\n" ; $ phpdoctor -> warning ( 'Found class ' . $ class -> name ( ) . ' again, overwriting previous version' ) ; } $ this -> _classes [ $ class -> name ( ) ] = ...
Add a class to this package .
5,166
public function addFunction ( & $ function ) { if ( isset ( $ this -> _functions [ $ function -> name ( ) ] ) ) { $ phpdoctor = & $ this -> _root -> phpdoctor ( ) ; echo "\n" ; $ phpdoctor -> warning ( 'Found function ' . $ function -> name ( ) . ' again, overwriting previous version' ) ; } $ this -> _functions [ $ fun...
Add a function to this package .
5,167
function & exceptions ( ) { $ exceptions = NULL ; foreach ( $ this -> _classes as $ name => $ exception ) { if ( $ exception -> isException ( ) ) { $ exceptions [ $ name ] = & $ this -> _classes [ $ name ] ; } } return $ exceptions ; }
Get exceptions in this package .
5,168
function & interfaces ( ) { $ interfaces = NULL ; foreach ( $ this -> _classes as $ name => $ interface ) { if ( $ interface -> isInterface ( ) ) { $ interfaces [ $ name ] = & $ this -> _classes [ $ name ] ; } } return $ interfaces ; }
Get interfaces in this package .
5,169
function & traits ( ) { $ traits = NULL ; foreach ( $ this -> _classes as $ name => $ trait ) { if ( $ trait -> isTrait ( ) ) { $ traits [ $ name ] = & $ this -> _classes [ $ name ] ; } } return $ traits ; }
Get traits in this package .
5,170
function & findClass ( $ className ) { $ return = NULL ; if ( isset ( $ this -> _classes [ $ className ] ) ) { $ return = & $ this -> _classes [ $ className ] ; } return $ return ; }
Lookup for a class within this package .
5,171
public function set ( $ member , $ value ) { $ member = '_' . $ member ; $ members = get_object_vars ( $ this ) ; if ( array_key_exists ( $ member , $ members ) ) { if ( is_array ( $ this -> $ member ) ) { $ this -> { $ member } [ ] = $ value ; } else { $ this -> $ member = $ value ; } return TRUE ; } return FALSE ; }
Setter method .
5,172
public function getFileContents ( $ filename ) { if ( $ contents = file_get_contents ( $ filename ) ) { if ( preg_match ( '/<body ?.*?>(.+)<\/body>/s' , $ contents , $ matches ) ) { return $ matches [ 1 ] ; } else { return $ contents ; } } return FALSE ; }
Get body of a text document
5,173
public function addConstant ( & $ constant ) { if ( ! isset ( $ this -> _constants [ $ constant -> name ( ) ] ) ) { $ this -> _constants [ $ constant -> name ( ) ] = & $ constant ; } }
Add a constant to this class .
5,174
public function addField ( & $ field ) { if ( ! isset ( $ this -> _fields [ $ field -> name ( ) ] ) ) { $ this -> _fields [ $ field -> name ( ) ] = & $ field ; } }
Add a field to this class .
5,175
function & fieldNamed ( $ fieldName ) { $ return = NULL ; if ( isset ( $ this -> _fields [ $ fieldName ] ) ) { $ return = & $ this -> _fields [ $ fieldName ] ; } return $ return ; }
Return a field in this class .
5,176
function & methods ( $ regularOnly = FALSE ) { if ( $ regularOnly ) { $ return = array ( ) ; foreach ( $ this -> _methods as $ method ) { if ( ! $ method -> isConstructor ( ) && ! $ method -> isDestructor ( ) ) { $ return [ ] = $ method ; } } } else { $ return = $ this -> _methods ; } return $ return ; }
Return the methods in this class .
5,177
function & methodNamed ( $ methodName ) { $ return = NULL ; if ( isset ( $ this -> _methods [ $ methodName ] ) ) { $ return = & $ this -> _methods [ $ methodName ] ; } return $ return ; }
Return a method in this class .
5,178
public function subclasses ( ) { $ return = array ( ) ; foreach ( $ this -> _root -> classes ( ) as $ classDoc ) { if ( $ classDoc -> subclassOf ( $ this ) ) { $ return [ ] = $ classDoc ; } } return $ return ; }
Return the known subclasses of this class
5,179
public function typeAsString ( ) { $ myPackage = & $ this -> containingPackage ( ) ; $ classDoc = & $ this -> _type -> asClassDoc ( ) ; if ( $ classDoc ) { $ packageDoc = & $ classDoc -> containingPackage ( ) ; return '<a href="' . str_repeat ( '../' , $ myPackage -> depth ( ) + 1 ) . $ classDoc -> asPath ( ) . '">' . ...
Format a field type for outputting . Recognised types are turned into HTML anchor tags to the documentation page for the class defining them .
5,180
public function getValueIfExist ( $ queries , $ keyString ) { foreach ( $ queries as $ query ) { if ( $ query -> Variable_name == $ keyString ) { return $ query -> Value ; } } }
Fetch queries value if key exist
5,181
public function prepare ( $ params ) { $ this -> params = ! empty ( $ params ) ? $ params [ 0 ] : [ ] ; $ this -> filter ( ) ; $ this -> maxRecords ( ) ; }
Prepare parameters for API requests ensuring the mandatory requirments are satisfied
5,182
protected function filter ( ) { $ lists = [ 'listCompetitions' , 'listCountries' , 'listEvents' , 'listEventTypes' , 'listMarketTypes' , 'listVenues' , 'listMarketCatalogue' ] ; if ( in_array ( $ this -> method , $ lists ) && empty ( $ this -> params [ 'filter' ] ) ) { $ this -> params [ 'filter' ] = new \ stdClass ; }...
Ensure that a filter parameter is passed where mandatory
5,183
public function _addListMarkupUL ( $ txt ) { $ li_rx = '^([ \t]+([\-+#o])[ \t]+)(\S.*(?:\n [ \t]+(?!\2)(?![ \t]).*|\n[ \t]*)*\n)' ; $ ul_rx = "(?:$li_rx){2,}" ; $ txt = preg_replace ( "/$ul_rx/m" , "\n\n<ul>\n$0\n</ul>\n\n" , $ txt ) ; if ( preg_match_all ( "%<ul>.*?</ul>%s" , $ txt , $ outerLists ) ) { $ lists = preg_...
Detects unordered lists and adds the necessary markup .
5,184
public function showHelp ( ) { $ this -> generateBody ( ) ; $ this -> info ( 'Laravel Schema version: ' . $ this -> version ) ; $ this -> table ( $ this -> headers , $ this -> body ) ; $ this -> comment ( 'Visit https://packagist.org/packages/thedevsaddam/laravel-schema for more details.' ) ; }
Display schema help information in a table
5,185
private function generateBody ( ) { $ data = $ this -> readHelpGuide ( ) ; $ this -> version = $ data [ 'version' ] ; foreach ( $ data [ 'help' ] as $ key => $ value ) { $ data = [ $ key , $ value ] ; array_push ( $ this -> body , $ data ) ; } }
Generate the table body
5,186
private function readHelpGuide ( ) { try { $ help = file_get_contents ( realpath ( __DIR__ . "/../../Schema/help.json" ) ) ; return json_decode ( $ help , true ) ; } catch ( \ Exception $ e ) { $ this -> error ( $ e -> getMessage ( ) ) ; } }
Read help . json file
5,187
public function editRole ( $ id ) { if ( Shinobi :: can ( config ( 'watchtower.acl.permission.role' , false ) ) ) { $ permission = Permission :: findOrFail ( $ id ) ; $ roles = $ permission -> roles ; $ available_roles = Role :: whereDoesntHave ( 'permissions' , function ( $ query ) use ( $ id ) { $ query -> where ( 'p...
Show the form for editing the permission roles .
5,188
public function _buildFileList ( $ files , $ dir ) { $ list = array ( ) ; $ dir = realpath ( $ dir ) ; if ( ! $ dir ) { return $ list ; } $ dir = $ this -> fixPath ( $ dir ) ; foreach ( $ files as $ filename ) { $ filename = $ this -> makeAbsolutePath ( trim ( $ filename ) , $ dir ) ; $ globResults = glob ( $ filename ...
Build a complete list of file to parse . Expand out wildcards and traverse directories if asked to .
5,189
public function makeAbsolutePath ( $ path , $ prefix ) { if ( substr ( $ path , 0 , 1 ) == '/' || substr ( $ path , 1 , 2 ) == ':\\' || substr ( $ path , 0 , 2 ) == '~/' || substr ( $ path , 0 , 2 ) == '\\\\' || preg_match ( '|^[a-z]+://|' , $ path ) ) { return $ path ; } else { if ( substr ( $ path , 0 , 2 ) == './' )...
Turn path into an absolute path using the given prefix?
5,190
public function docletPath ( ) { return realpath ( $ this -> fixPath ( $ this -> _docletPath ) . $ this -> fixPath ( $ this -> _doclet ) ) . '/' ; }
Return the path PHPDoctor is running from .
5,191
public function execute ( & $ rootDoc ) { $ docletFile = $ this -> fixPath ( $ this -> _docletPath ) . $ this -> _doclet . '/' . $ this -> _doclet . '.php' ; if ( is_file ( $ docletFile ) ) { $ this -> message ( 'Loading doclet "' . $ this -> _doclet . '"' ) ; require_once ( $ this -> fixPath ( $ this -> _docletPath ) ...
Loads and runs the doclet .
5,192
public function getFormatter ( ) { $ formatterFile = $ this -> fixPath ( $ this -> _formatterPath ) . $ this -> _formatter . '.php' ; if ( is_file ( $ formatterFile ) ) { require_once ( $ formatterFile ) ; return new $ this -> _formatter ( ) ; } else { $ this -> error ( 'Could not find formatter "' . $ formatterFile . ...
Creates the formatter and returns it .
5,193
public function _mergeArrays ( $ one , $ two ) { foreach ( $ two as $ key => $ item ) { if ( isset ( $ one [ $ key ] ) && is_array ( $ one [ $ key ] ) && is_array ( $ item ) ) { $ one [ $ key ] = $ this -> _mergeArrays ( $ one [ $ key ] , $ item ) ; } else { $ one [ $ key ] = $ item ; } } return $ one ; }
Recursively merge two arrays into a single array . This differs from the PHP function array_merge_recursive as it replaces values with the same index from the first array with items from the second .
5,194
public function _getNext ( & $ tokens , $ key , $ whatToGet , $ maxDist = 0 ) { $ start = $ key ; $ key ++ ; if ( ! is_array ( $ whatToGet ) ) $ whatToGet = array ( $ whatToGet ) ; while ( ! is_array ( $ tokens [ $ key ] ) || ! in_array ( $ tokens [ $ key ] [ 0 ] , $ whatToGet ) ) { $ key ++ ; if ( ! isset ( $ tokens [...
Get next token of a certain type from token array
5,195
public function _getPrev ( & $ tokens , $ key , $ whatToGet ) { $ key -- ; if ( ! is_array ( $ whatToGet ) ) $ whatToGet = array ( $ whatToGet ) ; while ( ! is_array ( $ tokens [ $ key ] ) || ! in_array ( $ tokens [ $ key ] [ 0 ] , $ whatToGet ) ) { $ key -- ; if ( ! isset ( $ tokens [ $ key ] ) ) return FALSE ; } retu...
Get previous token of a certain type from token array
5,196
public function _getProgramElementName ( & $ tokens , $ key ) { $ name = '' ; $ key ++ ; while ( $ tokens [ $ key ] && ( $ tokens [ $ key ] == '&' || ( isset ( $ tokens [ $ key ] [ 0 ] ) && isset ( $ tokens [ $ key ] [ 1 ] ) && ( $ tokens [ $ key ] [ 0 ] == T_WHITESPACE || $ tokens [ $ key ] [ 0 ] == T_STRING || $ toke...
Get the next program element name from the token list
5,197
public function processDocComment ( $ comment , & $ root ) { if ( substr ( trim ( $ comment ) , 0 , 3 ) != '/**' ) return array ( ) ; $ data = array ( 'docComment' => $ comment , 'tags' => array ( ) ) ; $ explodedComment = preg_split ( '/\n[ \n\t\/]*\*+[ \t]*@/' , "\n" . $ comment ) ; preg_match_all ( '/^[ \t]*[\/*]*\*...
Process a doc comment into a doc tag array .
5,198
public function _includeElements ( & $ element ) { if ( $ element -> isGlobal ( ) && ! $ element -> isFinal ( ) && ! $ this -> _globals ) { return FALSE ; } elseif ( $ element -> isGlobal ( ) && $ element -> isFinal ( ) && ! $ this -> _constants ) { return FALSE ; } elseif ( ! $ this -> _private && $ element -> isPriva...
Is an element private and we are including private elements or element is protected and we are including protected elements .
5,199
public function getAmqp ( ) { if ( empty ( $ this -> amqpContainer ) ) { $ this -> amqpContainer = Yii :: $ app -> amqp ; } return $ this -> amqpContainer ; }
Returns AMQP object .