idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
238,000 | public function getTransaction ( $ transactionId ) : QueryInterface { $ uri = $ this -> getUri ( 'query' , $ this -> getParameters ( [ 'transactionId' => $ transactionId ] ) ) ; $ response = $ this -> performRequest ( ( string ) $ uri ) ; Assert :: isInstanceOf ( $ response , QueryInterface :: class , 'Invalid response... | Get a Query response object for the provided transaction ID . |
238,001 | public function registerTransaction ( array $ transactionData ) : RegisterInterface { $ uri = $ this -> getUri ( 'register' , $ this -> getParameters ( $ transactionData ) ) ; $ response = $ this -> performRequest ( ( string ) $ uri ) ; Assert :: isInstanceOf ( $ response , RegisterInterface :: class , 'Invalid respons... | Registers a transaction |
238,002 | public function processTransaction ( array $ transactionData , string $ operation ) : ProcessInterface { $ transactionData = array_filter ( $ transactionData + [ 'operation' => $ operation ] , function ( $ k ) { return in_array ( $ k , [ 'transactionId' , 'operation' , 'transactionAmount' ] ) ; } , ARRAY_FILTER_USE_KEY... | Processes a transaction |
238,003 | public function getTerminalUri ( string $ transactionId ) : Uri { $ uri = $ this -> getUri ( 'terminal' , [ 'merchantId' => $ this -> merchantId , 'transactionId' => $ transactionId ] ) ; return $ uri ; } | Given the transaction ID returns a URI that the user should be redirected to in order to enter their card details for that transaction . |
238,004 | protected function performRequest ( string $ uri ) { $ httpResponse = $ this -> client -> get ( $ uri ) ; Assert :: eq ( $ httpResponse -> getStatusCode ( ) , 200 , 'Request failed.' ) ; $ content = $ httpResponse -> getBody ( ) -> getContents ( ) ; $ xml = simplexml_load_string ( $ content ) ; $ this -> exceptionOnErr... | Performs a request to the provided URI and returns the appropriate response object based on the content of the HTTP response . |
238,005 | protected function getUri ( string $ endpoint , array $ parameters = [ ] ) : Uri { Assert :: keyExists ( self :: ENDPOINTS , $ endpoint , "Named endpoint {$endpoint} is unknown." ) ; $ uri = $ this -> sandbox ? self :: SANDBOX_URL : self :: PRODUCTION_URL ; $ uri .= self :: ENDPOINTS [ $ endpoint ] ; if ( $ parameters ... | Builds a URI based on the named endpoint and provided parameters . The Netaxept API claims to be a REST API but it is not in any way shape or form a REST API . It requires all requests to be GET requests and all parameters to be URLencoded and provided in the query string . About as far away from REST as you can get . |
238,006 | public function getFormattedDate ( int $ dateType , $ date ) : string { if ( $ date == '' ) return '' ; switch ( $ dateType ) { case self :: FORMAT_FULL : $ format = $ this -> language [ 'lan_date_format_full' ] ; break ; case self :: FORMAT_LONG : $ format = $ this -> language [ 'lan_date_format_long' ] ; break ; case... | Returns a date formatted according to a date format specifier . |
238,007 | public function getText ( int $ txtId ) : string { return Abc :: $ DL -> abcBabelCoreTextGetText ( $ txtId , $ this -> language [ 'lan_id' ] ) ; } | Returns the value of a text . |
238,008 | public function getWord ( int $ wrdId ) : string { return Abc :: $ DL -> abcBabelCoreWordGetWord ( $ wrdId , $ this -> language [ 'lan_id' ] ) ; } | Returns the text of a word . |
238,009 | public function popLanguage ( ) : void { array_pop ( $ this -> stack ) ; $ this -> language = $ this -> stack [ count ( $ this -> stack ) - 1 ] ; } | Restores the previous language as the current language . |
238,010 | public function pushLanguage ( int $ lanId ) : void { $ this -> language = Abc :: $ DL -> abcBabelCoreLanguageGetDetails ( $ lanId ) ; array_push ( $ this -> stack , $ this -> language ) ; } | Sets and pushes a new current language . |
238,011 | public function setLanguage ( int $ lanId ) : void { $ this -> language = Abc :: $ DL -> abcBabelCoreLanguageGetDetails ( $ lanId ) ; $ this -> stack [ max ( 0 , count ( $ this -> stack ) - 1 ) ] = $ this -> language ; } | Replaces the current language . |
238,012 | public function getIcon ( ) { if ( ! $ this -> icon ) { return "" ; } return Html :: get ( ) -> image ( $ this -> icon , $ this -> translate ( $ this -> label ) ) ; } | Get HTML image for selected icon |
238,013 | public function getURL ( ) { if ( is_string ( $ this -> url ) ) { return $ this -> url ; } return \ mpf \ WebApp :: get ( ) -> request ( ) -> createURL ( isset ( $ this -> url [ 0 ] ) ? $ this -> url [ 0 ] : 'home' , isset ( $ this -> url [ 1 ] ) ? $ this -> url [ 1 ] : null , ( isset ( $ this -> url [ 2 ] ) && is_arra... | Get string url from array|string input |
238,014 | public function isSelected ( ) { if ( ! is_null ( $ this -> isSelected ) ) return $ this -> isSelected ; if ( is_string ( $ this -> url ) && $ this -> url == \ mpf \ WebApp :: get ( ) -> request ( ) -> getCurrentURL ( ) ) { return true ; } elseif ( is_array ( $ this -> url ) ) { $ controller = isset ( $ this -> url [ 0... | Check if this is the current page . |
238,015 | protected function getModule ( ) { $ module = \ mpf \ WebApp :: get ( ) -> request ( ) -> getModule ( ) ; if ( isset ( $ this -> url [ 2 ] ) && ! is_array ( $ this -> url [ 2 ] ) ) { $ module = $ this -> url [ 2 ] ; } elseif ( isset ( $ this -> url [ 3 ] ) && ! is_array ( $ this -> url [ 3 ] ) ) { $ module = $ this -> ... | Get name of the link module ; |
238,016 | public function isVisible ( ) { if ( ( ! is_array ( $ this -> url ) ) || ( ! $ this -> visible ) ) { return $ this -> visible ; } $ controller = isset ( $ this -> url [ 0 ] ) ? $ this -> url [ 0 ] : 'home' ; $ action = isset ( $ this -> url [ 1 ] ) ? $ this -> url [ 1 ] : null ; if ( false !== strpos ( $ controller , '... | Check if current item is visible or not . |
238,017 | public function format ( PhoneNumber $ phoneNumber , $ format = PhoneNumberFormat :: INTERNATIONAL ) { if ( true === is_string ( $ format ) ) { $ constant = '\libphonenumber\PhoneNumberFormat::' . $ format ; if ( false === defined ( $ constant ) ) { throw new InvalidArgumentException ( 'The format must be either a cons... | Format a phone number . |
238,018 | public function publish ( $ queue , MessageInterface $ message ) { $ message -> setQueue ( $ queue ) ; $ this -> getAdapter ( ) -> publish ( $ queue , $ message ) ; } | Publish a message |
238,019 | public function consumeOne ( MessageInterface $ message ) { $ consumeEvent = new ConsumeEvent ( $ message ) ; try { $ this -> dispatcher -> dispatch ( BarbeQEvents :: PRE_CONSUME , $ consumeEvent ) ; $ message -> start ( ) ; $ this -> messageDispatcher -> dispatch ( $ message -> getQueue ( ) , $ consumeEvent ) ; $ mess... | Dispatches a Message to all interested consumers |
238,020 | public function addConsumer ( $ queue , ConsumerInterface $ consumer , $ priority = 0 ) { $ this -> messageDispatcher -> addListener ( $ queue , array ( $ consumer , 'consume' ) , $ priority ) ; } | Adds a consumer for messages from the given queue name |
238,021 | private static function headers_to_array ( $ headerContent ) { $ headers = array ( ) ; $ arrRequests = explode ( "\r\n\r\n" , $ headerContent ) ; foreach ( explode ( "\r\n" , $ arrRequests [ 0 ] ) as $ i => $ line ) { if ( $ i === 0 ) { $ headers [ 'http_code' ] = $ line ; } else { list ( $ key , $ value ) = explode ( ... | Converts a string containing multiple headers into an array that can be used programatically . |
238,022 | public function exec ( ) { if ( $ response = curl_exec ( $ this -> _ch ) ) { $ header_size = $ this -> getinfo ( CURLINFO_HEADER_SIZE ) ; return array ( 'http_status_code' => $ this -> getinfo ( CURLINFO_HTTP_CODE ) , 'body' => substr ( $ response , $ header_size ) , 'headers' => self :: headers_to_array ( substr ( $ r... | This function should be called after initializing a cURL session and all the options for the session are set |
238,023 | public function parse ( $ className ) { try { $ class = new \ ReflectionClass ( $ className ) ; } catch ( \ ReflectionException $ e ) { return new ClassAnnotations ( $ className , array ( ) , array ( ) , array ( ) ) ; } $ classComment = $ class -> getDocComment ( ) ; $ classAnnotations = $ this -> getCommentAnnotations... | Parse annotations for a class |
238,024 | private function cleanComment ( $ comment ) { $ commentLines = explode ( PHP_EOL , $ comment ) ; for ( $ i = sizeof ( $ commentLines ) - 1 ; $ i >= 0 ; $ i -- ) { $ commentLine = $ commentLines [ $ i ] ; if ( is_numeric ( strpos ( $ commentLine , "/**" ) ) || is_numeric ( strpos ( $ commentLine , "*/" ) ) || preg_match... | Clean a comment |
238,025 | static public function isValid ( $ operator , $ throwException = false ) { $ operator = intval ( $ operator ) ; if ( $ operator > 0 && $ operator <= static :: IS_NOT_NULL ) { return true ; } if ( $ throwException ) { throw new InvalidArgumentException ( 'Unexpected filter operator.' ) ; } return false ; } | Returns whether the operator is valid or not . |
238,026 | static public function getChoices ( array $ operators ) { $ choices = [ ] ; foreach ( $ operators as $ operator ) { $ choices [ static :: getLabel ( $ operator ) ] = $ operator ; } return $ choices ; } | Returns the available operators choices . |
238,027 | private function isPropertyAccessible ( $ propertyName ) { $ result = false ; $ className = get_class ( $ this ) ; $ reflectionService = ReflectionService :: get ( ) ; if ( $ reflectionService -> isClassPropertyAccessible ( $ className , $ propertyName ) ) { $ property = $ reflectionService -> getClassAccessiblePropert... | Returns true if the given property name is accessible for the current instance of this class . |
238,028 | function queryColumn ( $ query ) { $ data = [ ] ; $ res = $ this -> q ( $ query ) ; while ( $ row = $ res -> fetch_row ( ) ) { if ( $ res -> field_count == 1 ) $ data [ ] = $ row [ 0 ] ; else $ data [ $ row [ 0 ] ] = $ row [ 1 ] ; } $ res -> close ( ) ; return $ data ; } | If two fields are queried the first is used as an index . |
238,029 | public function getPageManager ( ) { if ( $ this -> pageManager === null ) { $ this -> pageManager = new PageManager ( $ this ) ; } return $ this -> pageManager ; } | Gets the page manager . |
238,030 | public function getConfig ( ) { if ( $ this -> config === null ) { $ path = $ this -> getInputDirectory ( ) . '/makedocs.json' ; if ( ! is_file ( $ path ) ) { throw new \ RuntimeException ( 'The input directory does not contain a makedocs.json file.' ) ; } $ data = json_decode ( file_get_contents ( $ path ) ) ; if ( ! ... | Gets the configuration of the project to generate the documentation for . |
238,031 | public function generate ( ) { if ( ! is_dir ( $ this -> getInputDirectory ( ) ) ) { throw new \ RuntimeException ( 'The MakeDocs input directory does not exist.' ) ; } if ( ! $ this -> builders ) { throw new \ RuntimeException ( 'No MakeDocs builders present.' ) ; } $ workingDirectory = getcwd ( ) ; chdir ( $ this -> ... | Generates the documentation for all the renderers . |
238,032 | public function cmdGetEvent ( ) { $ result = $ this -> getListEvent ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableEvent ( $ result ) ; $ this -> output ( ) ; } | Callback for event - get command |
238,033 | public function cmdDeleteEvent ( ) { if ( $ this -> getParam ( 'expired' ) ) { $ this -> report -> deleteExpired ( ) ; } else { $ this -> report -> delete ( ) ; } $ this -> output ( ) ; } | Callback for event - delete command |
238,034 | protected function getListEvent ( ) { $ options = array ( 'order' => 'desc' , 'sort' => 'created' , 'limit' => $ this -> getLimit ( ) , 'severity' => $ this -> getParam ( 'severity' ) ) ; return ( array ) $ this -> report -> getList ( $ options ) ; } | Returns an array of events |
238,035 | protected function outputFormatTableEvent ( array $ events ) { $ header = array ( $ this -> text ( 'Text' ) , $ this -> text ( 'Type' ) , $ this -> text ( 'Severity' ) , $ this -> text ( 'Created' ) ) ; $ rows = array ( ) ; foreach ( $ events as $ item ) { $ text = empty ( $ item [ 'translatable' ] ) ? $ item [ 'text' ... | Output events in a table |
238,036 | public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ name = $ this -> getTable ( ) ; $ alias = $ this -> getAlias ( ) ; $ prefix_disabled = $ this -> getDisablePrefixing ( ) ; $ drv = $ params -> getDriver ( ) ; list ( $ tname , $ talias ) = $ params -> resolveTable ( $ name ) ; if ( ! empty ( $ tali... | Write an function as SQL query syntax |
238,037 | public function readFile ( string $ file_name ) { $ data = array ( ) ; $ this -> file_handle = fopen ( $ file_name , "r" ) ; foreach ( $ this as $ row ) $ data [ ] = $ row ; return $ data ; } | Read CSV data from a file |
238,038 | public function readFileHandle ( $ file_handle ) { if ( ! is_resource ( $ file_handle ) ) throw new \ InvalidArgumentException ( "No file handle was provided" ) ; $ data = array ( ) ; $ this -> file_handle = $ file_handle ; foreach ( $ this as $ row ) $ data [ ] = $ row ; return $ data ; } | Read CSV from a stream . |
238,039 | public function readString ( string $ data ) { $ this -> file_handle = fopen ( 'php://temp' , 'rw' ) ; fwrite ( $ this -> file_handle , $ data ) ; $ data = array ( ) ; foreach ( $ this as $ row ) $ data [ ] = $ row ; return $ data ; } | Read CSV from a string . This will write the data to a temporary stream |
238,040 | public function rewind ( ) { rewind ( $ this -> file_handle ) ; $ this -> line_number = 0 ; $ this -> current_line = null ; $ this -> header = null ; } | Rewind the file handle to the start |
238,041 | public function loadJson ( $ filename ) { $ result = false ; if ( file_exists ( $ filename ) && is_file ( $ filename ) ) { $ json = file_get_contents ( $ filename ) ; $ data = json_decode ( $ json , true ) ; if ( is_array ( $ data ) ) { foreach ( $ data as $ name => $ value ) { $ this -> __set ( $ name , $ value ) ; } ... | Load options from filename . json |
238,042 | protected function getDefault ( $ name ) { if ( is_null ( $ this -> _defaultData ) ) { $ subject = $ this -> getSubject ( ) ; if ( ! is_null ( $ subject ) && $ subject instanceof Options_Subject ) { $ this -> _defaultData = $ subject -> getDefaultOptions ( ) ; } else { $ this -> _defaultData = array ( ) ; } } if ( isse... | Return default value |
238,043 | protected function getLocaleFromUrl ( string $ url ) { $ locale = trim ( substr ( $ url , 0 , 3 ) , '/' ) ; if ( strlen ( $ locale ) > 2 || strlen ( $ locale ) < 2 ) { return false ; } return $ locale ; } | Gets the locale out of the url if it s in |
238,044 | protected function isUARouted ( string $ url ) { $ exploded = explode ( '/' , $ url ) ; $ uaRoute = $ exploded [ 0 ] ; $ routingData = $ this -> getParameter ( 'field_cito.routing.user_agent_routing' ) ; foreach ( $ routingData as $ route => $ browsers ) { if ( $ route === $ uaRoute ) { return true ; } } return false ;... | Checks if UserAgent is Routed |
238,045 | protected static function getBrowserData ( $ userAgent ) { $ matches = [ ] ; if ( strpos ( $ userAgent , 'Opera' ) !== false ) { $ browserName = 'Opera' ; preg_match_all ( '/Version\/([\d]+)/' , $ _SERVER [ 'HTTP_USER_AGENT' ] , $ matches ) ; } elseif ( strpos ( $ userAgent , 'OPR/' ) !== false ) { $ browserName = 'Ope... | Gets the browser data |
238,046 | protected function render ( Template $ template ) { $ presenter = $ this -> createPresenter ( $ template -> getPresenter ( ) ) ; try { $ arguments = $ this -> getArguments ( $ presenter , $ template ) ; $ this -> logger -> debug ( $ arguments ) ; $ result = call_user_func_array ( $ presenter , $ arguments ) ; } catch (... | Loads a presenter calls its method and returns the result . |
238,047 | protected function createPresenter ( $ presenter ) { if ( false === strpos ( $ presenter , '::' ) ) { throw new TemplateEngineException ( sprintf ( 'Presenter must be in the format class|service::method' , $ presenter ) ) ; } list ( $ class , $ method ) = explode ( '::' , $ presenter , 2 ) ; $ presenter = $ this -> app... | Returns a callable for the given presenter . |
238,048 | public function generate ( $ length ) { $ realPool = $ this -> mergePools ( $ this -> characterPools ) ; $ max = ( count ( $ realPool ) - 1 ) ; mt_srand ( ) ; $ randomString = '' ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ randomString .= $ realPool [ mt_rand ( 0 , $ max ) ] ; } return $ randomString ; } | Generates a random string with the given length based on the character pools . |
238,049 | protected function mergePools ( $ pools ) { $ mergedPool = [ ] ; foreach ( $ pools as $ pool ) { foreach ( $ pool -> getCharacters ( ) as $ character ) { $ mergedPool [ ] = $ character ; } } return $ mergedPool ; } | Merges all characters from the registered pools into one array . |
238,050 | protected function _validateParams ( $ args , $ spec ) { $ errors = $ this -> _getArgsListErrors ( $ args , $ spec ) ; if ( $ this -> _countIterable ( $ errors ) ) { throw $ this -> _createValidationFailedException ( null , null , null , null , $ args , $ errors ) ; } } | Validates a function or method s arguments according to the method s parameter specification . |
238,051 | public static function construct ( $ minMatches = .7 , $ maxDistance = .2 ) { $ fuzzy = new static ( ) ; $ fuzzy -> minMatches = $ minMatches ; $ fuzzy -> maxDistance = $ maxDistance ; return $ fuzzy ; } | Creates a new instance of NyaaMatcher \ Fuzzy |
238,052 | public function calculatePrecedence ( ) { $ this -> precedence = 0 ; if ( ! $ this -> hasContextRules ( ) ) { return ; } foreach ( $ this -> context as $ token_name => $ rules ) { foreach ( $ rules as $ context_key => $ rule_key ) { if ( $ rule_key == "other" ) $ this -> precedence += 1 ; } } } | the precedence is based on the number of fallback rules in the context . a fallback rule is indicated by the keyword other the more others are used the lower the precedence will be |
238,053 | public function scanDirectory ( string $ path ) : array { $ files = [ ] ; $ rdi = new \ RecursiveDirectoryIterator ( $ path , \ FilesystemIterator :: SKIP_DOTS | \ FilesystemIterator :: KEY_AS_FILENAME | \ FilesystemIterator :: CURRENT_AS_FILEINFO ) ; $ rii = new \ RecursiveIteratorIterator ( $ rdi ) ; foreach ( $ rii ... | Scans the given directory and its sub - directories and returns a list of all the files |
238,054 | public function markdownToText ( string $ markdown ) : string { if ( empty ( $ markdown ) ) { return '' ; } $ pattern = array ( '/(\.|)#/' , '/(\.|)\*/' , '/(\.|)~/' ) ; return preg_replace ( $ pattern , '' , $ markdown ) ; } | Strips the given text of the markdown but not \ n . |
238,055 | public function startswith ( string $ haystack , string $ needle ) : bool { return ( substr ( $ haystack , 0 , strlen ( $ needle ) ) === $ needle ) ; } | String startswith . |
238,056 | public function endswith ( string $ haystack , string $ needle ) : bool { return ( substr ( $ haystack , - 1 * strlen ( $ needle ) ) === $ needle ) ; } | String endswith . |
238,057 | function getSource ( $ name ) { if ( isset ( $ this -> site -> pages [ $ name ] ) ) { $ content = $ this -> site -> pages [ $ name ] ; } else { throw new \ Exception ( "Cannot find content \"$name\"." ) ; } if ( ! $ content -> template ) { throw new \ Exception ( "Content does not have a template" ) ; } if ( $ content ... | Generates the template for a given page path . |
238,058 | public function write ( Iterator $ dataIterator ) { $ this -> initialize ( ) ; foreach ( $ dataIterator as $ item ) { $ this -> writeItem ( $ item ) ; } $ this -> finish ( ) ; } | Write the feed . |
238,059 | public function validateIdentity ( $ attributes , $ params ) { $ metadata = UserMetadata :: model ( ) -> findByAttributes ( array ( 'key' => $ this -> provider . 'Provider' , 'value' => $ this -> adapter -> identifier ) ) ; if ( $ metadata == NULL ) { $ this -> addError ( 'adapter' , Yii :: t ( 'HybridAuth.main' , 'Una... | Validates that we have an identity on file for this user |
238,060 | public function login ( ) { if ( ! $ this -> authenticate ( ) ) return false ; if ( $ this -> _identity -> errorCode === RemoteUserIdentity :: ERROR_NONE ) { Yii :: app ( ) -> user -> logout ( ) ; return Yii :: app ( ) -> user -> login ( $ this -> _identity , 3600 * 24 ) ; } else return false ; } | Logins the user in using their Remote user information |
238,061 | public function roles ( ) : BelongsToMany { $ pivotTable = config ( 'lia.database.role_users_table' ) ; $ relatedModel = config ( 'lia.database.roles_model' ) ; return $ this -> belongsToMany ( $ relatedModel , $ pivotTable , 'user_id' , 'role_id' ) ; } | A user has and belongs to many roles . |
238,062 | public function permissions ( ) : BelongsToMany { $ pivotTable = config ( 'lia.database.user_permissions_table' ) ; $ relatedModel = config ( 'lia.database.permissions_model' ) ; return $ this -> belongsToMany ( $ relatedModel , $ pivotTable , 'user_id' , 'permission_id' ) ; } | A User has and belongs to many permissions . |
238,063 | public function register ( $ method , $ url , $ action ) { if ( in_array ( $ method , $ this -> _methods ) ) { if ( is_array ( $ action ) ) { if ( ! empty ( $ action ) ) { $ exp = explode ( '@' , $ action [ 'uses' ] ) ; $ this -> _routes [ ] = [ 'controller' => $ exp [ 0 ] , 'action' => $ exp [ 1 ] , 'method' => $ meth... | Registers each route . |
238,064 | public static function make ( $ uri , array $ queryParameters = [ ] ) { $ uri = ( $ uri instanceof UriInterface ) ? $ uri : new Uri ( $ uri ) ; if ( $ queryParameters ) { $ uri = static :: addQueryParameters ( $ uri , $ queryParameters ) ; } return $ uri ; } | Makes PSR - 7 compliant Uri object |
238,065 | protected function execLoginForm ( ) { $ this -> loadTranslations ( 'form' , sprintf ( 'private/global/locales/%s/form.ini' , LANGUAGE ) ) ; $ this -> templateParameters [ 'translations' ] = $ this -> translations ; $ this -> renderTemplate ( ) ; } | displays login form |
238,066 | private function getUserData ( ) { $ auth = $ this -> authFactory -> newInstance ( ) ; return null !== $ auth -> getUserData ( ) ? $ auth -> getUserData ( ) : false ; } | gets current user |
238,067 | private function setUserData ( $ property , $ value ) { $ auth = $ this -> authFactory -> newInstance ( ) ; $ userData = $ auth -> getUserData ( ) ; if ( ! $ userData ) { return ; } $ userData [ $ property ] = $ value ; $ auth -> setUserData ( $ userData ) ; } | Sets a property for current user |
238,068 | private function hasUniqueConstraint ( ClassMetadata $ metadata , array $ columns ) { if ( ! isset ( $ metadata -> table [ 'uniqueConstraints' ] ) ) { return false ; } foreach ( $ metadata -> table [ 'uniqueConstraints' ] as $ constraint ) { if ( ! array_diff ( $ constraint [ 'columns' ] , $ columns ) ) { return true ;... | Check if an unique constraint has been defined . |
238,069 | public function postLoad ( LifecycleEventArgs $ args ) { $ entity = $ args -> getEntity ( ) ; if ( ! $ entity instanceof TranslatableInterface ) { return ; } $ entity -> initializeTranslations ( ) ; $ entity -> setCurrentLocale ( $ this -> localeProvider -> getCurrentLocale ( ) ) ; $ entity -> setFallbackLocale ( $ thi... | Translatable post load event handler . |
238,070 | public function onTranslatablePreFlush ( TranslatableInterface $ translatable , PreFlushEventArgs $ event ) { if ( null === $ config = $ this -> registry -> findConfiguration ( $ translatable , false ) ) { return ; } $ accessor = $ this -> getPropertyAccessor ( ) ; foreach ( $ translatable -> getTranslations ( ) as $ t... | Translatable pre flush event handler . |
238,071 | public function onMenuConfigure ( ConfigureMenuEvent $ event ) { if ( $ this -> permissionResolver -> hasAccess ( 'uisites' , 'read' ) ) { $ menu = $ event -> getMenu ( ) ; $ menu -> addChild ( self :: ITEM_SITES , [ ] ) ; } } | Add Sites entry menu . |
238,072 | protected function composeViews ( ) { View :: composer ( 'app' , function ( $ view ) { $ view -> getFactory ( ) -> inject ( 'account' , view ( 'user::menu' , [ 'guest' => Auth :: guest ( ) , 'user' => Auth :: user ( ) ] ) ) ; } ) ; View :: composer ( 'admin' , function ( $ view ) { $ view -> getFactory ( ) -> inject ( ... | composes admin views . |
238,073 | public function splitName ( $ name , $ firstOrSurname = "surname" ) { $ name = trim ( $ name ) ; $ positionOfFinalSpace = strrpos ( $ name , " " ) ; if ( $ firstOrSurname == "surname" ) { return substr ( $ name , $ positionOfFinalSpace + 1 , strlen ( $ name ) ) ; } return substr ( $ name , 0 , $ positionOfFinalSpace ) ... | First name and surnames are combined during registration . Split em and return either the first name or the suranme |
238,074 | private function setDefaultLocale ( $ lang ) { if ( $ lang === null ) { $ this -> defaultLanguage = $ this -> languages [ 0 ] ; return ; } if ( ! $ this -> hasLocale ( $ lang ) ) { if ( ! is_string ( $ lang ) ) { $ lang = is_object ( $ lang ) ? get_class ( $ lang ) : gettype ( $ lang ) ; } throw new InvalidArgumentExce... | Set the default language . |
238,075 | public function setCurrentLocale ( $ lang ) { if ( $ lang === null ) { $ this -> currentLanguage = null ; return ; } if ( ! $ this -> hasLocale ( $ lang ) ) { if ( ! is_string ( $ lang ) ) { $ lang = is_object ( $ lang ) ? get_class ( $ lang ) : gettype ( $ lang ) ; } throw new InvalidArgumentException ( sprintf ( 'Uns... | Set the current language . |
238,076 | private function setLocales ( array $ locales ) { $ locales = $ this -> filterLocales ( $ locales ) ; uasort ( $ locales , [ $ this , 'sortLocalesByPriority' ] ) ; $ this -> locales = [ ] ; $ this -> languages = [ ] ; foreach ( $ locales as $ langCode => $ locale ) { $ this -> locales [ $ langCode ] = $ locale ; $ this... | Set the available languages . |
238,077 | private function filterLocales ( array $ locales ) { $ z = self :: DEFAULT_SORT_PRIORITY ; $ filteredLocales = [ ] ; foreach ( $ locales as $ langCode => $ locale ) { if ( isset ( $ locale [ 'active' ] ) && ! $ locale [ 'active' ] ) { continue ; } if ( ! isset ( $ locale [ 'priority' ] ) ) { $ locale [ 'priority' ] = $... | Filter the available languages . |
238,078 | private function tokenize ( ) { $ this -> tokenizeTitle ( ) ; $ this -> tokenizeFields ( ) ; $ this -> tokenizeBricks ( ) ; $ this -> tokenizeDynamicBricks ( ) ; $ this -> tokenVector = array_filter ( $ this -> tokenVector ) ; arsort ( $ this -> tokenVector ) ; } | Execute tokenization of all document fields |
238,079 | private function addTokenToVector ( $ token , $ field , $ count = 1 ) { if ( ! empty ( $ token ) ) { if ( isset ( $ this -> tokenVector [ $ field ] [ $ token ] ) ) { $ this -> tokenVector [ $ field ] [ $ token ] += $ count ; } else { $ this -> tokenVector [ $ field ] [ $ token ] = $ count ; } } } | Add a token to the existing tokenvector |
238,080 | private function addTokenVectorToVector ( $ tokenVector , $ field ) { foreach ( $ tokenVector as $ token => $ count ) { $ this -> addTokenToVector ( $ token , $ field , $ count ) ; } } | Add a complete token vector to the existing one . |
238,081 | private function getFieldType ( $ fieldName , $ documentDefinition ) { foreach ( $ documentDefinition -> fields as $ fieldTypeDefinition ) { if ( $ fieldTypeDefinition -> slug === $ fieldName ) { return $ fieldTypeDefinition -> type ; } } throw new \ Exception ( 'Unknown field type for field' . $ fieldName . ' in docum... | Get the type for a field |
238,082 | public function isDifferentEmail ( ExecutionContextInterface $ context ) { if ( $ this -> getEmail ( ) == $ this -> getFrom ( ) -> getEmail ( ) ) { $ context -> buildViolation ( 'You can\'t invite yourself!' ) -> atPath ( 'email' ) -> addViolation ( ) ; } } | Callback to check the if is a different email from it self |
238,083 | final protected static function callErrorLogger ( $ level , $ message ) { if ( is_null ( static :: $ errorLoggerInstance ) ) { static :: $ errorLoggerInstance = new self ; } static :: $ errorLoggerInstance -> { static :: $ errorLoggerInstance -> errorToLogLevel ( $ level ) } ( $ message ) ; } | Passes the error to logger as an exception converting error level to Logger level . |
238,084 | public function setLogLevel ( $ logLevel ) { if ( ! is_string ( $ logLevel ) || '' === ( $ level = strtolower ( $ logLevel ) ) || ! isset ( $ this -> levelMap [ $ level ] ) ) { throw new \ InvalidArgumentException ( sprintf ( '%s - Log level must be one of the following values: ["%s"]. %s seen.' , get_called_class ( )... | setLogLevel will limit what is written to a level greater than or equal to value passed in . |
238,085 | protected function tryLog ( $ msg , $ tries = 0 ) { if ( ( bool ) @ fwrite ( $ this -> stream , $ msg ) ) return ; if ( 0 < $ tries ) { trigger_error ( sprintf ( '%s - Unable to log message: "%s"' , get_called_class ( ) , $ tries , $ msg ) ) ; return ; } $ this -> attemptStreamRecovery ( ) ; $ this -> tryLog ( $ msg , ... | tryLog will attempt to write output to local stream . If unable will kick - off re - open attempt |
238,086 | protected function attemptStreamRecovery ( ) { if ( 'resource' === gettype ( $ this -> stream ) ) { @ fflush ( $ this -> stream ) ; @ fclose ( $ this -> stream ) ; } $ this -> stream = fopen ( $ this -> streamURI , $ this -> streamMode ) ; if ( false === $ this -> stream ) { trigger_error ( sprintf ( '%s - Unable to wr... | Will attempt to re - open stream in the event that it was closed unexpectedly . Will use default if unable to re - open custom |
238,087 | protected function insertEntry ( MenuEntry $ entry , $ ndx = NULL ) { if ( $ entry instanceof DynamicMenuEntry ) { $ this -> dynamicEntries [ ] = $ entry ; } if ( ! isset ( $ ndx ) || $ ndx >= count ( $ this -> entries ) ) { $ this -> entries [ ] = $ entry ; } else { array_splice ( $ this -> entries , $ ndx , 0 , [ $ e... | insert or append menu entry |
238,088 | public function insertEntries ( array $ entries , $ ndx ) { foreach ( $ entries as $ e ) { $ this -> insertEntry ( $ e , $ ndx ++ ) ; } return $ this ; } | insert or append several MenuEntry objects |
238,089 | public function insertBeforeEntry ( MenuEntry $ new , MenuEntry $ pos ) { foreach ( $ this -> entries as $ k => $ e ) { if ( $ e === $ pos ) { $ this -> insertEntry ( $ new , $ k ) ; break ; } } return $ this ; } | insert a MenuEntry before an existing MenuEntry |
238,090 | public function replaceEntry ( MenuEntry $ new , MenuEntry $ toReplace ) { foreach ( $ this -> entries as $ k => $ e ) { if ( $ e === $ toReplace ) { $ this -> insertEntry ( $ new , $ k ) ; $ this -> removeEntry ( $ toReplace ) ; break ; } } return $ this ; } | replace a MenuEntry by another one |
238,091 | public function removeEntry ( MenuEntry $ toRemove ) { foreach ( $ this -> entries as $ k => $ e ) { if ( $ e === $ toRemove ) { array_splice ( $ this -> entries , $ k , 1 ) ; if ( $ toRemove instanceof DynamicMenuEntry ) { $ ndx = array_search ( $ toRemove , $ this -> dynamicEntries , TRUE ) ; if ( $ ndx !== FALSE ) {... | remove a MenuEntry |
238,092 | public function isSecondaryLocal ( ) { if ( ! $ this -> isSecondary ( ) ) { return false ; } $ hashKey = $ this -> getHashKey ( ) -> getPropertyMetadata ( ) -> name ; $ hashKeyPrimary = $ this -> class -> getIndex ( ) -> getHashKey ( ) -> getPropertyMetadata ( ) -> name ; return $ hashKey === $ hashKeyPrimary ; } | Is this a local secondary index? |
238,093 | static function LastPageModLog ( Page $ page , Interfaces \ IContainerReferenceResolver $ resolver ) { $ lastLog = self :: LastPageLog ( $ page ) ; $ pageContents = PageContent :: Schema ( ) -> FetchByPage ( false , $ page ) ; foreach ( $ pageContents as $ pageContent ) { $ content = $ pageContent -> GetContent ( ) ; $... | Gets the last page modification log item |
238,094 | static function LastContainerModLog ( Container $ container ) { $ lastLog = self :: LastContainerLog ( $ container ) ; $ containerContents = ContainerContent :: Schema ( ) -> FetchByContainer ( false , $ container ) ; foreach ( $ containerContents as $ containerContent ) { $ content = $ containerContent -> GetContent (... | Gets the last container modification log item |
238,095 | static function LastLayoutModLog ( Layout $ layout ) { $ lastLog = $ this -> LastLayoutLog ( $ layout ) ; $ areas = Area :: Schema ( ) -> FetchByLayout ( false , $ layout ) ; foreach ( $ areas as $ area ) { $ areaLog = self :: LastAreaModLog ( $ area ) ; if ( self :: IsAfter ( $ areaLog , $ lastLog ) ) { $ lastLog = $ ... | Gets the last layout modification log item |
238,096 | static function LastAreaModLog ( Area $ area , Interfaces \ IContainerReferenceResolver $ resolver ) { $ lastLog = $ this -> LastAreaLog ( $ area ) ; $ areaContents = LayoutContent :: Schema ( ) -> FetchByArea ( false , $ area ) ; foreach ( $ areaContents as $ areaContent ) { $ content = $ areaContent -> GetContent ( )... | Gets the last area modification log item |
238,097 | function LastContentModLog ( Content $ content , Interfaces \ IContainerReferenceResolver $ resolver = null ) { $ lastLog = self :: LastContentLog ( $ content ) ; $ container = $ resolver ? $ resolver -> GetReferencedContainer ( $ content ) : null ; if ( $ container ) { $ containerLog = self :: LastContainerModLog ( $ ... | Gets the last content modification log item |
238,098 | static function IsAfter ( LogItem $ lhs = null , LogItem $ rhs = null ) { if ( ! $ lhs ) { return false ; } if ( ! $ rhs ) { return true ; } return $ lhs -> GetChanged ( ) -> IsAfter ( $ rhs -> GetChanged ( ) ) ; } | Compares two log item by date |
238,099 | static function LastPageLog ( Page $ page ) { $ tblLogPage = LogPage :: Schema ( ) -> Table ( ) ; $ tblLogItem = LogItem :: Schema ( ) -> Table ( ) ; $ sql = Access :: SqlBuilder ( ) ; $ orderBy = $ sql -> OrderList ( $ sql -> OrderDesc ( $ tblLogItem -> Field ( 'Changed' ) ) ) ; $ joinCond = $ sql -> Equals ( $ tblLog... | The last log item that is directly related to the page |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.