idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
7,900 | public static function routes ( $ callback = null , array $ options = [ ] ) { $ callback = $ callback ? : function ( $ router ) { $ router -> all ( ) ; } ; $ defaultOptions = [ 'prefix' => 'oauth' , 'namespace' => '\MoeenBasra\LaravelPassportMongoDB\Http\Controllers' , ] ; $ options = array_merge ( $ defaultOptions , $... | Binds the Passport routes into the controller . |
7,901 | public static function scopesFor ( array $ ids ) { return collect ( $ ids ) -> map ( function ( $ id ) { if ( isset ( static :: $ scopes [ $ id ] ) ) { return new Scope ( $ id , static :: $ scopes [ $ id ] ) ; } return ; } ) -> filter ( ) -> values ( ) -> all ( ) ; } | Get all of the scopes matching the given IDs . |
7,902 | public function export ( $ file , $ translations ) { $ bytes = false ; if ( pathinfo ( $ file , PATHINFO_EXTENSION ) === 'yml' ) { $ ymlDumper = new Dumper ( ) ; $ ymlContent = '' ; $ ymlContent .= $ ymlDumper -> dump ( $ translations , 10 ) ; $ bytes = file_put_contents ( $ file , $ ymlContent ) ; } return ( $ bytes !... | Export translations in to the given file . |
7,903 | function get_recorders ( $ page , $ perpage ) { try { $ pagination = new \ Panopto \ RemoteRecorderManagement \ Pagination ( ) ; $ pagination -> setPageNumber ( $ page ) ; $ pagination -> setMaxNumberResults ( $ perpage ) ; $ param = new \ Panopto \ RemoteRecorderManagement \ ListRecorders ( $ this -> auth , $ paginati... | Get the list of remote recorders . |
7,904 | function get_recorder ( $ id ) { try { $ param = new \ Panopto \ RemoteRecorderManagement \ GetRemoteRecordersById ( $ this -> auth , array ( $ id ) ) ; $ recorder = $ this -> rrmclient -> GetRemoteRecordersById ( $ param ) -> getGetRemoteRecordersByIdResult ( ) ; } catch ( Exception $ e ) { throw new SoapFault ( 'clie... | Get the single remote recorder instance . |
7,905 | function get_recorders_by_external_id ( $ externalid ) { try { $ param = new \ Panopto \ RemoteRecorderManagement \ GetRemoteRecordersByExternalId ( $ this -> auth , array ( $ externalid ) ) ; $ recorders = $ this -> rrmclient -> GetRemoteRecordersByExternalId ( $ param ) -> getGetRemoteRecordersByExternalIdResult ( ) ... | Get the remote recorders instances by ExternalID . |
7,906 | function set_recorder_externalid ( $ id , $ externalid ) { if ( $ externalid === 'NULL' ) { $ externalid = null ; } try { $ param = new \ Panopto \ RemoteRecorderManagement \ UpdateRemoteRecorderExternalId ( $ this -> auth , $ id , $ externalid ) ; $ result = $ this -> rrmclient -> UpdateRemoteRecorderExternalId ( $ pa... | Set ExternalID for remote recorder . |
7,907 | function schedule_recording ( $ name , $ folderid , $ start , $ end , $ primaryrecorderid , $ secondaryrecorderid = '' , $ isbroadcast = false ) { $ recordersettings = array ( ) ; $ primaryrecorder = $ this -> get_recorder ( $ primaryrecorderid ) ; $ recordersetting = new \ Panopto \ RemoteRecorderManagement \ Recorder... | Schedule a new recording . |
7,908 | function add_folder ( $ name , $ externalid , $ parentfolderid = '' ) { if ( empty ( $ parentfolderid ) ) { $ parentfolderid = null ; } else { $ param = new \ Panopto \ SessionManagement \ GetFoldersById ( $ this -> auth , array ( $ parentfolderid ) ) ; $ folders = $ this -> smclient -> GetFoldersById ( $ param ) -> ge... | Create a new folder and assign it an external id . |
7,909 | function get_folderid_by_externalid ( $ externalid ) { try { $ param = new \ Panopto \ SessionManagement \ GetFoldersByExternalId ( $ this -> auth , array ( $ externalid ) ) ; $ folders = $ this -> smclient -> GetFoldersByExternalId ( $ param ) -> getGetFoldersByExternalIdResult ( ) ; } catch ( Exception $ e ) { throw ... | Get the single folderid by external id . |
7,910 | function delete_session ( $ sessionid ) { try { $ param = new \ Panopto \ SessionManagement \ DeleteSessions ( $ this -> auth , array ( $ sessionid ) ) ; $ this -> smclient -> DeleteSessions ( $ param ) ; } catch ( Exception $ e ) { throw new SoapFault ( 'client' , $ e -> getMessage ( ) ) ; } return true ; } | Delete session . |
7,911 | function get_session_by_id ( $ sessionid ) { try { $ param = new \ Panopto \ SessionManagement \ GetSessionsById ( $ this -> auth , array ( $ sessionid ) ) ; $ sessions = $ this -> smclient -> GetSessionsById ( $ param ) -> getGetSessionsByIdResult ( ) -> getSession ( ) ; } catch ( Exception $ e ) { return false ; } if... | Get session by id . |
7,912 | public function build ( $ concrete ) { $ reflection = new \ ReflectionClass ( $ concrete ) ; if ( ! $ reflection -> isInstantiable ( ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Class %s is not instantiable.' , $ concrete ) ) ; } $ constructor = $ reflection -> getConstructor ( ) ; if ( is_null ( $ construct... | Build a concrete instance of a class . |
7,913 | public function extend ( $ binding , \ Closure $ closure ) { $ rawObject = $ this -> getRaw ( $ binding ) ; if ( is_null ( $ rawObject ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Cannot extend %s because it has not yet been bound.' , $ binding ) ) ; } $ this -> bind ( $ binding , function ( $ container ) us... | Extend an existing binding . |
7,914 | protected function getDependencies ( \ ReflectionMethod $ method ) { $ dependencies = array ( ) ; foreach ( $ method -> getParameters ( ) as $ param ) { $ dependency = $ param -> getClass ( ) ; if ( is_null ( $ dependency ) ) { if ( $ param -> isOptional ( ) ) { $ dependencies [ ] = $ param -> getDefaultValue ( ) ; con... | Recursively build the dependency list for the provided method . |
7,915 | public function getRaw ( $ binding ) { if ( isset ( $ this -> bindings [ $ binding ] ) ) { return $ this -> bindings [ $ binding ] ; } elseif ( isset ( $ this -> parent ) ) { return $ this -> parent -> getRaw ( $ binding ) ; } return null ; } | Get the raw object prior to resolution . |
7,916 | public function export ( $ domains = [ ] , $ force = null ) { foreach ( $ this -> formExportList ( $ domains , $ force ) as $ file => $ translations ) { if ( ! file_exists ( $ file ) ) { ( new Filesystem ( ) ) -> touch ( $ file ) ; } $ currentTranslations = $ this -> parser -> parse ( file_get_contents ( $ file ) ) ?? ... | Exports translations from ES to files . |
7,917 | private function flatten ( $ array , $ prefix = '' ) { $ result = [ ] ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ result = $ result + $ this -> flatten ( $ value , $ prefix . $ key . '.' ) ; } else { $ result [ $ prefix . $ key ] = $ value ; } } return $ result ; } | Flatten multidimensional array and concatenating keys |
7,918 | private function formExportList ( $ domains , $ force ) { $ output = [ ] ; $ filters = array_filter ( [ 'messages.locale' => $ this -> getLocales ( ) , 'domain' => $ domains ] ) ; $ translations = $ this -> translationManager -> getAll ( $ filters ) ; foreach ( $ translations as $ translation ) { $ messages = $ transla... | Get translations for export . |
7,919 | private function processEnclosedField ( $ value , array $ option ) { $ cell = $ this -> trimEnclosure ( $ value , $ option [ 'enclosure' ] ) ; $ cell = $ this -> unescapeEnclosure ( $ cell , $ option [ 'enclosure' ] ) ; $ this -> setCell ( $ cell ) ; $ this -> col ++ ; $ this -> continue = false ; } | Process enclosed field |
7,920 | private function processContinuousField ( $ value , array $ option ) { $ cell = $ this -> trimLeftEnclosure ( $ value , $ option [ 'enclosure' ] ) ; $ cell = $ this -> unescapeEnclosure ( $ cell , $ option [ 'enclosure' ] ) ; $ this -> setCell ( $ cell ) ; $ this -> continue = true ; } | Process enclosed and multiple line field |
7,921 | private function processClosingField ( $ value , array $ option ) { $ cell = $ this -> trimRightEnclosure ( $ value , $ option [ 'enclosure' ] ) ; $ cell = $ this -> unescapeEnclosure ( $ cell , $ option [ 'enclosure' ] ) ; $ this -> joinCell ( $ this -> revert . $ cell ) ; $ this -> continue = false ; $ this -> col ++... | Process end of enclosure |
7,922 | private function processField ( $ value , array $ option ) { if ( $ this -> continue ) { $ cell = $ this -> unescapeEnclosure ( $ value , $ option [ 'enclosure' ] ) ; $ this -> joinCell ( $ this -> revert . $ cell ) ; } else { $ cell = rtrim ( $ value ) ; $ cell = $ this -> unescapeEnclosure ( $ cell , $ option [ 'encl... | Process unenclosed field |
7,923 | private function trimEnclosure ( $ value , $ enclosure ) { $ value = $ this -> trimLeftEnclosure ( $ value , $ enclosure ) ; $ value = $ this -> trimRightEnclosure ( $ value , $ enclosure ) ; return $ value ; } | String enclosure string from beginning and end of the string |
7,924 | private function trimLeftEnclosure ( $ value , $ enclosure ) { if ( substr ( $ value , 0 , 1 ) == $ enclosure ) { $ value = substr ( $ value , 1 ) ; } return $ value ; } | Strip an enclosure string from beginning of the string |
7,925 | private function trimRightEnclosure ( $ value , $ enclosure ) { if ( substr ( $ value , - 1 ) == $ enclosure ) { $ value = substr ( $ value , 0 , - 1 ) ; } return $ value ; } | Strip an enclosure string from end of the string |
7,926 | public function connect ( $ host , $ port , Connection $ connection , $ timeout = 5 ) { if ( $ this -> isConnected || $ this -> isConnecting ) { return new RejectedPromise ( new \ LogicException ( 'The client is already connected.' ) ) ; } $ this -> isConnecting = true ; $ this -> isConnected = false ; $ this -> host =... | Connects to a broker . |
7,927 | private function cleanPreviousSession ( ) { $ error = new \ RuntimeException ( 'Connection has been closed.' ) ; foreach ( $ this -> receivingFlows as $ receivingFlow ) { $ receivingFlow -> getDeferred ( ) -> reject ( $ error ) ; } $ this -> receivingFlows = [ ] ; foreach ( $ this -> sendingFlows as $ sendingFlow ) { $... | Cleans previous session by rejecting all pending flows . |
7,928 | public function getHistory ( Translation $ translation ) { $ ordered = [ ] ; $ histories = $ this -> getUnorderedHistory ( $ translation ) ; foreach ( $ histories as $ history ) { $ ordered [ $ history -> getLocale ( ) ] [ ] = $ history ; } return $ ordered ; } | Returns an array of history objects grouped by locales |
7,929 | private function getUnorderedHistory ( Translation $ translation ) { $ search = $ this -> repository -> createSearch ( ) ; $ search -> addQuery ( new TermQuery ( 'key' , $ translation -> getKey ( ) ) ) ; $ search -> addQuery ( new TermQuery ( 'domain' , $ translation -> getDomain ( ) ) ) ; $ search -> addSort ( new Fie... | Returns message history . |
7,930 | public function setAuthenticationInfo ( $ userkey = '' , $ password = '' , $ applicationkey = '' ) { $ this -> authinfo = new \ Panopto \ Auth \ AuthenticationInfo ( ) ; if ( ! empty ( $ userkey ) ) { $ this -> authinfo -> setUserKey ( $ userkey ) ; } if ( ! empty ( $ password ) ) { $ this -> authinfo -> setPassword ( ... | Sets AuthenticationInfo object for using in requests . |
7,931 | protected function createAuthCode ( $ userkey , $ applicationkey ) { $ payload = $ userkey . "@" . strtolower ( $ this -> serverhostname ) . "|" . strtolower ( $ applicationkey ) ; return strtoupper ( sha1 ( $ payload ) ) ; } | Generates authentication code . |
7,932 | public function trace ( $ uri , array $ headers = [ ] ) { return $ this -> sendRequest ( $ this -> message -> createRequest ( 'TRACE' , $ uri , $ headers , null ) ) ; } | Send a TRACE request |
7,933 | public function sendRequest ( RequestInterface $ request ) { $ response = $ this -> createResponse ( ) ; $ options = $ this -> createOptions ( $ request , $ response ) ; if ( is_resource ( $ this -> ch ) ) { if ( function_exists ( 'curl_reset' ) ) { curl_reset ( $ this -> ch ) ; } else { curl_close ( $ this -> ch ) ; $... | Send a PSR - 7 Request |
7,934 | protected function createResponse ( ) { try { $ body = $ this -> stream -> createStream ( fopen ( 'php://temp' , 'w+b' ) ) ; } catch ( InvalidArgumentException $ e ) { throw new RuntimeException ( 'Unable to create stream "php://temp"' ) ; } return new ResponseBuilder ( $ this -> message -> createResponse ( 200 , null ... | Create a new http response |
7,935 | protected function createHeaders ( RequestInterface $ request , array $ options ) { $ headers = [ ] ; $ request_headers = $ request -> getHeaders ( ) ; foreach ( $ request_headers as $ name => $ values ) { $ header = strtoupper ( $ name ) ; if ( $ header === 'EXPECT' ) { continue ; } if ( $ header === 'CONTENT-LENGTH' ... | Create array of headers to pass to CURLOPT_HTTPHEADER |
7,936 | protected function createOptions ( RequestInterface $ request , ResponseBuilder $ response ) { $ options = $ this -> options ; $ options [ CURLOPT_FOLLOWLOCATION ] = false ; $ options [ CURLOPT_HEADER ] = false ; $ options [ CURLOPT_RETURNTRANSFER ] = false ; try { $ options [ CURLOPT_HTTP_VERSION ] = $ this -> getProt... | Create cURL request options |
7,937 | protected function addRequestBodyOptions ( RequestInterface $ request , array $ options ) { $ http_methods = [ 'GET' , 'HEAD' , 'TRACE' , ] ; if ( ! in_array ( $ request -> getMethod ( ) , $ http_methods , true ) ) { $ body = $ request -> getBody ( ) ; $ body_size = $ body -> getSize ( ) ; if ( $ body_size !== 0 ) { if... | Add cURL options related to the request body |
7,938 | public function theJsonNodeShouldBeNull ( $ node ) { $ actual = $ this -> getJsonNodeValue ( $ node ) ; PHPUnit :: assertNull ( $ actual , sprintf ( 'The node value is `%s`' , json_encode ( $ actual ) ) ) ; } | Checks that given JSON node is null |
7,939 | public function Title ( ) { $ prefix = $ this -> config ( ) -> get ( 'question_prefix' ) ; if ( ! $ prefix ) { $ prefix = _t ( 'MathSpamProtectionField.SPAMQUESTION' , "Spam protection question: %s" ) ; } return sprintf ( $ prefix , $ this -> getMathsQuestion ( ) ) ; } | Returns the spam question |
7,940 | public function getMathsQuestion ( ) { $ session = Controller :: curr ( ) -> getRequest ( ) -> getSession ( ) ; if ( ! $ session -> get ( "mathQuestionV1" ) && ! $ session -> get ( "mathQuestionV2" ) ) { $ v1 = rand ( 1 , 9 ) ; $ v2 = rand ( 1 , 9 ) ; $ session -> set ( "mathQuestionV1" , $ v1 ) ; $ session -> set ( "m... | Creates the question from random variables which are also saved to the session . |
7,941 | public function isCorrectAnswer ( $ answer ) { $ session = Controller :: curr ( ) -> getRequest ( ) -> getSession ( ) ; $ v1 = $ session -> get ( "mathQuestionV1" ) ; $ v2 = $ session -> get ( "mathQuestionV2" ) ; $ session -> clear ( 'mathQuestionV1' ) ; $ session -> clear ( 'mathQuestionV2' ) ; $ word = MathSpamProte... | Checks the given answer if it matches the addition of the saved session variables . |
7,942 | public static function digit_to_word ( $ num ) { $ numbers = array ( _t ( 'MathSpamProtection.ZERO' , 'zero' ) , _t ( 'MathSpamProtection.ONE' , 'one' ) , _t ( 'MathSpamProtection.TWO' , 'two' ) , _t ( 'MathSpamProtection.THREE' , 'three' ) , _t ( 'MathSpamProtection.FOUR' , 'four' ) , _t ( 'MathSpamProtection.FIVE' , ... | Helper method for converting digits to their equivalent english words |
7,943 | protected function registerMigrations ( ) { if ( Passport :: $ runsMigrations ) { return $ this -> loadMigrationsFrom ( __DIR__ . '/../database/migrations' ) ; } $ this -> publishes ( [ __DIR__ . '/../database/migrations' => database_path ( 'migrations' ) , ] , 'passport-migrations' ) ; } | Register Passport s migration files . |
7,944 | protected function registerResourceServer ( ) { $ this -> app -> singleton ( ResourceServer :: class , function ( ) { return new ResourceServer ( $ this -> app -> make ( Bridge \ AccessTokenRepository :: class ) , $ this -> makeCryptKey ( 'oauth-public.key' ) ) ; } ) ; } | Register the resource server . |
7,945 | public function parse ( $ path ) { $ rawDocument = $ this -> loadDocument ( $ path ) ; list ( $ rawMetadata , $ rawContent ) = $ this -> splitDocument ( $ rawDocument ) ; return $ this -> createDocument ( $ rawDocument , $ rawMetadata , $ rawContent ) ; } | Parse a document from string or file path . |
7,946 | protected function createDocument ( $ raw , $ rawMetadata , $ rawContent ) { return new Document ( $ raw , $ this -> parseMetadata ( trim ( $ rawMetadata ) ) , $ this -> parseContent ( trim ( $ rawContent ) ) ) ; } | Create a new parsed document instance . |
7,947 | public function parseResponse ( $ response ) { $ array = [ ] ; $ exploded = explode ( '&' , $ response ) ; foreach ( $ exploded as $ explode ) { $ line = explode ( '=' , $ explode ) ; if ( isset ( $ line [ 1 ] ) ) { $ array [ $ line [ 0 ] ] = urldecode ( $ line [ 1 ] ) ; } else { $ array [ ] = $ explode ; } } return $ ... | Parse response returned by LimeLightCRM into an array |
7,948 | public function writeToStorage ( $ domain , $ translations ) { foreach ( $ translations as $ keys ) { foreach ( $ keys as $ key => $ transMeta ) { $ search = $ this -> repository -> createSearch ( ) ; $ search -> addQuery ( new MatchQuery ( 'key' , $ key ) ) ; $ results = $ this -> repository -> findDocuments ( $ searc... | Write translations to storage . |
7,949 | public function importTranslationFiles ( $ domain , $ dir ) { $ translations = $ this -> getTranslationsFromFiles ( $ domain , $ dir ) ; $ this -> writeToStorage ( $ domain , $ translations ) ; } | Imports translation files from a directory . |
7,950 | private function getProcessCommand ( ) { $ options = $ this -> transformOptions ( ) ; $ options [ ] = escapeshellarg ( $ this -> input ) ; $ command = $ this -> binary . ' ' . implode ( ' ' , $ options ) ; return $ command ; } | Get command to pass it into the process . |
7,951 | private function transformOptions ( ) { $ processOptions = [ ] ; foreach ( $ this -> options as $ key => $ value ) { $ option = $ key ; if ( $ value ) { $ option .= '=' . escapeshellarg ( $ value ) ; } $ processOptions [ ] = $ option ; } return $ processOptions ; } | Return options prepared to be passed into the Process . |
7,952 | protected function withErrorHandling ( $ callback ) { try { return $ callback ( ) ; } catch ( OAuthServerException $ e ) { $ this -> exceptionHandler ( ) -> report ( $ e ) ; return $ this -> convertResponse ( $ e -> generateHttpResponse ( new Psr7Response ) ) ; } catch ( Exception $ e ) { $ this -> exceptionHandler ( )... | Perform the given callback with exception handling . |
7,953 | protected function _cleanAttributes ( $ attributes ) { foreach ( $ attributes as $ key => $ value ) { if ( is_int ( $ key ) || in_array ( $ key , $ this -> _config [ 'ignored' ] ) ) { unset ( $ attributes [ $ key ] ) ; } else if ( $ key != 'memberof' && is_array ( $ value ) && count ( $ value ) == 1 ) { $ attributes [ ... | Clean an array of user attributes |
7,954 | protected function _cleanGroups ( $ memberships ) { $ groups = [ ] ; foreach ( $ memberships as $ group ) { $ parts = explode ( ',' , $ group ) ; foreach ( $ parts as $ part ) { if ( substr ( $ part , 0 , 3 ) == 'CN=' ) { $ groups [ ] = substr ( $ part , 3 ) ; break ; } } } return $ groups ; } | Create a friendly formatted groups array |
7,955 | public function findAdUser ( $ username , $ password ) { try { $ this -> ad -> connect ( 'default' ) ; if ( $ this -> provider -> auth ( ) -> attempt ( $ username , $ password , true ) ) { $ search = $ this -> provider -> search ( ) ; if ( is_array ( $ this -> _config [ 'select' ] ) ) { if ( ! in_array ( 'memberof' , $... | Connect to Active Directory on behalf of a user and return that user s data . |
7,956 | public static function normalize ( $ bemJson ) { switch ( true ) { case $ bemJson instanceof self : return $ bemJson ; case isList ( $ bemJson ) ; $ bemJson = static :: flattenList ( $ bemJson ) ; case $ bemJson instanceof \ Iterator : $ content = [ ] ; foreach ( $ bemJson as $ node ) { $ content [ ] = static :: normal... | Normalize bemJson node or list or tree |
7,957 | public static function flattenList ( $ a ) { if ( ! isList ( $ a ) ) { return $ a ; } do { $ flatten = false ; for ( $ i = 0 , $ l = sizeof ( $ a ) ; $ i < $ l ; $ i ++ ) { if ( isList ( $ a [ $ i ] ) ) { $ flatten = true ; break ; } } if ( ! $ flatten ) { break ; } $ res = [ ] ; for ( $ i = 0 ; $ i < $ l ; $ i ++ ) { ... | Brings items of inner simple arrays to root level if exists |
7,958 | public function getPublicSuffix ( $ host ) { if ( strpos ( $ host , '.' ) === 0 ) { return null ; } if ( strpos ( $ host , '.' ) === false ) { return null ; } $ host = strtolower ( $ host ) ; $ parts = array_reverse ( explode ( '.' , $ host ) ) ; $ publicSuffix = array ( ) ; $ psl = $ this -> psl ; foreach ( $ parts as... | Returns the public suffix portion of provided host |
7,959 | public function getRegisterableDomain ( $ host ) { if ( strpos ( $ host , '.' ) === false ) { return null ; } $ host = strtolower ( $ host ) ; $ publicSuffix = $ this -> getPublicSuffix ( $ host ) ; if ( $ publicSuffix === null || $ host == $ publicSuffix ) { return null ; } $ publicSuffixParts = array_reverse ( explod... | Returns registerable domain portion of provided host |
7,960 | public function getSubdomain ( $ host ) { $ host = strtolower ( $ host ) ; $ registerableDomain = $ this -> getRegisterableDomain ( $ host ) ; if ( $ registerableDomain === null || $ host == $ registerableDomain ) { return null ; } $ registerableDomainParts = array_reverse ( explode ( '.' , $ registerableDomain ) ) ; $... | Returns the subdomain portion of provided host |
7,961 | public function updateAction ( Request $ request , $ id ) { $ response = [ 'error' => false ] ; try { $ this -> get ( 'ongr_translations.translation_manager' ) -> edit ( $ id , $ request ) ; } catch ( \ LogicException $ e ) { $ response = [ 'error' => true ] ; } return new JsonResponse ( $ response ) ; } | Action for editing translation objects . |
7,962 | public function exportAction ( ) { $ cwd = getcwd ( ) ; if ( substr ( $ cwd , - 3 ) === 'web' ) { chdir ( $ cwd . DIRECTORY_SEPARATOR . '..' ) ; } $ output = [ 'error' => false ] ; if ( $ this -> get ( 'ongr_translations.command.export' ) -> run ( new ArrayInput ( [ ] ) , new NullOutput ( ) ) != 0 ) { $ output [ 'error... | Action for executing export command . |
7,963 | public function historyAction ( Request $ request , $ id ) { $ document = $ this -> get ( 'ongr_translations.translation_manager' ) -> get ( $ id ) ; if ( empty ( $ document ) ) { return new JsonResponse ( [ 'error' => true , 'message' => 'translation not found' ] ) ; } return new JsonResponse ( $ this -> get ( 'ongr_t... | Action for executing history command . |
7,964 | private function order ( ) { if ( $ this -> startDate > $ this -> endDate ) { $ tmp = clone $ this -> startDate ; $ this -> startDate = clone $ this -> endDate ; $ this -> endDate = clone $ tmp ; unset ( $ tmp ) ; } return $ this ; } | Swap start and end dates of the period if . |
7,965 | public static function thisWeek ( ) { $ start = CarbonDate :: today ( ) ; $ end = CarbonDate :: tomorrow ( ) ; if ( $ start -> dayOfWeek !== CarbonDate :: MONDAY ) { $ start -> modify ( 'last monday' ) ; } return new static ( $ start , $ end ) ; } | Create a CarbonPeriod from closest monday to today . |
7,966 | public function each ( \ DateInterval $ interval , \ Closure $ callback ) { $ period = new static ( $ this -> start ( ) , $ this -> start ( ) -> add ( $ interval ) ) ; do { $ callback ( new static ( $ period -> start ( ) , $ period -> end ( ) > $ this -> endDate ? $ this -> endDate : $ period -> end ( ) ) ) ; } while (... | Set the internal iterator with interval for the instance . |
7,967 | public function eachWeeks ( $ weeks = 1 , \ Closure $ callback , $ onlyFullWeek = false ) { if ( $ this -> lengthInWeeks ( ) > 0 ) { return $ this -> each ( new \ DateInterval ( "P{$weeks}W" ) , function ( CarbonPeriod $ period ) use ( $ weeks , $ callback , $ onlyFullWeek ) { if ( ! $ onlyFullWeek || $ period -> lengt... | Set the internal iterator with week interval for the instance . |
7,968 | public function eachMonths ( $ months = 1 , \ Closure $ callback , $ onlyFullMonth = false ) { if ( $ this -> lengthInMonths ( ) > 0 ) { return $ this -> each ( new \ DateInterval ( "P{$months}M" ) , function ( CarbonPeriod $ period ) use ( $ months , $ callback , $ onlyFullMonth ) { if ( ! $ onlyFullMonth || $ period ... | Set the internal iterator with month interval for the instance . |
7,969 | public function eachDayOfWeek ( $ dayOfWeek , \ Closure $ callback ) { $ start = $ this -> startDate -> copy ( ) ; if ( $ start -> dayOfWeek !== $ dayOfWeek ) { $ start -> next ( $ dayOfWeek ) ; } if ( $ start < $ this -> endDate ) { $ period = new static ( $ start , $ this -> endDate ) ; $ period -> eachDays ( CarbonD... | Set the internal iterator for day of week for the instance . |
7,970 | public function add ( \ DateInterval $ interval ) { $ this -> startDate -> add ( $ interval ) ; $ this -> endDate -> add ( $ interval ) ; return $ this ; } | Add \ DateInterval to the instance . |
7,971 | public function sub ( \ DateInterval $ interval ) { $ this -> startDate -> sub ( $ interval ) ; $ this -> endDate -> sub ( $ interval ) ; return $ this ; } | Sub \ DateInterval from the instance . |
7,972 | public function contains ( CarbonDate $ date , $ equal = true ) { return $ date -> between ( $ this -> startDate , $ this -> endDate , $ equal ) ; } | Determines if the instances contains a date . |
7,973 | public function iterateDates ( \ Closure $ callback ) { $ interval = new \ DateInterval ( 'P1D' ) ; $ period = new \ DatePeriod ( $ this -> start ( ) -> copy ( ) -> startOfDay ( ) , $ interval , $ this -> end ( ) -> copy ( ) -> startOfDay ( ) ) ; foreach ( $ period as $ date ) { $ callback ( $ date ) ; } return $ this ... | Iterate period over each day |
7,974 | public function forAuthorization ( ) { $ this -> router -> group ( [ 'middleware' => [ 'web' , 'auth' ] ] , function ( $ router ) { $ router -> get ( '/authorize' , [ 'uses' => 'AuthorizationController@authorize' , ] ) ; $ router -> post ( '/authorize' , [ 'uses' => 'ApproveAuthorizationController@approve' , ] ) ; $ ro... | Register the routes needed for authorization . |
7,975 | public static function create ( string $ path , string $ content = '' , bool $ overwrite = true ) : self { $ path = normalize_path ( $ path ) ; if ( is_file ( $ path ) && $ overwrite ) { self :: unlink ( $ path ) ; } if ( ! is_file ( $ path ) ) { if ( is_writeable ( dirname ( $ path ) ) ) { if ( $ handle = fopen ( $ pa... | Create new file . |
7,976 | public function getName ( bool $ withExtension = true ) : string { if ( $ withExtension ) { return pathinfo ( $ this -> path , PATHINFO_BASENAME ) ; } return pathinfo ( $ this -> path , PATHINFO_FILENAME ) ; } | Get file name . |
7,977 | public function getFormattedSize ( ) : string { $ kiloBytes = $ this -> getSize ( ) / 1024 ; if ( $ kiloBytes < 1024 ) { return round ( $ kiloBytes , 2 ) . ' KB' ; } $ megaBytes = $ kiloBytes / 1024 ; if ( $ megaBytes < 1024 ) { return round ( $ megaBytes , 1 ) . ' MB' ; } return round ( $ megaBytes / 1024 , 1 ) . ' GB... | Get formatted size as KB MB or GB . |
7,978 | public function delete ( ) : bool { if ( is_file ( $ this -> path ) ) { if ( is_writable ( $ this -> path ) ) { return unlink ( $ this -> path ) ; } throw new FileException ( 'Cannot delete file, because (' . $ this -> path . ') is not writable' , FileException :: NOT_WRITEABLE ) ; } return true ; } | Delete file . |
7,979 | public function rename ( string $ newFileName , bool $ withExtension = true , bool $ overwrite = true ) : self { if ( ! $ withExtension ) { $ newFileName = $ newFileName . '.' . $ this -> getExtension ( ) ; } $ newFilePath = normalize_path ( $ this -> getDirectory ( ) . DIRECTORY_SEPARATOR . basename ( $ newFileName ) ... | Rename file with new file name . |
7,980 | public function moveToDirectory ( string $ newDirectoryPath , bool $ overwrite = true ) : self { $ newDirectoryPath = normalize_path ( $ newDirectoryPath ) ; if ( is_dir ( $ newDirectoryPath ) ) { if ( is_writable ( $ newDirectoryPath ) ) { $ newFilePath = $ newDirectoryPath . DIRECTORY_SEPARATOR . $ this -> getName ( ... | Move file to new directory path . |
7,981 | public function copy ( string $ newFilePath , bool $ overwrite = true ) : self { $ newFilePath = normalize_path ( $ newFilePath ) ; if ( $ overwrite || ! is_file ( $ newFilePath ) ) { if ( copy ( $ this -> path , $ newFilePath ) ) { return new self ( $ newFilePath ) ; } throw new FileException ( 'Cannot copy file to th... | Copy file to new file path . |
7,982 | protected function doModelsListing ( ) { $ query = $ this -> newIndexQuery ( ) ; $ filters = $ this -> getRequestFilters ( ) ; $ query = $ this -> getModelManager ( ) -> filter ( $ query , $ filters ) ; $ pageNumber = intval ( $ this -> getRequest ( ) -> query -> get ( 'page' , 1 ) ) ; $ itemsPerPage = $ this -> getRec... | Does the model listing |
7,983 | public static function initialize ( $ path = null , $ mapfile = null ) { self :: register ( ) ; self :: addPath ( $ path ) ; self :: addMap ( $ mapfile ) ; } | Initialize the PEAR2 autoloader |
7,984 | protected static function register ( ) { if ( ! self :: $ registered ) { $ autoload = spl_autoload_functions ( ) ; spl_autoload_register ( __CLASS__ . '::load' ) ; if ( function_exists ( '__autoload' ) && ( $ autoload === false ) ) { spl_autoload_register ( '__autoload' ) ; } } self :: $ registered = true ; } | Register the PEAR2 autoload class with spl_autoload_register |
7,985 | protected static function addMap ( $ mapfile ) { if ( ! in_array ( $ mapfile , self :: $ maps ) ) { self :: $ mapfile = $ mapfile ; if ( file_exists ( $ mapfile ) ) { $ map = include $ mapfile ; if ( is_array ( $ map ) ) { self :: $ maps [ ] = $ mapfile ; self :: $ map = array_merge ( self :: $ map , $ map ) ; } } } } | Add a classname - to - file map |
7,986 | protected static function isMapped ( $ class ) { if ( isset ( self :: $ map [ $ class ] ) ) { return true ; } if ( isset ( self :: $ mapfile ) && ! isset ( self :: $ map [ $ class ] ) ) { self :: $ unmapped [ ] = $ class ; return false ; } return false ; } | Check if the class is already defined in a classmap |
7,987 | public static function load ( $ class ) { if ( strpos ( $ class , ":" ) !== false ) { throw new \ Exception ( 'Possible remote code injection detected' ) ; } $ mapped = self :: isMapped ( $ class ) ; if ( $ mapped ) { require_once self :: $ map [ $ class ] ; if ( ! self :: loadSuccessful ( $ class ) ) { self :: $ unmap... | Load a PEAR2 class |
7,988 | protected static function updateMap ( $ class , $ origin ) { if ( is_writable ( self :: $ mapfile ) || is_writable ( dirname ( self :: $ mapfile ) ) ) { self :: $ map [ $ class ] = $ origin ; file_put_contents ( self :: $ mapfile , '<' . "?php\n" . "// Autoload auto-generated classmap\n" . "return " . var_export ( self... | If possible update the classmap file with newly - discovered mapping . |
7,989 | protected static function baseConversion ( $ vector , $ text ) { foreach ( $ vector as $ key => $ value ) { $ char = $ value ; if ( is_array ( $ value ) ) { $ char = "" ; foreach ( $ value as $ ascii ) { $ char .= chr ( $ ascii ) ; } } $ text = str_replace ( $ key , $ char , $ text ) ; } return $ text ; } | Base convert based on array |
7,990 | public function build ( string $ uuid , string $ aggregateClass , int $ max_version = null , int $ user = null ) : AggregateInterface { try { $ aggregate = new $ aggregateClass ( $ uuid ) ; if ( $ aggregate instanceof AggregateInterface ) { $ snapshot = $ this -> snapshotStore -> find ( $ uuid , $ max_version ) ; $ min... | Builds an aggregate from a provided Uuid and Aggregate class . |
7,991 | public function loadFromHistory ( AggregateInterface $ aggregate , array $ eventStreamObjects ) : AggregateInterface { $ count = \ count ( $ eventStreamObjects ) - 1 ; foreach ( $ eventStreamObjects as $ key => $ eventStreamObject ) { $ uuid = $ eventStreamObject -> getUuid ( ) ; if ( $ uuid !== $ aggregate -> getUuid ... | Load an Aggregate from provided Event Stream Objects . |
7,992 | public function loadFromSnapshot ( AggregateInterface $ aggregate , Snapshot $ snapshot ) : AggregateInterface { $ snapshotData = $ snapshot -> getPayload ( ) ; $ aggregate -> setVersion ( $ snapshot -> getVersion ( ) ) ; $ aggregate -> setSnapshotVersion ( $ snapshot -> getVersion ( ) ) ; $ aggregate -> setCreated ( $... | Loads the Aggregate from a Snapshot . |
7,993 | public function applyChanges ( AggregateInterface $ aggregate ) : AggregateInterface { foreach ( $ aggregate -> getPendingEvents ( ) as $ event ) { $ handlerClass = $ event -> getCommand ( ) -> getHandlerClass ( ) ; $ handler = new $ handlerClass ( $ this -> messageBus , $ this ) ; $ aggregate = $ handler -> executeHan... | Execute the Handlers of pending Events on Aggregate . |
7,994 | public function apply ( AggregateInterface $ aggregate , EventInterface $ event ) : AggregateInterface { $ aggregate -> setVersion ( $ event -> getCommand ( ) -> getOnVersion ( ) + 1 ) ; return $ aggregate -> addPendingEvent ( $ event ) ; } | Adds an Event to the Aggregates pending Events . |
7,995 | public function enabledChat ( Chat $ chat ) { $ em = $ this -> getEntityManager ( ) ; $ chat -> setEnabled ( true ) ; $ em -> persist ( $ chat ) ; $ em -> flush ( ) ; } | Function to enabled chat |
7,996 | public function registerResourceServices ( ) { $ factory = Yii :: $ app -> factory -> getContainer ( ) ; $ factory -> set ( 'cmsgears\cms\common\services\interfaces\resources\IFormService' , 'cmsgears\cms\common\services\resources\FormService' ) ; $ factory -> set ( 'cmsgears\cms\common\services\interfaces\resources\IC... | Registers resource services . |
7,997 | public function registerMapperServices ( ) { $ factory = Yii :: $ app -> factory -> getContainer ( ) ; $ factory -> set ( 'cmsgears\cms\common\services\interfaces\mappers\IModelCategoryService' , 'cmsgears\cms\common\services\mappers\ModelCategoryService' ) ; $ factory -> set ( 'cmsgears\cms\common\services\interfaces\... | Registers mapper services . |
7,998 | public function process ( ContainerBuilder $ container ) { $ frameworkPath = $ container -> getParameter ( 'behat.silverstripe_extension.framework_path' ) ; global $ _FILE_TO_URL_MAPPING ; if ( $ container -> getParameter ( 'behat.mink.base_url' ) ) { $ _FILE_TO_URL_MAPPING [ dirname ( $ frameworkPath ) ] = $ container... | Passes MinkExtension s base_url parameter |
7,999 | public static function getEntityNotAllow ( ) : array { $ file = [ ] ; if ( file_exists ( PATH_HOME . "public/entity/-entity.json" ) ) $ file = json_decode ( file_get_contents ( PATH_HOME . "public/entity/-entity.json" ) , true ) ; foreach ( Helper :: listFolder ( PATH_HOME . VENDOR ) as $ lib ) { if ( file_exists ( PAT... | Retorna a lista de entidades bloqueadas por setor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.