idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
4,700 | protected function update ( IEvent $ event ) { $ statement = $ this -> connection -> prepare ( 'UPDATE ' . $ this -> table . ' SET response = :response, SET latency = :latency WHERE id = :id' ) ; $ statement -> execute ( [ ':id' => $ event -> getId ( ) , ':response' => $ event -> getResponse ( ) , ':latency' => $ event... | Update event . |
4,701 | public static function Ldsun ( array $ p , array $ e , $ em , array & $ p1 ) { IAU :: Ld ( 1.0 , $ p , $ p , $ e , $ em , 1e-9 , $ p1 ) ; } | - - - - - - - - - i a u L d s u n - - - - - - - - - |
4,702 | private function displayBindings ( ) { $ bindings = array ( ) ; foreach ( $ this -> bindings as $ binding ) { if ( is_object ( $ binding ) ) { $ bindings [ ] = get_class ( $ binding ) ; } else { $ bindings [ ] = ( string ) $ binding ; } } return implode ( ',' , $ bindings ) ; } | Special not PDO function to format display of query bindings . |
4,703 | protected function createFromGlobals ( ) { if ( php_sapi_name ( ) === 'cli' ) { throw new InvalidStateException ( 'Requests can not be instantiated from globals in CLI mode' ) ; } $ method = HttpMethod :: memberByKey ( $ _SERVER [ 'REQUEST_METHOD' ] , false ) ; $ uri = strtok ( $ _SERVER [ 'REQUEST_URI' ] , '?' ) ; $ h... | Sets all fields on this request object to the globals from PHP |
4,704 | private function normalizePriority ( $ priority ) { if ( is_numeric ( $ priority ) ) { $ priority = round ( floatval ( $ priority ) , 1 ) ; if ( 0 <= $ priority && 1 >= $ priority ) { return $ priority ; } } return null ; } | Normalize priority . |
4,705 | protected function setUser ( ) { if ( ! empty ( $ this -> getSiteConfig ( ) [ 'USER_CLASS' ] ) ) { $ className = "{$this->getSiteConfig()['NAMESPACE_APP']}Classes\\Data\\{$this->getSiteConfig()['USER_CLASS']}" ; if ( class_exists ( $ className ) ) { $ this -> setGlobalUser ( new $ className ( ) ) ; } else { $ this -> g... | Associates the session User with CoreSite |
4,706 | protected function getCachedDataRepository ( $ repositoryName ) { return array_key_exists ( $ repositoryName , $ this -> cachedDataRepositories ) ? $ this -> cachedDataRepositories [ $ repositoryName ] : null ; } | Fetch a DataRepository from the cache by its name |
4,707 | public function getHelper ( $ helperName ) { $ helper = $ this -> getCachedHelper ( $ helperName ) ; if ( ! $ helper ) { foreach ( array ( $ this -> getSiteConfig ( ) [ 'NAMESPACE_APP' ] , $ this -> getSiteConfig ( ) [ 'NAMESPACE_CORE' ] ) as $ classPath ) { $ className = "{$classPath}Classes\\Helpers\\{$helperName}" ;... | Fetch a Helper from the cache by its name |
4,708 | public static function build ( $ file , $ searchPath ) { $ builder = self :: getInstance ( ) ; $ searchPath = empty ( $ searchPath ) ? __DIR__ : $ searchPath ; $ searchPath = ( array ) $ searchPath ; $ builder -> setFile ( $ file ) ; $ builder -> readMap ( ) ; foreach ( $ searchPath as $ folder ) { $ files = $ builder ... | Build result map in provided path and write result to file |
4,709 | public function pushResult ( $ class ) { if ( ! $ this -> hasResult ( $ class ) ) { $ this -> map [ $ class ] = empty ( $ this -> map ) ? 1 : max ( self :: getResults ( ) ) + 1 ; } } | Add new result class to map . If file is empty begin numeration from index 1 . Zero index reserved for \ Result \ ResultException |
4,710 | public function save ( ) { $ results = "<?php \n return " . var_export ( self :: getResults ( ) , true ) . ";" ; file_put_contents ( $ this -> file , $ results ) ; } | Save result map to file |
4,711 | public function readMap ( ) { $ fileData = include $ this -> file ; $ this -> map = ! is_array ( $ fileData ) ? $ this -> map : $ fileData ; } | Reads result map from file |
4,712 | public function authenticate ( $ provider , $ code = False ) { if ( $ code ) { return $ this -> handleProviderCallback ( $ provider ) ; } return $ this -> redirectToProvider ( $ provider ) ; } | it authenticate user |
4,713 | private function findOrCreateUser ( $ providerUser ) { if ( $ user = $ this -> userRepo -> findBy ( 'email' , $ providerUser -> getEmail ( ) ) ) { return $ user ; } return $ this -> userRepo -> create ( [ 'username' => $ providerUser -> getNickname ( ) , 'email' => $ providerUser -> getEmail ( ) , ] ) ; } | Return user if exists ; create and return if doesn t |
4,714 | public function general ( ) { $ keys = [ 'instance_name' , 'instance_short_name' , 'html_title_suffix' , 'Login__Message__show' , 'Login__Message__text' , 'Login__Message__class' , 'Login__HeartBeat__max_login_time' , 'Email__email_sender_name' , 'Email__email_sender' , 'Auth__max_login_attempts' , 'Auth__failed_login_... | General action GET | POST |
4,715 | public function cache ( ) { $ keys = [ 'enable_caching' , 'cache_duration' ] ; $ this -> CacheSettings = $ this -> loadModel ( 'Wasabi/Core.CacheSettings' ) ; $ settings = $ this -> CacheSettings -> getKeyValues ( new CacheSetting ( ) , $ keys ) ; if ( $ this -> request -> is ( 'post' ) && ! empty ( $ this -> request -... | Cache action GET | POST |
4,716 | public static function buildContainer ( ) : Container { if ( self :: $ container !== null ) { return self :: $ container ; } $ factory = new ContainerBuilder ( ) ; $ factory -> useAnnotations ( true ) ; if ( ( new ContextHelper ( ) ) -> isProduction ( ) ) { $ factory -> enableDefinitionCache ( ) ; if ( ! is_dir ( MELIO... | Builds up the dependency container . |
4,717 | public static function fetchDependency ( string $ dependency ) { $ container = self :: buildContainer ( ) ; if ( $ container -> has ( $ dependency ) ) { return $ container -> get ( $ dependency ) ; } return null ; } | Fetch a dependency directly from the container . |
4,718 | public function matchRequest ( ServerRequest $ request ) { return $ this -> getMatchRoute ( $ request -> getMethod ( ) , $ this -> getUrl ( $ request ) ) ; } | Match request with provided routes . Get method and url from provided request and start matching . |
4,719 | public function setUrlFormat ( string $ urlFormat ) : Matcher { if ( RouteMode :: inEnum ( $ urlFormat ) ) { $ this -> urlFormat = $ urlFormat ; return $ this ; } throw new InvalidArgumentException ( 'Value of urlFormat must be from RouteMode enum.' ) ; } | Set format for URL resolving . If the path mode is set to a path a web server must be properly configurated defualt value is PATH_FORMAT . |
4,720 | private function getMatchRoute ( string $ method , string $ url ) { $ parsedRoutes = $ this -> parseRoutes ( $ this -> routeCollection ) ; foreach ( $ parsedRoutes as $ singleParsedRoute ) { list ( $ routeRegex , $ route ) = $ singleParsedRoute ; $ matchedParameters = $ this -> routeMatch ( $ routeRegex , $ url ) ; if ... | Match method and route with provided routes . If route and method match a route is dispatch using provided dispatcher . |
4,721 | private function routeMatch ( string $ routeRegex , string $ route ) { $ matches = [ ] ; if ( preg_match ( $ routeRegex , $ route , $ matches ) ) { unset ( $ matches [ 0 ] ) ; return array_values ( $ matches ) ; } return false ; } | Match route by provided regex . |
4,722 | private function parseRoutes ( Collection $ routes ) : array { $ parsedRoutes = [ ] ; foreach ( $ routes as $ route ) { $ routeUrl = strtr ( $ route -> getUrl ( ) , $ this -> regexShortcuts ) ; list ( $ routeRegex , $ parameters ) = $ this -> transformRoute ( $ routeUrl ) ; $ parsedRoute = new Parsed ( $ route ) ; $ pa... | Prepare regex and parameters for each of routes . |
4,723 | private function getUrl ( $ request ) : string { if ( $ this -> urlFormat === RouteMode :: PATH_FORMAT ) { return $ request -> getUri ( ) -> getPath ( ) ; } $ queryParams = $ request -> getQueryParams ( ) ; $ route = '' ; if ( isset ( $ queryParams [ $ this -> modeRewriteParameter ] ) ) { $ route = $ queryParams [ $ th... | Get route from request object . Method expect an instance of PSR 7 compatible request object . |
4,724 | private function extractVariableRouteParts ( string $ route ) : array { $ matches = [ ] ; preg_match_all ( self :: VARIABLE_REGEX , $ route , $ matches , PREG_OFFSET_CAPTURE | PREG_SET_ORDER ) ; return $ matches ; } | Extract variables from the route |
4,725 | public function dispatch ( ServerRequest $ request , array $ parameters = [ ] ) { $ matchedRoute = $ this -> matcher -> matchRequest ( $ request ) ; if ( $ matchedRoute !== false ) { return $ this -> dispatcher -> dispatchRoute ( $ matchedRoute , $ parameters ) ; } return $ this -> dispatcher -> dispatchNotFound ( ) ; ... | Match request with provided routes . |
4,726 | protected function prepareOffset ( int $ offset , int $ total ) : int { if ( $ offset < - $ total || $ offset > $ total - 1 ) { $ message = sprintf ( 'Offset (%d) out of range[%d, %d]' , $ offset , - $ total , $ total - 1 ) ; throw new DomainException ( $ message ) ; } if ( $ offset < 0 ) { $ offset += $ total ; } retu... | Normalizes and validates an offset |
4,727 | protected function prepareLength ( int $ length , int $ offset , int $ total ) : int { $ remainder = $ total - $ offset ; if ( $ length === 0 ) { return $ remainder ; } if ( $ length < 0 ) { if ( ( $ length + $ remainder ) < 0 ) { $ message = sprintf ( 'Length (%d) out of range[%d, %d]' , $ length , - $ remainder , $ r... | Normalizes and validates a length |
4,728 | protected function prepareLengthFromStop ( int $ stop , int $ offset , int $ total ) : int { $ remainder = $ total - $ offset ; if ( $ stop === 0 ) { return $ remainder ; } if ( $ stop > 0 ) { $ length = $ stop - $ offset ; } else { $ length = ( $ total + $ stop ) - $ offset ; } if ( $ length < 0 ) { $ message = sprint... | Normalizes and validates a length from an offset and stop |
4,729 | protected function getFilesFromBrokenMap ( ) { $ mapParts = array_filter ( $ this -> brokenMap ) ; $ this -> codeFrames = array_values ( array_map ( function ( $ frame ) { if ( count ( $ frame ) === 3 ) { [ $ file , $ linesOfCode , $ line ] = $ frame ; } if ( ! $ this -> isValidFile ( $ file ) ) { return new Codeframe ... | Convert the frame into a CodeFrame which includes relative code . |
4,730 | protected function getTheCodeFromTheFile ( string $ file , int $ lineNumber , int $ currentLine = 0 ) : array { $ handle = fopen ( $ file , "r" ) ; $ linesOfCode = [ ] ; while ( ! feof ( $ handle ) ) { $ currentLine ++ ; $ line = fgets ( $ handle ) ; if ( $ line === false ) { break ; } if ( ( $ currentLine - $ lineNumb... | This searches the file we pass through for both the count of the lines in the file and the lines of code surrounding that which broke . |
4,731 | protected function breakUpTheStacks ( ) { $ this -> brokenStackTrace = explode ( "\n" , $ this -> stacktrace ) ; $ stack = array_values ( array_filter ( $ this -> brokenStackTrace , function ( $ input ) { return stripos ( $ input , '#' ) !== false ; } ) ) ; $ newMessage = array_values ( array_filter ( array_diff ( $ th... | We need to parse the lines that have a file in them the lines that don t have a file in them and a stack trace message . |
4,732 | protected function isValidFile ( $ file ) : bool { if ( empty ( $ file ) ) { return false ; } if ( ! file_exists ( $ file ) ) { return false ; } if ( ! is_readable ( $ file ) ) { return false ; } return true ; } | See if the file is empty if it exists or if it s readable . |
4,733 | private function createPronounceable ( $ length ) { $ retVal = '' ; $ v = array ( 'a' , 'e' , 'i' , 'o' , 'u' , 'ae' , 'ou' , 'io' , 'ea' , 'ou' , 'ia' , 'ai' , ) ; $ c = array ( 'b' , 'c' , 'd' , 'g' , 'h' , 'j' , 'k' , 'l' , 'm' , 'n' , 'p' , 'r' , 's' , 't' , 'u' , 'v' , 'w' , 'tr' , 'cr' , 'fr' , 'dr' , 'wr' , 'pr'... | Create pronounceable password . |
4,734 | private function createUnpronounceable ( $ length , $ chars ) { $ password = '' ; switch ( $ chars ) { case 'alphanumeric' : $ chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ; $ numberOfPossibleCharacters = 62 ; break ; case 'alphabetical' : $ chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmno... | Create unpronounceable password . |
4,735 | public function & SetId ( $ id ) { $ this -> id = $ id ; self :: $ instances [ $ id ] = & $ this ; return $ this ; } | Set form id required to configure . Used to identify session data error messages CSRF tokens html form attribute id value and much more . |
4,736 | public function & SetCssClasses ( $ cssClasses ) { $ cssClassesArr = gettype ( $ cssClasses ) == 'array' ? $ cssClasses : explode ( ' ' , ( string ) $ cssClasses ) ; $ this -> cssClasses = $ cssClassesArr ; return $ this ; } | Set form HTML element css classes strings . All previously defined css classes will be removed . Default value is an empty array to not render HTML class attribute . You can define css classes as single string more classes separated by space or you can define css classes as array with strings . |
4,737 | public static function make ( array $ serverParams = null , array $ cookieParams = null , array $ queryParams = null , array $ uploadedFiles = null , array $ attributes = null , $ parsedBody = null , $ body = null , array $ headers = null , $ uri = null , $ method = null , $ protocol = null ) { $ cookies = $ cookiePara... | Makes the instance of Server Request . |
4,738 | public function getLabel ( $ short = false ) { if ( ! $ this -> label ) { $ this -> label = $ this -> generateLabel ( ) ; if ( $ this -> hasShortLabel ( ) ) { $ this -> label_short = $ this -> generateLabelShort ( ) ; } } return $ short ? $ this -> label_short : $ this -> label ; } | Get Property label |
4,739 | private function getEventInfo ( array $ am_eventInfo ) { if ( ! array_key_exists ( 'target' , $ am_eventInfo ) ) { $ am_eventInfo [ 'target' ] = '*' ; } $ s_target = $ am_eventInfo [ 'target' ] ; if ( ! array_key_exists ( 'event' , $ am_eventInfo ) ) { $ am_eventInfo [ 'event' ] = '*' ; } $ s_event = $ am_eventInfo [ '... | Support function extracting configuration event information |
4,740 | public function expiresAfter ( $ time ) { $ this -> expiration = new \ DateTime ( ) ; if ( is_int ( $ time ) ) { if ( $ time < 0 ) { $ time = new \ DateInterval ( 'PT' . abs ( $ time ) . 'S' ) ; $ time -> invert = 1 ; } else { $ time = new \ DateInterval ( 'PT' . $ time . 'S' ) ; } } $ this -> expiration -> add ( $ tim... | Set expiration time for cookie . |
4,741 | public function charAt ( $ index ) { $ index = $ index - 1 ; $ chars = $ this -> chars ( ) ; $ char = ( isset ( $ chars [ $ index ] ) ) ? $ chars [ $ index ] : '' ; return $ this -> createClone ( $ char ) ; } | Determines that character exist in the given position If the character is a whitespace this function will return TRUE to indicate that index is part of the string |
4,742 | public function substring ( $ start , $ length = NULL ) { if ( $ length === NULL ) { $ newValue = mb_substr ( $ this -> string , $ start ) ; } else { $ newValue = mb_substr ( $ this -> string , $ start , $ length ) ; } return $ this -> createClone ( $ newValue ) ; } | Returns the defined part of the current string |
4,743 | public function first ( $ charCount ) { if ( $ charCount <= 0 ) { return $ this -> createClone ( '' ) ; } $ newValue = $ this -> substring ( 0 , ( int ) $ charCount ) ; return $ this -> createClone ( $ newValue ) ; } | Returns the firs X character from the string . If the provided number higher tha the string length the full string will be returned but not more . |
4,744 | public function last ( $ charCount ) { if ( $ charCount <= 0 ) { return $ this -> createClone ( '' ) ; } $ newValue = $ this -> substring ( ( $ charCount * - 1 ) ) ; return $ this -> createClone ( $ newValue ) ; } | Returns the last X character from the current string |
4,745 | public function map ( $ delimiter , callable $ callback ) { $ parts = $ this -> split ( $ delimiter ) ; foreach ( $ parts as $ part ) { call_user_func_array ( $ callback , [ $ part , $ delimiter ] ) ; } } | Iterates over parts of the string . The current string split through the given delimiter and the closure will be called on all elements . |
4,746 | public function split ( $ delimiter = ' ' ) { $ delimiter = ( empty ( $ delimiter ) ) ? ' ' : $ delimiter ; return explode ( $ delimiter , $ this -> string ) ; } | Split string along the delimiter |
4,747 | public function segment ( $ delimiter , $ index ) { $ parts = $ this -> split ( $ delimiter ) ; $ returnValue = ( isset ( $ parts [ $ index - 1 ] ) ) ? $ parts [ $ index - 1 ] : '' ; return $ this -> createClone ( $ returnValue ) ; } | Split the string along the delimiter and returns the given index from the segments |
4,748 | public function lastSegment ( $ delimiter ) { $ parts = $ this -> split ( $ delimiter ) ; $ returnValue = end ( $ parts ) ; return $ this -> createClone ( $ returnValue ) ; } | Split string along the delimiter and return the last segment |
4,749 | public function firstSegment ( $ delimiter ) { $ parts = $ this -> split ( $ delimiter ) ; $ returnValue = current ( $ parts ) ; return $ this -> createClone ( $ returnValue ) ; } | Split the string along the delimiter and returns the first segment |
4,750 | public function limit ( $ limit = 120 , $ end = '...' ) { $ returnValue = $ this -> string ; if ( $ this -> length ( ) > $ limit ) { $ returnValue = rtrim ( ( string ) $ this -> first ( $ limit ) -> toString ( ) ) . $ end ; } return $ this -> createClone ( $ returnValue ) ; } | Limit the length of the current string . If the current string is longer tha the given limit chopped down to limit and the end substring will be concatenated . |
4,751 | public function splitCamelCase ( ) { preg_match_all ( '/((?:^|[\p{Lu}])[\p{Ll}_]+)/mu' , $ this -> string , $ matches ) ; $ returnValue = implode ( ' ' , $ matches [ 0 ] ) ; return $ this -> createClone ( $ returnValue ) ; } | Split down cameCase or PascalCase strings |
4,752 | public function splitSnakeCase ( ) { $ parts = $ this -> split ( '_' ) ; $ returnValue = implode ( ' ' , $ parts ) ; return $ this -> createClone ( $ returnValue ) ; } | Split snake_case string . |
4,753 | public function toTitleCase ( ) { $ returnValue = mb_convert_case ( ( string ) $ this -> toLower ( ) , MB_CASE_TITLE ) ; return $ this -> createClone ( $ returnValue ) ; } | Convert current string to Title Case |
4,754 | public function toPascalCase ( ) { $ newValue = $ this -> toLower ( ) -> toTitleCase ( ) -> toString ( ) ; $ newValue = implode ( '' , explode ( ' ' , $ newValue ) ) ; return $ this -> createClone ( $ newValue ) ; } | Convert current string to PascalCase |
4,755 | public function toCamelCase ( ) { $ parts = $ this -> toLower ( ) -> split ( ' ' ) ; $ index = 0 ; $ result = '' ; foreach ( $ parts as $ part ) { if ( $ index === 0 ) { $ index ++ ; $ result .= $ part ; continue ; } $ result .= ( string ) $ this -> createClone ( $ part ) -> ucfirst ( ) ; $ index ++ ; } return $ this -... | Convert current string to camelCase |
4,756 | public function useRecord ( Record $ record ) : void { $ this -> records -> add ( $ this -> name , $ record ) ; } | Pushes given Record instance directly into Container s records . |
4,757 | public function call ( string $ method , ... $ arguments ) : void { $ this -> useRecord ( new Record \ CreateMethodRecord ( $ method , $ arguments ) ) ; } | Pushes CreateMethodRecord with given method of container identified object and its parameter values . |
4,758 | public function generate ( ) : string { $ fieldId = $ this -> controllData [ 'field-id' ] ; $ label = $ this -> controllData [ 'label' ] ; $ label = $ label != Tags :: NBSP ? $ label . ':' : $ label ; $ icons = '' ; $ class = [ 'controll' ] ; $ ret = [ ] ; if ( $ this -> controllData [ 'required' ] == 1 ) { $ class [ ]... | Generates FormControll and returns it |
4,759 | protected function _set_default_controller ( ) { parent :: _set_default_controller ( ) ; $ class = $ this -> fetch_class ( ) ; if ( empty ( $ class ) ) { if ( sscanf ( $ this -> default_controller , '%[^/]/%s' , $ class , $ method ) !== 2 ) { $ method = 'index' ; } if ( $ located = $ this -> locate ( [ $ class , $ clas... | Set default controller |
4,760 | function CheckNet ( $ networks , $ ip = '' ) { if ( empty ( $ ip ) ) { $ ip = ( $ this -> BL_Safe ) ? $ this -> IP [ 'proxy' ] : $ this -> IP [ 'client' ] ; } if ( ! $ this -> isValid ( $ ip ) ) { return false ; } $ ipl = ip2long ( trim ( $ ip ) ) ; $ ips = ( is_array ( $ networks ) ) ? $ networks : preg_split ( '/[\s,... | Function to check if IP belongs to given Network or not This function can be used for IP BLACKLIST WHITELIST check |
4,761 | function FindHeaders ( $ name ) { $ result = array ( ) ; if ( $ name [ 0 ] <> '/' ) { if ( array_key_exists ( $ name , $ _SERVER ) ) { $ result [ $ name ] = $ _SERVER [ $ name ] ; } } else { foreach ( $ _SERVER as $ key => $ value ) { if ( preg_match ( $ name , $ key , $ match ) ) { $ result [ $ key ] = $ value ; } } }... | INTERNAL USE - Regular Expression compatible Find Headers function To Query existence of a request header and returns found headers |
4,762 | public function getRequestUri ( $ includeParameters = false ) { $ uri = $ this -> uri ; if ( ! $ includeParameters ) { $ sepIdx = strpos ( $ uri , '?' ) ; if ( $ sepIdx !== false ) { $ uri = substr ( $ uri , 0 , $ sepIdx ) ; } } return $ uri ; } | Returns the request URI optionally with query parameters . |
4,763 | public function getUrl ( $ includeQueryString = true ) { $ url = $ this -> getProtocol ( ) . '://' ; $ url .= $ this -> getHostname ( ) ; $ isAbnormalPort = ( $ this -> isHttps ( ) && $ this -> getPort ( ) != 443 ) || ( ! $ this -> isHttps ( ) && $ this -> getPort ( ) != 80 ) ; if ( $ isAbnormalPort ) { $ url .= ':' . ... | Returns the full URL that was requested including protocol hostname port and request URI . |
4,764 | private function parseHeaders ( ) { $ this -> headers = [ ] ; foreach ( $ this -> environment as $ key => $ value ) { if ( ! empty ( $ value ) && substr ( $ key , 0 , 5 ) == 'HTTP_' ) { $ headerName = substr ( $ key , 5 ) ; $ headerName = str_replace ( '_' , ' ' , $ headerName ) ; $ headerName = ucwords ( strtolower ( ... | Parses headers from the Environment data set in this request object . |
4,765 | public function getReflection ( ) { if ( $ this -> reflection === NULL ) { if ( is_array ( $ this -> callback ) ) { $ this -> reflection = ( new \ ReflectionClass ( $ this -> callback [ 0 ] ) ) -> getMethod ( $ this -> callback [ 1 ] ) ; } elseif ( is_object ( $ this -> callback ) && ! $ this -> callback instanceof \ C... | Get a reflection of the callback . |
4,766 | final public function execute ( ) { $ platform = $ this -> connection -> getDatabasePlatform ( ) ; $ queries = $ this -> currentSchema -> getMigrateToSql ( $ this -> schema , $ platform ) ; foreach ( $ queries as $ query ) { $ this -> connection -> query ( $ query ) ; } } | Execute the migrations queries . |
4,767 | public function setDriver ( IDriver $ driver ) : Connection { $ this -> _driver = $ driver ; $ this -> _pdo = null ; return $ this ; } | Sets the DBMS Driver |
4,768 | public final function open ( ) : Connection { if ( $ this -> isOpen ( ) ) { return $ this ; } $ attrSupport = $ this -> _driver -> getAttributeSupport ( ) ; $ definedAttributes = $ this -> _driver -> getDefinedAttributes ( ) ; $ dsn = $ this -> _driver -> getType ( ) . ':' ; $ dsnC = 0 ; $ user = null ; $ pass = null ;... | Opens a connection if none is open . |
4,769 | public final function fetchAll ( string $ sql , array $ bindParams = [ ] , $ fetchStyle = \ PDO :: FETCH_ASSOC ) : array { $ this -> open ( ) ; try { if ( 1 > \ count ( $ bindParams ) ) { $ stmt = $ this -> _pdo -> query ( $ sql ) ; return $ stmt -> fetchAll ( $ fetchStyle ) ; } $ stmt = $ this -> _pdo -> prepare ( $ s... | Fetches all records from defined SQL query string and returns all as a array . |
4,770 | public final function fetchIterateAll ( string $ sql , array $ bindParams = [ ] , $ fetchStyle = \ PDO :: FETCH_ASSOC ) : \ Generator { $ this -> open ( ) ; try { if ( 1 > \ count ( $ bindParams ) ) { $ stmt = $ this -> _pdo -> query ( $ sql ) ; while ( $ record = $ stmt -> fetch ( $ fetchStyle , \ PDO :: FETCH_ORI_NEX... | Fetches all records from defined SQL query string and returns all as a Generator . |
4,771 | public final function fetchRecord ( string $ sql , array $ bindParams = [ ] , $ fetchStyle = \ PDO :: FETCH_ASSOC ) : ? array { $ this -> open ( ) ; try { if ( 1 > \ count ( $ bindParams ) ) { $ stmt = $ this -> _pdo -> query ( $ sql ) ; return $ stmt -> fetch ( $ fetchStyle ) ; } $ stmt = $ this -> _pdo -> prepare ( $... | Fetches the first found record from defined SQL query string and returns it as a associative array . |
4,772 | public function getExtension ( $ ext ) { $ name = "Extension\\" . $ ext ; if ( isset ( $ this -> extensions [ $ name ] ) ) { return $ this -> extensions [ $ name ] ; } try { $ extension = $ this -> loadExtension ( $ name ) ; if ( ! $ this -> notInit ) { $ extension -> OWeb_Init ( ) ; } } catch ( \ Exception $ exception... | If the extensions is loaded will just return it if not will try to load it and the return it |
4,773 | protected function loadExtension ( $ ClassName ) { try { $ reflectionClass = new \ ReflectionClass ( $ ClassName ) ; if ( ! $ reflectionClass -> isInstantiable ( ) ) throw new \ OWeb \ manage \ exceptions \ Extension ( "The Extension is still abstract" ) ; $ extension = new $ ClassName ( ) ; if ( $ extension instanceof... | Will load the extension if it hasn t already been load and if it can find it . |
4,774 | protected function registerExtension ( $ extension , $ name ) { $ subExtensions = array ( ) ; $ subExtensions [ $ name ] = $ extension ; $ parent = get_parent_class ( $ extension ) ; while ( $ parent != "" && $ parent != "OWeb\\types\\Extension" ) { if ( isset ( $ this -> extensions [ $ parent ] ) ) { throw new \ OWeb ... | Register the extension to the Extension manager . It is here that we will check all the parents of the extension to Register for every parents it has . |
4,775 | public function init_extensions ( ) { \ OWeb \ manage \ Events :: getInstance ( ) -> sendEvent ( 'InitPrep@OWeb\manage\Etensions' ) ; foreach ( $ this -> obj_extension as $ extension ) { $ extension -> OWeb_Init ( ) ; } $ this -> notInit = false ; \ OWeb \ manage \ Events :: getInstance ( ) -> sendEvent ( 'Init@OWeb\ma... | Will initialize all extensions when Oweb has finished Initializing itself |
4,776 | public function initialize ( ) { $ app = new Application ; $ this -> setEnvironment ( $ app ) ; $ this -> registerConfig ( $ app ) ; $ initConfig = $ app [ 'config' ] -> load ( 'init' ) ; if ( $ initConfig [ 'debug' ] ) { Debug :: enable ( ) ; $ app [ 'debug' ] = true ; } return $ app ; } | Initialize the Silex Application |
4,777 | public function hasPermission ( $ permission ) { foreach ( $ this -> permissions ( ) -> get ( ) as $ p ) { if ( $ p -> name == $ permission ) { return true ; } } return false ; } | check if the role has a permission |
4,778 | public function selectMany ( $ object , DbQueryFilters $ filters ) { $ dbConfig = new DbStatementConfig ( $ object , DbExecutionType :: SELECT , $ filters ) ; $ dbConfig -> setType ( DbExecutionType :: SELECT ) ; $ dbConfig -> setDaoClassName ( \ Puzzlout \ Framework \ Helpers \ CommonHelper :: GetFullClassName ( $ obj... | Select method for many items |
4,779 | public function add ( $ objects ) { if ( is_array ( $ objects ) ) { foreach ( $ objects as $ object ) { $ this -> BuildAddDbConfig ( $ object ) ; } } else { $ this -> BuildAddDbConfig ( $ objects ) ; } return $ this -> BindParametersAndExecute ( null ) ; } | Add method to add a item to DB |
4,780 | public function edit ( $ objects , $ whereFilters ) { $ dbConfigList = array ( ) ; foreach ( $ objects as $ object ) { $ dbConfig = new DbStatementConfig ( $ object ) ; $ dbConfig -> setTableName ( $ this -> GetTableName ( $ object ) ) ; $ dbConfig -> setType ( DbExecutionType :: UPDATE ) ; $ dbConfig -> Bui ( $ this -... | Edit method to update a item into DB |
4,781 | public function delete ( $ object , $ where_filter_id ) { $ this -> dbConfig ( ) -> setTYpe ( DbExecutionType :: DELETE ) ; $ delete_clause = "DELETE from `" . $ this -> GetTableName ( $ object ) . "` WHERE $where_filter_id = " . $ object -> $ where_filter_id ( ) . ";" ; $ sth = $ this -> dao -> prepare ( $ delete_clau... | Add method to delete a item to DB |
4,782 | public function generateScripts ( array $ attributes = null ) { $ init = <<<EOD $(document).ready(function(){ container=$('div.%s'); form=$('#%s'); cancelButton=form.find('button.cancel-request'); submitButton=fo... | generate scripts used as inline scripts |
4,783 | public function getAPIAttributes ( $ params = array ( ) , $ relations = false ) { $ attributes = array ( ) ; foreach ( $ this -> attributes as $ k => $ v ) { if ( in_array ( $ k , $ params ) ) continue ; $ attributes [ $ k ] = $ v ; } if ( $ relations != false ) { foreach ( $ relations as $ relation => $ params ) { if ... | Returns attributes suitable for the API |
4,784 | public function parseMeta ( $ id ) { $ items = array ( ) ; $ data = ContentMetadata :: model ( ) -> findAllByAttributes ( array ( 'content_id' => $ id ) ) ; foreach ( $ data as $ element ) $ items [ $ element -> key ] = $ this -> isJson ( $ element -> value ) ? CJSON :: decode ( $ element -> value ) : $ element -> valu... | parseMeta pulls the metadata out of a model and returns that metadata as a usable array |
4,785 | public function verifySlug ( $ slug = '' , $ title = '' ) { $ slug = str_replace ( '/' , '-' , str_replace ( '\'' , '-' , str_replace ( ' ' , '-' , $ slug ) ) ) ; if ( $ slug == '' ) $ slug = str_replace ( '/' , '-' , str_replace ( '\'' , '-' , str_replace ( ' ' , '-' , $ title ) ) ) ; $ slug = preg_replace ( "/[^A-Za-... | verifySlug - Verifies that the provided slug is able to be used and does not conflict with an existing route |
4,786 | public function populate ( $ data = array ( ) ) { foreach ( $ data as $ k => $ v ) { if ( $ this -> isNewRecord ) $ this -> $ k = $ v ; else { if ( isset ( $ this -> attributes [ $ k ] ) ) $ this -> $ k = $ v ; } } return $ this -> attributes ; } | Model populate override |
4,787 | public function showAction ( Located $ located ) { $ deleteForm = $ this -> createDeleteForm ( $ located ) ; return array ( 'entity' => $ located , 'delete_form' => $ deleteForm -> createView ( ) , ) ; } | Finds and displays a Located entity . |
4,788 | public function editAction ( Request $ request , Located $ located ) { $ deleteForm = $ this -> createDeleteForm ( $ located ) ; $ editForm = $ this -> createForm ( 'EcommerceBundle\Form\LocatedType' , $ located , array ( 'action' => $ this -> generateUrl ( 'ecommerce_located_edit' , array ( 'id' => $ located -> getId ... | Displays a form to edit an existing Located entity . |
4,789 | private function createDeleteForm ( Located $ located ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'ecommerce_located_delete' , array ( 'id' => $ located -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> getForm ( ) ; } | Located a form to delete a Located entity . |
4,790 | public function getRepository ( EntityManagerInterface $ entityManager , $ className ) { if ( ! isset ( $ this -> repositories [ $ className ] ) ) { $ this -> repositories [ $ className ] = $ this -> generateRepository ( $ entityManager , $ className ) ; } return $ this -> repositories [ $ className ] ; } | Gets the repository for a given entity name |
4,791 | public function findForSeller ( Profile $ seller ) { $ em = $ this -> getEntityManager ( ) ; $ q = $ em -> createQuery ( ' SELECT wm FROM HarvestCloudCoreBundle:SellerWindowMaker wm LEFT JOIN wm.sellerHubRef shr LEFT JOIN shr.hub h WHERE shr.sel... | Find for a given Seller |
4,792 | public function setPageContent ( ) { $ content = "---\n" ; $ content .= "type: " . $ this -> properties [ 'type' ] . "\n" ; $ content .= "layout: " . $ this -> properties [ 'layout' ] . "\n" ; $ content .= "title: " . $ this -> properties [ 'title' ] . "\n" ; $ content .= "---\n" ; $ content .= $ this -> properties [ '... | Set Metadata s template for page |
4,793 | public static function getAsNumeric ( $ p_currency ) { $ codes = self :: getAllCodes ( ) ; if ( array_key_exists ( strtoupper ( $ p_currency ) , $ codes ) ) { return $ codes [ strtoupper ( $ p_currency ) ] [ 'code' ] ; } return false ; } | get ISO4217 code as numeric |
4,794 | public static function extractHeaders ( $ response_str ) { $ headers = array ( ) ; $ parts = preg_split ( '|(?:\r?\n){2}|m' , $ response_str , 2 ) ; if ( ! $ parts [ 0 ] ) return $ headers ; $ lines = explode ( "\n" , $ parts [ 0 ] ) ; unset ( $ parts ) ; $ last_header = null ; foreach ( $ lines as $ line ) { $ line = ... | Extract the headers from a response string |
4,795 | protected function getLoader ( Console \ Input \ InputInterface $ input ) { $ inputFile = $ input -> getOption ( 'input' ) ; if ( $ input -> getOption ( 'edit' ) ) { if ( $ inputFile !== $ this -> getDefinition ( ) -> getOption ( 'input' ) -> getDefault ( ) ) { throw new \ InvalidArgumentException ( "You cannot specify... | Get the loader based on input parameters |
4,796 | protected function getWriter ( Console \ Input \ InputInterface $ input , Console \ Output \ OutputInterface $ output ) { $ outputFile = $ input -> getOption ( 'output' ) ; if ( $ input -> getOption ( 'edit' ) ) { if ( $ outputFile !== $ this -> getDefinition ( ) -> getOption ( 'output' ) -> getDefault ( ) ) { throw ne... | Get the writer based on output parameters |
4,797 | private function filterPath ( $ path ) : string { if ( ! is_string ( $ path ) ) { throw new \ InvalidArgumentException ( 'Path must be a string' ) ; } return preg_replace_callback ( '/(?:[^' . self :: $ charUnreserved . self :: $ charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/' , [ $ this , 'rawurlencodeMatchZero' ] , ... | Filters the path of a URI . |
4,798 | public function getValidAttribs ( ) { return array_combine ( array_keys ( $ this -> validAttribs ) , array_map ( function ( $ ref ) { return $ ref [ 'attrib' ] ; } , array_values ( $ this -> validAttribs ) ) ) ; } | Returns all validated attributes |
4,799 | public function getValidData ( ) { return array_combine ( array_keys ( $ this -> validAttribs ) , array_map ( function ( $ ref ) { return $ ref [ 'value' ] ; } , array_values ( $ this -> validAttribs ) ) ) ; } | Returns all validated data |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.