idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
58,100 | public function execute ( Framework $ framework , WebRequest $ request , Response $ response ) { $ this -> setTitle ( $ this -> translate ( 'Group management' , '\\Zepi\\Web\\AccessControl' ) ) ; $ this -> activateMenuEntry ( 'group-administration' ) ; $ groupTable = new \ Zepi \ Web \ AccessControl \ Table \ GroupTabl... | Displays the management page for groups . |
58,101 | public function execute ( Framework $ framework , CliRequest $ request , Response $ response ) { $ framework -> getRuntimeManager ( ) -> clearCache ( false ) ; $ framework -> getRouteManager ( ) -> clearCache ( false ) ; $ framework -> getModuleManager ( ) -> reactivateModules ( ) ; $ response -> setOutputPart ( 'cache... | The RebuildFrameworkCache event handler deletes the events and routes cache and executes the activation method on all modules . |
58,102 | public function getContentPath ( ) { if ( $ this -> composer -> getPackage ( ) ) { $ topExtra = $ this -> composer -> getPackage ( ) -> getExtra ( ) ; if ( ! empty ( $ topExtra [ 'wp-content-dir' ] ) ) { return rtrim ( $ topExtra [ 'wp-content-dir' ] , '/\\' ) ; } } return 'wp-content' ; } | Calculate path to wp - content |
58,103 | public function linkDropins ( PackageInterface $ package ) { $ this -> filesystem -> ensureDirectoryExists ( $ this -> getContentPath ( ) ) ; $ content_dir = realpath ( $ this -> getContentPath ( ) ) ; $ dropins_dir = realpath ( $ this -> getInstallPath ( $ package ) . '/dropins/' ) ; foreach ( new \ DirectoryIterator ... | Link dropins to wp - content . |
58,104 | public function unlinkDropins ( PackageInterface $ package ) { $ content_dir = realpath ( $ this -> getContentPath ( ) ) ; $ dropins_dir = realpath ( $ this -> getInstallPath ( $ package ) . '/dropins/' ) ; foreach ( new \ DirectoryIterator ( $ dropins_dir ) as $ dropin ) { if ( $ dropin -> isDot ( ) ) { continue ; } $... | Unlink dropins from wp - content . |
58,105 | public function set ( $ virtualProperty , $ relationEntity ) { if ( ! in_array ( $ virtualProperty , $ this -> structure -> relationProperties ) || ! isset ( $ this -> structure -> relations [ $ virtualProperty ] ) ) { throw new RelationException ( "Relation not defined!" ) ; } if ( ! isset ( self :: $ lazy [ get_class... | Set a new relationship value . |
58,106 | private static function _createFromTimestamp ( $ timestamp ) { $ date = new DateMilli ( ) ; $ dateTime = new \ DateTime ( ) ; $ intValue = ( int ) $ timestamp ; $ date -> _setMilliseconds ( ( float ) ( $ timestamp - $ intValue ) * 1000 ) ; $ timestamp = $ intValue ; if ( $ dateTime -> setTimestamp ( $ timestamp ) === f... | Create and return a DateMilli object from a given timestamp |
58,107 | public function toString ( $ format = null ) { if ( ! isset ( $ format ) ) { $ format = self :: DATETIME_FORMAT ; } return $ this -> _dateTime -> format ( $ format ) . '.' . self :: _formatMilliseconds ( $ this -> _milliseconds ) ; } | Returns a given string format of the current Date instance |
58,108 | public function determineFromFilePath ( $ path , $ includeFiles = true , $ includeDirectories = true ) { $ path = $ this -> determineFilePath ( $ path ) ; $ this -> logger -> debug ( sprintf ( 'Searching files in path: %s' , $ path ) ) ; if ( ! file_exists ( $ path ) || ! is_readable ( $ path ) ) { $ this -> logger -> ... | Method to read Files from directory |
58,109 | protected function _decodeFile ( $ fileName , & $ ttl = null ) { if ( ! is_file ( $ fileName ) || false === ( $ _json = file_get_contents ( $ fileName ) ) || empty ( $ _json ) ) { return false ; } if ( false === ( $ _stored = json_decode ( $ _json , true ) ) || JSON_ERROR_NONE != json_last_error ( ) || ! is_array ( $ _... | Given a file name open it and JSON decode it . |
58,110 | protected function _encodeFile ( $ fileName , $ data ) { $ _filePath = dirname ( $ fileName ) ; if ( ! is_dir ( $ _filePath ) ) { if ( false === @ mkdir ( $ _filePath , 0777 , true ) && ! is_dir ( $ _filePath ) ) { return false ; } } elseif ( ! is_writable ( $ _filePath ) ) { return false ; } $ _tempFile = tempnam ( $ ... | Given a file name and some data encode and save . |
58,111 | public function get_title ( ) { $ str = '' ; if ( isset ( $ this -> refno_t ) ) { $ str = $ this -> refno_t ; if ( isset ( $ this -> altrefno_t ) ) { $ str .= ' / ' . $ this -> altrefno_t ; } } return $ str ; } | Get document title . |
58,112 | public static function getPathinfoPart ( string $ filePath , int $ fileInfOoptions ) : string { if ( $ filePath == '' || is_dir ( $ filePath ) || DirHelper :: endsWithSlash ( $ filePath ) ) { return '' ; } $ info = pathinfo ( $ filePath , $ fileInfOoptions ) ; if ( $ info == '.' && $ fileInfOoptions == PATHINFO_DIRNAME... | Simple pathinfo wrapper . |
58,113 | public static function unlinkSafe ( string $ filePath ) : bool { if ( ! FileHelper :: fileExistsSafe ( $ filePath ) ) { return false ; } if ( DirHelper :: isDirSafe ( $ filePath ) ) { return false ; } return unlink ( $ filePath ) ; } | unlink file if exists . Return false if exists and unlink fails or if filePath is a dir . |
58,114 | public static function fileExistsSafe ( string $ filePath ) : bool { if ( $ filePath == '' ) { return false ; } if ( DirHelper :: isDirSafe ( $ filePath ) ) { return false ; } return file_exists ( $ filePath ) ; } | Check if passed file exists or not . If dir passed return false . |
58,115 | public static function getMimeType ( string $ fullPathFile ) : string { $ mime_types = self :: $ arrMimeType ; $ ext = strtolower ( self :: getFilenameExtension ( $ fullPathFile ) ) ; if ( array_key_exists ( $ ext , $ mime_types ) ) { return $ mime_types [ $ ext ] ; } $ mimetype = self :: getMimeTypeByMimeContentType (... | Return mime type of a passed file in optimized mode . |
58,116 | public static function getMimeTypeByFinfo ( string $ fullPathFile ) : string { if ( ! function_exists ( 'finfo_open' ) ) { return '' ; } $ finfo = finfo_open ( FILEINFO_MIME ) ; $ mimetype = finfo_file ( $ finfo , $ fullPathFile ) ; finfo_close ( $ finfo ) ; if ( $ mimetype === false ) { return '' ; } return $ mimetype... | Return mime type of a passed file using finfo |
58,117 | public function uploadAction ( ) { if ( ! $ filename = $ this -> get ( 'vince_type.manager.redactor' ) -> uploadFile ( ) ) { return new JsonResponse ( array ( 'error' => $ this -> get ( 'translator' ) -> trans ( 'redactor.messages.fileUploadError' , array ( ) , 'Vince' ) , ) ) ; } return new Response ( json_encode ( ar... | Upload file to user public directory |
58,118 | public function listFilesAction ( Request $ request ) { if ( ! $ request -> get ( 'paths' ) ) { throw $ this -> createNotFoundException ( ) ; } $ files = $ this -> get ( 'vince_type.manager.redactor' ) -> listFiles ( $ request -> get ( 'paths' ) ) ; return new Response ( json_encode ( $ files , JSON_UNESCAPED_SLASHES )... | List files in path |
58,119 | public function getFilter ( ) { if ( null == $ this -> filter ) { $ this -> filter = new Filter ( [ 'serviceLocator' => $ this -> getServiceLocator ( ) , 'id' => $ this -> getId ( ) , ] ) ; } return $ this -> filter ; } | Gets a filter instance from grid . If filter not set then creating an empty filter instance . |
58,120 | public function getCells ( ) { if ( $ this -> cells == null ) { $ this -> cells = new CellSet ( [ 'serviceLocator' => $ this -> getServiceLocator ( ) , 'id' => $ this -> getId ( ) , ] ) ; } return $ this -> cells ; } | Gets a cells set from grid . If not set creating an empty cells set |
58,121 | public function getDataSource ( ) { $ this -> dataSource -> bindCellsset ( $ this -> getCells ( ) ) ; if ( null != $ this -> getDefaultOrderDirection ( ) && null != $ this -> getDefaultOrderField ( ) && ( $ this -> dataSource instanceof \ DataGrid \ DataSource \ DataSourceSortableInterface ) ) { $ this -> dataSource ->... | Gets a data source provided for grid . This function apply CellsSet sorting filter and paginator to source |
58,122 | public function setDataSource ( $ dataSource ) { if ( ! $ dataSource instanceof DataSourceInterface ) { $ dataSource = $ this -> getServiceLocator ( ) -> get ( 'DataGrid\Factory\DataSource' ) -> get ( $ dataSource ) ; } $ this -> dataSource = $ dataSource ; return $ this ; } | Sets a data source for grid . |
58,123 | public function getPaginator ( ) { if ( ! empty ( $ this -> paginator ) ) { $ this -> paginator -> setId ( $ this -> getId ( ) ) ; } return $ this -> paginator ; } | Gets pagination . |
58,124 | public function setPaginator ( $ paginator ) { if ( is_array ( $ paginator ) ) { $ paginator = new Paginator ( $ paginator ) ; } $ this -> paginator = $ paginator ; return $ this ; } | Sets pagination . |
58,125 | public function setDefaultOrder ( $ defaultOrderField , $ defaultOrderDirection = 'ASC' ) { $ this -> defaultOrderField = $ defaultOrderField ; $ this -> defaultOrderDirection = $ defaultOrderDirection ; return $ this ; } | Set default sorting field and direction . Ensure that your data source contains that field . |
58,126 | public function buildAuthenticationEndpointUri ( SsoClient $ ssoClient , $ callbackUri ) { $ uri = new Uri ( $ this -> endpointUri ) ; $ arguments = array ( 'callbackUri' => ( string ) $ callbackUri , 'ssoClientIdentifier' => $ ssoClient -> getServiceBaseUri ( ) ) ; ksort ( $ arguments ) ; $ uri -> setQuery ( http_buil... | Build a URI to redirect to the server authentication endpoint |
58,127 | public function verifyCallbackSignature ( $ accessTokenCipher , $ signature ) { return $ this -> rsaWalletService -> verifySignature ( $ accessTokenCipher , $ signature , $ this -> publicKey ) ; } | Verify the signature of a callback redirect to the client |
58,128 | public function touchSession ( SsoClient $ ssoClient , $ sessionId ) { $ serviceUri = $ this -> serviceBaseUri . '/session/' . urlencode ( $ sessionId ) . '/touch' ; $ request = \ TYPO3 \ Flow \ Http \ Request :: create ( new Uri ( $ serviceUri ) , 'POST' ) ; $ request -> setContent ( '' ) ; $ signedRequest = $ this ->... | Touch a global session |
58,129 | public function destroySession ( SsoClient $ ssoClient , $ sessionId ) { $ serviceUri = new Uri ( $ this -> serviceBaseUri . '/session/' . urlencode ( $ sessionId ) . '/destroy' ) ; $ serviceUri -> setQuery ( http_build_query ( array ( 'clientIdentifier' => $ ssoClient -> getServiceBaseUri ( ) ) ) ) ; $ request = \ TYP... | Destroy the given global session |
58,130 | public static function fromXml ( \ DOMDocument $ xml ) { $ static = new static ( ) ; $ url = $ xml -> getElementsByTagName ( 'resource' ) ; $ static -> autoLoginUrl = StringLiteral :: fromXml ( $ url ) ; $ code = $ xml -> getElementsByTagName ( 'code' ) ; $ static -> code = StringLiteral :: fromXml ( $ code ) ; return ... | Builds a AutoLogin object from XML . |
58,131 | public static function Obl80 ( $ date1 , $ date2 ) { $ t ; $ eps0 ; $ t = ( ( $ date1 - DJ00 ) + $ date2 ) / DJC ; $ eps0 = DAS2R * ( 84381.448 + ( - 46.8150 + ( - 0.00059 + ( 0.001813 ) * $ t ) * $ t ) * $ t ) ; return $ eps0 ; } | - - - - - - - - - i a u O b l 8 0 - - - - - - - - - |
58,132 | public function registerServices ( DiInterface $ dependencyInjection ) { $ registerView = $ this -> getRegisterView ( $ dependencyInjection ) ; $ registerView -> register ( $ dependencyInjection -> get ( 'router' ) -> getModuleName ( ) , $ this -> modulePath ) ; $ dependencyInjection -> get ( 'dispatcher' ) -> setDefau... | Registers the module - only services |
58,133 | public function formatUtm ( string $ ellipsoid = Ellipsoid :: TYPE_WGS_84 ) { return Converter :: LL2Utm ( $ ellipsoid , $ this -> Latitude , $ this -> Longitude ) ; } | Formats the coordinate UTM specific and return the resulting string . |
58,134 | public function formatDecimal ( int $ precision = 8 ) : string { $ returnValue = '' ; if ( ! $ this -> isValid ( ) ) { return $ returnValue ; } $ returnValue .= $ this -> Latitude -> formatDecimal ( $ precision ) . ', ' . $ this -> Longitude -> formatDecimal ( $ precision ) ; return $ returnValue ; } | Formats the coordinate with floating point numbers . |
58,135 | public function calcSphericalDistanceTo ( Coordinate $ otherPoint ) { if ( ! $ this -> isValid ( ) ) { return 0 ; } $ b1 = $ this -> Latitude -> getDecimalValue ( ) ; $ l1 = $ this -> Longitude -> getDecimalValue ( ) ; $ b2 = $ otherPoint -> Latitude -> getDecimalValue ( ) ; $ l2 = $ otherPoint -> Longitude -> getDecim... | Calculate the spherical distance from current coordinate to a other one . |
58,136 | public function isValid ( ) : bool { return ! \ is_null ( $ this -> Latitude ) && ! \ is_null ( $ this -> Longitude ) && ( $ this -> Latitude instanceof Latitude ) && ( $ this -> Longitude instanceof Longitude ) ; } | Returns if the current instance defines a valid coordinate . |
58,137 | public function init ( array $ stack ) : void { $ this -> stack = $ stack ; $ this -> dispatcher = new MiddlemanDispatcher ( $ this -> stack ) ; } | Initialize the middleware dispatcher by providing the necessary params . |
58,138 | public function responseFilter ( $ data , $ table = '' ) { if ( is_object ( $ data ) ) { $ data = $ data -> toArray ( ) ; } if ( $ table === '' && empty ( static :: DEFAULT_TABLE ) ) { return $ data ; } elseif ( $ table === '' && ! empty ( static :: DEFAULT_TABLE ) ) { $ table = static :: DEFAULT_TABLE ; } $ excludeFie... | Too many bugs!!! may deleted soon!! |
58,139 | public function newBranch ( NewBranchEvent $ event ) { $ branch = $ event -> getBranch ( ) ; $ related = $ this -> matcher -> getRelatedIssues ( $ branch ) ; $ branch -> setIssuesRelated ( $ related ) ; $ this -> repository -> persist ( $ branch ) ; } | Fills the branch with related issues matched by BranchMatcher . |
58,140 | public function setRulesFor ( $ key , $ rules ) { if ( is_array ( $ rules ) || is_string ( $ rules ) ) $ this -> _rules [ $ key ] = $ rules ; return $ this ; } | Set rules for an item key . |
58,141 | public function getRulesFor ( $ key ) { if ( ! isset ( $ this -> _rules [ $ key ] ) ) return null ; if ( is_string ( $ this -> _rules [ $ key ] ) ) return explode ( '|' , $ this -> _rules [ $ key ] ) ; return $ this -> _rules [ $ key ] ; } | Gets the rules for an item if it is set . |
58,142 | protected function getInputType ( $ input ) { $ type = gettype ( $ input ) ; if ( $ type == 'integer' || $ type == 'float' || $ type == 'double' ) $ type = 'numeric' ; if ( $ type == 'NULL' || $ type == 'object' || $ type == 'resource' || $ type == 'undefined type' ) $ type = null ; if ( $ type == 'array' && isset ( $ ... | Checks the type of the input and returns a validation type string of string numeric array or file . Will return null if a non - validation type is found . |
58,143 | public function getChoices ( ) { $ choices = $ this -> getOrderedRoles ( ) ; if ( isset ( $ choices [ 'ROLE_SUPER_ADMIN' ] ) ) { unset ( $ choices [ 'ROLE_SUPER_ADMIN' ] ) ; } if ( isset ( $ choices [ 'ROLE_ADMIN' ] ) && ! $ this -> isCurrentUserSuperAdmin ( ) ) { unset ( $ choices [ 'ROLE_ADMIN' ] ) ; } return $ choic... | Returns a list of choice for user s roles . |
58,144 | public function getUserRole ( UserInterface $ user ) { $ currentRole = '' ; $ userRoles = $ user -> getRoles ( ) ; if ( in_array ( $ userRoles [ 0 ] , $ this -> getOrderedRoles ( ) ) ) { $ currentRole = $ userRoles [ 0 ] ; } return $ currentRole ; } | Gets the current role of a user . |
58,145 | protected function getOrderedRoles ( ) { $ choices = [ ] ; foreach ( $ this -> roles as $ key => $ roles ) { foreach ( $ roles as $ role ) { $ choices [ $ role ] = $ role ; } $ choices [ $ key ] = $ key ; } return $ choices ; } | Returns the list of roles ordered by power level . |
58,146 | protected function isCurrentUserSuperAdmin ( ) { if ( null === $ token = $ this -> tokenStorage -> getToken ( ) ) { return true ; } if ( ! is_object ( $ user = $ token -> getUser ( ) ) ) { return false ; } return $ user -> isSuperAdmin ( ) ; } | Checks that current user is super administrator or not . |
58,147 | protected function registerViewer ( ) { $ this -> app -> bindShared ( 'viewer' , function ( $ app ) { $ view = $ app [ 'view' ] ; return new Classes \ Viewer ( $ view ) ; } ) ; } | Register the viewer class . |
58,148 | public function setAccessControlRequestMethod ( $ accessControlRequestMethod ) { if ( is_string ( $ accessControlRequestMethod ) === false ) { throw new InvalidArgumentException ( 'Parameter "method" is not a string' ) ; } if ( $ accessControlRequestMethod === '' ) { throw new InvalidArgumentException ( 'Parameter "met... | Set access - control - request - method |
58,149 | public function setAccessControlRequestHeaders ( array $ accessControlRequestHeaders ) { foreach ( $ accessControlRequestHeaders as $ h ) { if ( is_string ( $ h ) === false ) { throw new InvalidArgumentException ( 'An element in array "accessControlRequestHeaders" is not a string' ) ; } } $ this -> accessControlRequest... | Set access - control - request - headers |
58,150 | public function modify ( Closure $ modify ) { $ contents = $ this -> jsonc -> parseFile ( $ this -> file ) ; $ modifiedContents = $ modify ( $ contents ) ; if ( $ modifiedContents !== NULL ) { $ contents = $ modifiedContents ; } $ this -> file -> writeContents ( $ this -> jsonc -> stringify ( $ contents , JSONConverter... | Modifies the JSON read from the file and saves it |
58,151 | public function isLoginPage ( ) { if ( is_null ( $ this -> loginPage ) ) { $ this -> loginPage = ( bool ) in_array ( $ this -> getPageNow ( ) , [ 'wp-login.php' , 'wp-register.php' ] ) ; } return $ this -> loginPage ; } | Is login page |
58,152 | public function ajax ( ) { if ( is_null ( $ this -> ajax ) ) { $ this -> ajax = ( bool ) ( defined ( 'DOING_AJAX' ) && DOING_AJAX ) ; $ this -> ajax = ( bool ) ( $ this -> ajax || parent :: ajax ( ) ) ; } return $ this -> ajax ; } | is ajax request |
58,153 | public function urlAction ( $ action , array $ query = [ ] ) { $ query [ 'action' ] = $ action ; $ query = array_replace ( $ this -> query ( ) , $ query ) ; return $ this -> url ( ) . '?' . http_build_query ( $ query ) ; } | Get the full URL with new action for the requests . |
58,154 | public function urlPagination ( $ pagination , array $ query = [ ] ) { $ query [ MbDatabaseQueryBuilder :: getPagination ( ) ] = $ pagination ; $ query = array_replace ( $ this -> query ( ) , $ query ) ; return $ this -> url ( ) . '?' . http_build_query ( $ query ) ; } | Get the full URL with new pagination for the requests . |
58,155 | public function hasQuery ( $ key ) { $ arrayKeys = array_keys ( $ _GET ) ; $ keys = is_array ( $ key ) ? $ key : func_get_args ( ) ; foreach ( $ keys as $ value ) { if ( ! in_array ( $ value , $ arrayKeys ) || trim ( ( string ) $ _GET [ $ value ] ) === '' ) { return false ; } } return true ; } | Determine if the request params contains a non - empty value for an input item . |
58,156 | public function route ( array $ classMap , array $ errorMap = null ) { $ this -> classMap = $ classMap ; $ this -> errorMap = $ errorMap === null ? self :: $ defaultErrorMap : array_merge ( self :: $ defaultErrorMap , $ errorMap ) ; $ pageMapper = new PageMapper ( $ this -> getClassMap ( ) ) ; $ page = $ pageMapper -> ... | Main API method to show a page . |
58,157 | private function deriveCookiePathFromRequestUrl ( ) { $ path = $ this -> requestUrl -> getPath ( ) ; if ( $ path -> get ( ) == '' || substr ( ( string ) $ path , 0 , 1 ) != '/' ) { return '/' ; } if ( substr_count ( ( string ) $ path , '/' ) === 1 ) { return '/' ; } return substr ( ( string ) $ path , 0 , strrpos ( ( s... | Derive the path for a cookie from the request URL |
58,158 | public function write ( $ file , $ data ) { $ file = '/data/' . $ file ; $ data = json_decode ( json_encode ( $ data ) , true ) ; $ data_content = isset ( $ data [ 'content' ] ) ? $ data [ 'content' ] : '' ; unset ( $ data [ 'content' ] ) ; $ data = '---' . PHP_EOL . trim ( $ this -> yaml -> dump ( $ data , 5 ) ) . PHP... | Writes a data file . |
58,159 | public function read ( $ file ) { $ file = '/data/' . $ file ; $ result = [ ] ; $ ext = pathinfo ( $ file , PATHINFO_EXTENSION ) ; if ( isset ( $ this -> converters [ $ ext ] ) ) { $ meta = [ ] ; $ content = '' ; $ file_contents = $ this -> source_filesystem -> read ( $ file ) ; if ( $ file_contents ) { $ parts = preg_... | Reads a data file . |
58,160 | public function queue ( array $ message , $ template = false , array $ templateVars = [ ] ) { $ message = $ this -> compressMessage ( $ message ) ; $ variables = $ this -> compressMessage ( $ templateVars ) ; $ body = [ 'm' => $ message , 't' => $ template , 'v' => $ variables , ] ; $ body = json_encode ( $ body ) ; re... | Queues an email to be sent . |
58,161 | public function processEmail ( Message $ message ) { $ body = json_decode ( $ message -> getBody ( ) ) ; $ message = $ this -> uncompressMessage ( $ body -> m ) ; $ variables = $ message ; if ( property_exists ( $ body , 'v' ) ) { $ variables = $ this -> uncompressMessage ( $ body -> v ) ; } $ this -> send ( $ message ... | Handles an email message coming off the queue . |
58,162 | public function store ( $ account_id = null , $ identifier = null , $ username = null , $ address , $ verified = null , $ upstream_app_name = null , $ verification_callback = null , $ confirmation_from = null ) { $ fields = [ ] ; if ( ! is_null ( $ account_id ) ) $ fields [ 'account_id' ] = $ account_id ; if ( ! is_nul... | Create An Email |
58,163 | function less ( $ file = "screen.less" , $ iTitle = "" , $ media = "all" ) { ( ! empty ( $ iTitle ) ) ? $ title = " title='$iTitle'" : $ title = '' ; return $ this -> lineBreak . '<link rel="stylesheet/less" type="text/css" href="' . $ file . '"' . $ title . ' media="' . $ media . '" />' ; } | not use since it is not cross browser compatible yet |
58,164 | public function getJob ( string $ name ) : Definition { if ( ! $ this -> hasJob ( $ name ) ) { throw new \ InvalidArgumentException ( 'Job not found: ' . $ name ) ; } return $ this -> jobs [ $ name ] ; } | Get the configuration array for a job . |
58,165 | public function getDictionary ( string $ name ) : Definition { if ( ! $ this -> hasDictionary ( $ name ) ) { throw new \ InvalidArgumentException ( 'Dictionary not found: ' . $ name ) ; } return $ this -> dictionaries [ $ name ] ; } | Get the configuration for a dictionary . |
58,166 | public function Comments ( $ Toggle = '' , $ TransientKey = '' ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; try { if ( $ this -> Toggle ( $ Toggle , $ TransientKey ) ) Redirect ( 'embed/comments' ) ; } catch ( Gdn_UserException $ Ex ) { $ this -> Form -> AddError ( $ Ex ) ; } $ this -> AddSideMenu ( 'dashboa... | Display the embedded forum . |
58,167 | public function setEagerLoaded ( $ query ) { if ( ! empty ( $ this -> getEagerLoad ( ) ) ) { $ query = $ query -> with ( $ this -> getEagerLoad ( ) ) ; } return $ query ; } | Set this query s eager loaded relationships . |
58,168 | public function setLazyLoaded ( $ query ) { if ( ! empty ( $ this -> getLazyLoad ( ) ) ) { $ query = $ query -> load ( $ this -> getLazyLoad ( ) ) ; } return $ query ; } | Set this query s lazy loaded relationships . |
58,169 | function IS ( $ action , $ module , $ bundle , $ output ) { $ match = true ; if ( $ action != '' && $ action != $ this -> action ) { $ match = false ; } if ( $ module != '' && $ module != $ this -> module ) { $ match = false ; } if ( $ bundle != '' && $ bundle != $ this -> bundle ) { $ match = false ; } if ( $ match ) ... | Return the output if the route matches |
58,170 | function short ( $ action , $ module , $ bundle ) { if ( is_array ( $ this -> get ( 'routes' ) ) ) { foreach ( $ this -> get ( 'routes' ) as $ r ) { if ( $ bundle == $ r [ 'bundle' ] && $ module == $ r [ 'default_module' ] && $ action == $ r [ 'default_action' ] && ! empty ( $ r [ 'short' ] ) ) { return $ r [ 'short' ]... | reverse a route to it s configuration state |
58,171 | public function create ( Environment $ environment ) { $ uri = ( new UriFactory ( ) ) -> create ( $ environment ) ; $ uploadFiles = ( new FilesFactory ( ) ) -> create ( $ environment ) ; $ headers = ( new HeadersFactory ( ) ) -> create ( $ environment ) ; $ cookies = $ environment -> getCookies ( ) ; $ requestMethod = ... | Create instance of ServerRequest object from instance of Environment object |
58,172 | public function formatPhone ( string $ phone , string $ format = '(###) ###-####' ) : string { return $ this -> formatPhoneMask ( $ this -> stripNonNumeric ( $ phone ) , strlen ( $ this -> stripNonNumeric ( $ phone ) ) , $ format ) ; } | Format a phone number to a set mask . |
58,173 | protected function formatPhoneMask ( string $ phone , int $ length , string $ format ) : string { $ this -> formatPhoneMultiMask ( $ phone , $ length , $ format ) ; return preg_match ( '/^\(?([2-9]{1}\d{2})\)?[-.\s]?([2-9]{1}\d{2})[-.\s]?(\d{4})$/' , $ phone ) ? preg_replace ( '/([0-9]{3})([0-9]{3})([0-9]{4})/' , '($1)... | Format phone - to - mask . |
58,174 | protected function formatPhoneMultiMask ( string $ phone , int $ length , string $ format ) : string { if ( 7 === $ length && 1 === substr_count ( $ format , '-' ) ) { return preg_replace ( '/([0-9]{3})([0-9]{4})/' , '$1-$2' , $ phone ) ; } elseif ( 10 === $ length ) { return $ this -> formatPhoneTenDigitMask ( $ phone... | Return the correct digit masking . |
58,175 | protected function formatPhoneTenDigitMask ( string $ phone , string $ format ) : string { return ( 1 === substr_count ( $ format , '(###)' ) ) ? preg_replace ( '/([0-9]{3})([0-9]{3})([0-9]{4})/' , '($1) $2-$3' , $ phone ) : preg_replace ( '/([0-9]{3})([0-9]{3})([0-9]{4})/' , '$1-$2-$3' , $ phone ) ; } | Format phone with 10 - digit mask . |
58,176 | public function formatEID ( string $ employeeID , string $ format = '#########' ) : string { $ employeeID = $ this -> stripNonNumeric ( $ employeeID ) * 1 ; return str_pad ( $ employeeID , strlen ( $ format ) , '0' , STR_PAD_LEFT ) ; } | Returns a UCSD formatted EID number . |
58,177 | public function formatOfficeLocation ( string $ office ) : string { $ office = strtoupper ( trim ( $ office ) ) ; $ rightAlpha = preg_replace ( '/[^A-Z]/' , '' , substr ( $ office , - 1 ) ) ; $ numbersOnly = substr ( '0000' . ( $ this -> getNumbersOnly ( $ office ) * 1 ) , - 4 ) ; $ numbersOnly = substr ( $ numbersOnly... | Return a correctly formatted UCSD office location . |
58,178 | protected function loadElements ( $ tagName , ContainerBuilder $ container , $ methodForConfiguration , $ methodForService ) { $ parserName = 'open_orchestra_bbcode.parser' ; $ tagName = 'open_orchestra_bbcode.' . $ tagName ; if ( $ container -> hasParameter ( $ tagName ) ) { $ parser = $ container -> getDefinition ( $... | Load validators or code definitions from both configuration and tagged services |
58,179 | public function query ( $ name , $ query , $ time = 0 ) { $ this -> _query [ $ name ] = $ query ; $ this -> _time [ $ name ] = $ time ; } | Add a new query to the instance |
58,180 | public function vars ( $ var ) { if ( is_array ( $ var ) ) { foreach ( $ var as $ key => $ valeur ) { $ this -> _var [ $ key ] = $ valeur ; } } else if ( func_num_args ( ) == 2 ) { $ args = func_get_args ( ) ; $ this -> _var [ $ args [ 0 ] ] = $ args [ 1 ] ; } else if ( func_num_args ( ) == 3 ) { $ args = func_get_args... | add variables to the instance |
58,181 | protected function _getDataRelation ( $ line , $ foreign , $ parent ) { $ class = $ foreign -> referenceEntity ( ) ; $ entity = self :: Entity ( ) -> $ class ( ) ; if ( $ line [ $ foreign -> field ( ) . '_' . $ entity -> name ( ) . '_' . $ entity -> primary ( ) ] != '' ) { foreach ( $ line as $ key => $ field ) { $ val... | If the Entity used has at least one relation we have to get an Entity object instead of the foreign key |
58,182 | public function compile ( $ pharOutputPath , $ binPath ) { $ pharBaseName = basename ( $ pharOutputPath ) ; if ( file_exists ( $ pharOutputPath ) ) { unlink ( $ pharOutputPath ) ; } $ phar = $ this -> initialisePhar ( $ pharOutputPath , 0 , $ pharBaseName ) ; $ phar -> startBuffering ( ) ; foreach ( $ this -> files as ... | Compiles the project into a phar file . |
58,183 | public function addDirectory ( $ path ) { $ finder = new Finder ( ) ; $ finder -> files ( ) -> ignoreVCS ( true ) -> name ( '*.php' ) -> in ( $ path ) ; foreach ( $ finder as $ file ) { $ this -> addFile ( $ file ) ; } return $ this ; } | Add a directory . |
58,184 | protected function addFileToPhar ( $ path , Phar $ phar ) { $ realPath = realpath ( $ path ) ; $ content = file_get_contents ( $ realPath ) ; $ phar -> addFromString ( $ realPath , $ content ) ; } | Add a directory to the phar file . |
58,185 | protected function errorIfCompiledIncludesIsEmpty ( Config $ config ) : ? Error { $ includes = $ config -> compileIncludes ( ) ; return empty ( $ includes ) ? ResultFactory :: makeError ( $ this , 'Includes is empty.' ) : null ; } | Returns error if compiled includes is empty . |
58,186 | public static function getString ( int $ length = 20 , bool $ forceSeed = false ) : string { $ set = [ "a" , "A" , "b" , "B" , "c" , "C" , "d" , "D" , "e" , "E" , "f" , "F" , "g" , "G" , "h" , "H" , "i" , "I" , "j" , "J" , "k" , "K" , "l" , "L" , "m" , "M" , "n" , "N" , "o" , "O" , "p" , "P" , "q" , "Q" , "r" , "R" , "... | Creates a random alphanumeric string with the given length . |
58,187 | public static function getInt ( int $ min = 0 , int $ max = - 1 , bool $ forceSeed = false ) : int { if ( self :: $ _seeded === false || $ forceSeed === true ) { self :: _seedRandomizer ( ) ; } if ( $ max > $ min ) { return mt_rand ( $ min , $ max ) ; } else { return mt_rand ( ) ; } } | Creates a random integer number within the given range . If the given minimum is greater than the given maximum then the complete 64 bit range of integers will be used . |
58,188 | public static function getFloat ( int $ min = 0 , int $ max = 1 , bool $ forceSeed = false ) : float { if ( $ max > $ min ) { return $ min + ( float ) self :: getInt ( 0 , - 1 , $ forceSeed ) / mt_getrandmax ( ) * ( $ max - $ min ) ; } else { return ( float ) self :: getInt ( 0 , - 1 , $ forceSeed ) / mt_getrandmax ( )... | Creates a random floating point number within the given range . If the given minimum is greater than the given maximum then the complete 64 bit range of floats will be used . |
58,189 | private static function _seedRandomizer ( ) { self :: $ _seeded = true ; $ seed = \ hexdec ( \ bin2hex ( \ openssl_random_pseudo_bytes ( 8 ) ) ) ; \ mt_srand ( $ seed ) ; } | Creates a new random seed for more randomness . |
58,190 | public function getDependentPackages ( $ isDevMode ) { $ packages = [ ] ; $ rootPackage = $ this -> composer -> getPackage ( ) ; if ( $ this -> isDependentPackage ( $ rootPackage , ( bool ) $ isDevMode ) ) { $ packages [ ] = new PackageWrapper ( $ rootPackage , getcwd ( ) ) ; } $ manager = $ this -> composer -> getInst... | Get an array of packages that depend on the target package |
58,191 | private function isDependentPackage ( PackageInterface $ package , $ devMode = false ) { $ packages = $ package -> getRequires ( ) ; if ( $ devMode ) { $ packages = array_merge ( $ packages , $ package -> getDevRequires ( ) ) ; } foreach ( $ packages as $ link ) { if ( $ this -> targetPackage === $ link -> getTarget ( ... | Indicate whether a package has the target package as a dependency |
58,192 | public function extract ( $ expression , $ capture = 0 ) { $ valid = ( boolean ) preg_match ( $ expression , $ this -> value , $ match ) ; if ( $ valid === false || isset ( $ match [ $ capture ] ) === false ) { return null ; } return $ match [ $ capture ] ; } | Extract values from the token using a regular expression . |
58,193 | public static function compare ( $ left , $ right ) { if ( $ left < $ right ) { $ result = - 1 ; } else if ( $ left > $ right ) { $ result = 1 ; } else { $ result = 0 ; } return $ result ; } | Returns the order of the left and right hand values as an integer |
58,194 | public static function reverse ( $ left , $ right ) { if ( $ left < $ right ) { $ result = 1 ; } else if ( $ left > $ right ) { $ result = - 1 ; } else { $ result = 0 ; } return $ result ; } | Returns the reverse order of the left and right hand values as an integer |
58,195 | protected function dataFormalize ( $ data ) { if ( is_array ( $ data ) ) { $ data = json_encode ( $ data ) ; } else if ( $ data instanceof \ DOMDocument ) { $ data = $ data -> saveXML ( ) ; } else if ( $ data instanceof \ SimpleXMLElement ) { $ data = $ data -> asXML ( ) ; } return $ data ; } | If data are in an array tranform it in text |
58,196 | protected function useHeadersFromType ( $ type = null ) { $ defaultHeaders [ 'json' ] = array ( 'Accept:application/json' , 'Content-Type:application/json' , ) ; $ defaultHeaders [ 'xml' ] = array ( 'Accept:application/xml' , 'Content-Type:application/xml' , ) ; $ defaultHeaders [ 'custom' ] = null ; if ( ! isset ( $ t... | Set headers depending on the type |
58,197 | protected function recieveHeaders ( $ headers = null ) { $ this -> resource = $ this -> defaultResource ; if ( is_string ( $ headers ) ) { $ type = trim ( strtolower ( $ headers ) ) ; $ headers = $ this -> useHeadersFromType ( $ type ) ; } else { if ( ! is_array ( $ headers ) ) { $ headers = $ this -> useHeadersFromTyp... | Init curl headers if not exists |
58,198 | public function create ( $ service , $ headers = null , $ data = null ) { return $ this -> post ( $ service , $ headers , $ data ) ; } | Create request Use HTTP POST to send data |
58,199 | public function post ( $ service , $ headers = null , $ data = null ) { return $ this -> customRequest ( $ service , 'POST' , $ headers , $ data ) ; } | POST request Use HTTP POST to send data |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.