idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
232,900 | protected function resolveInstaller ( ) : ? string { $ value = $ this -> getModuleInfo ( ) [ 'installer' ] ?? null ; return is_string ( $ value ) ? $ value : null ; } | Resolve installer class |
232,901 | protected function resolveAssets ( ) : ? string { $ module = $ this -> getModuleInfo ( ) ; if ( ! isset ( $ module [ 'assets' ] ) ) { return null ; } $ directory = $ this -> directory ( ) . DIRECTORY_SEPARATOR . trim ( $ module [ 'assets' ] , DIRECTORY_SEPARATOR ) ; return is_dir ( $ directory ) ? realpath ( $ director... | Resolve assets dir |
232,902 | private function initTableTypes ( ) { $ this -> tableTypes = [ ] ; foreach ( $ this -> loadTableTypes ( ) as $ type ) { if ( ! $ type instanceof TableTypeInterface ) { throw new UnexpectedTypeException ( $ type , TableTypeInterface :: class ) ; } $ this -> tableTypes [ get_class ( $ type ) ] = $ type ; } } | Initializes the table types . |
232,903 | private function initTableTypeExtensions ( ) { $ this -> tableTypeExtensions = [ ] ; foreach ( $ this -> loadTableTypeExtensions ( ) as $ extension ) { if ( ! $ extension instanceof TableTypeExtensionInterface ) { throw new UnexpectedTypeException ( $ extension , TableTypeExtensionInterface :: class ) ; } $ type = $ ex... | Initializes the table type extensions . |
232,904 | private function initColumnTypes ( ) { $ this -> columnTypes = [ ] ; foreach ( $ this -> loadColumnTypes ( ) as $ type ) { if ( ! $ type instanceof ColumnTypeInterface ) { throw new UnexpectedTypeException ( $ type , ColumnTypeInterface :: class ) ; } $ this -> columnTypes [ get_class ( $ type ) ] = $ type ; } } | Initializes the column types . |
232,905 | private function initColumnTypeExtensions ( ) { $ this -> columnTypeExtensions = [ ] ; foreach ( $ this -> loadColumnTypeExtensions ( ) as $ extension ) { if ( ! $ extension instanceof ColumnTypeExtensionInterface ) { throw new UnexpectedTypeException ( $ extension , ColumnTypeExtensionInterface :: class ) ; } $ type =... | Initializes the column type extensions . |
232,906 | private function initFilterTypes ( ) { $ this -> filterTypes = [ ] ; foreach ( $ this -> loadFilterTypes ( ) as $ type ) { if ( ! $ type instanceof FilterTypeInterface ) { throw new UnexpectedTypeException ( $ type , FilterTypeInterface :: class ) ; } $ this -> filterTypes [ get_class ( $ type ) ] = $ type ; } } | Initializes the filter types . |
232,907 | private function initFilterTypeExtensions ( ) { $ this -> filterTypeExtensions = [ ] ; foreach ( $ this -> loadFilterTypeExtensions ( ) as $ extension ) { if ( ! $ extension instanceof FilterTypeExtensionInterface ) { throw new UnexpectedTypeException ( $ extension , FilterTypeExtensionInterface :: class ) ; } $ type =... | Initializes the filter type extensions . |
232,908 | private function initActionTypes ( ) { $ this -> actionTypes = [ ] ; foreach ( $ this -> loadActionTypes ( ) as $ type ) { if ( ! $ type instanceof ActionTypeInterface ) { throw new UnexpectedTypeException ( $ type , ActionTypeInterface :: class ) ; } $ this -> actionTypes [ get_class ( $ type ) ] = $ type ; } } | Initializes the action types . |
232,909 | private function initActionTypeExtensions ( ) { $ this -> actionTypeExtensions = [ ] ; foreach ( $ this -> loadActionTypeExtensions ( ) as $ extension ) { if ( ! $ extension instanceof ActionTypeExtensionInterface ) { throw new UnexpectedTypeException ( $ extension , ActionTypeExtensionInterface :: class ) ; } $ type =... | Initializes the action type extensions . |
232,910 | private function initAdapterFactories ( ) { $ this -> adapterFactories = [ ] ; foreach ( $ this -> loadAdapterFactories ( ) as $ adapter ) { if ( ! $ adapter instanceof AdapterFactoryInterface ) { throw new UnexpectedTypeException ( $ adapter , AdapterFactoryInterface :: class ) ; } $ this -> adapterFactories [ get_cla... | Initializes the adapter factories . |
232,911 | public function getEnumOptions ( $ oid ) { $ query = new Query ( "SELECT enumlabel FROM pg_enum WHERE enumtypid = %oid:int%" , array ( 'oid' => $ oid ) ) ; return $ this -> db -> query ( $ query ) -> fetch ( ) ; } | Get array of enum options |
232,912 | public function findByName ( $ name ) { $ result = $ this -> db -> query ( new Query ( <<<SQLSELECT t.oid AS oid, t.typname AS name, n.nspname as "schema", t.typlen AS length, t.typtype AS type, t.typcategory AS category, t.typarray AS "arrayType", t.typdefault AS default, t.typdefaultbin AS... | Init a type by it s name . Most likely used for enum types |
232,913 | public function isDirty ( ) : bool { foreach ( $ this -> __state as $ prop => $ val ) { if ( $ this -> isModified ( $ prop ) ) { return true ; } } return false ; } | Returns true if any of the model s properties was modified . |
232,914 | public static function removeDir ( $ path ) { if ( is_file ( $ path ) ) { unlink ( $ path ) ; } else { foreach ( scandir ( $ path ) as $ dir ) { if ( $ dir === '.' || $ dir === '..' ) { continue ; } static :: removeDir ( $ path . '/' . $ dir ) ; } rmdir ( $ path ) ; } } | Recursive remove dir |
232,915 | public static function recurseCopyIfEdited ( $ src = '' , $ dst = '' , array $ excludes = [ 'php' ] ) { if ( ! is_dir ( $ dst ) && ( ! mkdir ( $ dst ) && ! is_dir ( $ dst ) ) ) { throw new Exception ( 'Copy dir error, access denied for path: ' . $ dst ) ; } $ dir = opendir ( $ src ) ; if ( ! $ dir ) { throw new Excepti... | Recursive copy files if edited |
232,916 | public function start ( ) { if ( $ this -> active ) return $ this ; if ( PHP_SAPI === "cli" ) { $ this -> startCLISession ( ) ; } else { $ this -> startHTTPSession ( ) ; } if ( ! $ this -> has ( 'session_mgmt' , 'start_time' ) ) $ this -> set ( 'session_mgmt' , 'start_time' , time ( ) ) ; return $ this ; } | Actually start the session |
232,917 | public function setSessionID ( string $ session_id ) { if ( ! defined ( 'WEDETO_TEST' ) || WEDETO_TEST === 0 ) throw new \ RuntimeException ( "Cannot change the session ID" ) ; $ this -> session_id = $ session_id ; return $ this ; } | Change the session ID useful for tests . Disallowed in normal operation . |
232,918 | public function startHTTPSession ( ) { if ( session_status ( ) === PHP_SESSION_DISABLED ) throw new \ RuntimeException ( "Sesssions are disabled" ) ; if ( session_status ( ) === PHP_SESSION_ACTIVE ) throw new \ LogicException ( "Repeated session initialization" ) ; session_set_cookie_params ( $ this -> lifetime , $ thi... | Set up a HTTP session using cookies and the PHP session machinery |
232,919 | private function secureSession ( ) { $ expired = false ; if ( $ this -> has ( 'session_mgmt' , 'destroyed' ) ) { $ when = $ this -> get ( 'session_mgmt' , 'destroyed' ) ; $ ua = $ this -> get ( 'session_mgmt' , 'last_ua' ) ; $ ip = $ this -> get ( 'session_mgmt' , 'last_ip' ) ; $ now = time ( ) ; $ diff = $ now - $ whe... | Secure the session |
232,920 | public function resetID ( ) { if ( session_status ( ) === PHP_SESSION_ACTIVE ) { $ this -> set ( 'session_mgmt' , 'destroyed' , time ( ) ) ; $ auth = $ this -> get ( 'authentication' ) ; if ( $ auth ) unset ( $ this [ 'authentication' ] ) ; $ new_session_id = self :: create_new_id ( ) ; $ this -> set ( 'session_mgmt' ,... | Should be called when the session ID should be changed for example after logging in or out . |
232,921 | private static function create_new_id ( string $ prefix = "Wedeto" ) { if ( version_compare ( PHP_VERSION , '7.1.0' ) > 0 ) return session_create_id ( $ prefix ) ; return $ prefix . bin2hex ( random_bytes ( 16 ) ) ; } | Helper function . PHP 7 . 1 introduces session_create_id function . This is used in PHP 7 . 1 but a fallback using random_bytes is used on PHP 7 . 0 . |
232,922 | public function destroy ( ) { if ( $ this -> active ) { $ this -> clear ( ) ; if ( session_status ( ) === PHP_SESSION_ACTIVE ) session_commit ( ) ; $ this -> active = false ; } return $ this ; } | Should be called when the session should be cleared and destroyed . |
232,923 | public static function init ( ) { self :: add ( self :: HEADER_SET_COOKIE , '__Host-sess=' . session_id ( ) . '; path=' . Request :: $ subfolders . '; Secure; HttpOnly; SameSite;' ) ; if ( Request :: isSecure ( ) ) { self :: add ( self :: HEADER_CONTENT_SECURITY_POLICY , self :: HEADER_CONTENT_SECURITY_POLICY_CONTENT_S... | Adds content security policy headers |
232,924 | public static function parseParams ( $ url_parsed ) { $ vid = FALSE ; $ url_seperator = FALSE ; if ( preg_match ( '/^\/watch$/' , $ url_parsed [ 'path' ] ) ) { $ fragment_regex = '/^\!v\=([a-zA-Z0-9]+).*$/' ; if ( isset ( $ url_parsed [ 'fragment' ] ) && preg_match ( $ fragment_regex , $ url_parsed [ 'fragment' ] ) ) {... | helper function extract video id and other parameters from url |
232,925 | public function update ( $ name , $ is_public , $ is_archived , $ is_guest_accessible , $ topic , $ owner_user_id ) { $ queryParams = array ( 'name' => $ name , 'privacy' => ( ( $ is_public === true ) ? 'public' : 'private' ) , 'is_archived' => $ is_archived , 'is_guest_accessible' => $ is_guest_accessible , 'topic' =>... | Update room All values are required! |
232,926 | public function setTopic ( $ topic ) { $ queryParams = array ( 'topic' => $ topic , ) ; $ room_id_or_name = $ this -> getId ( ) ; $ response = $ this -> request -> put ( 'room/' . $ room_id_or_name . '/topic' , $ queryParams ) ; return $ this -> request -> returnResponseObject ( $ response ) ; } | Set room topic |
232,927 | public function errorAction ( ) { $ validationResults = $ this -> arguments -> getValidationResults ( ) -> getFlattenedErrors ( ) ; $ result = array ( ) ; foreach ( $ validationResults as $ key => $ validationResult ) { foreach ( $ validationResult as $ error ) { $ translatedMessage = $ this -> translator -> translateB... | Return validation results as json |
232,928 | protected function interact ( InputInterface $ input , OutputInterface $ output ) { $ questionHelper = $ this -> getHelper ( 'question' ) ; $ formatter = $ this -> getHelper ( 'formatter' ) ; $ rootDir = $ this -> getRootDir ( ) ; $ fs = new Filesystem ( ) ; $ appPath = explode ( '/' , $ rootDir ) ; $ appName = $ appPa... | Configures deployment . |
232,929 | protected function initConfig ( Filesystem $ fs , $ rootDir ) { $ bundleDir = $ this -> getBundleVendorDir ( ) ; $ path = $ this -> getCapistranoDir ( ) ; if ( ! $ fs -> exists ( $ path . '/deploy.rb' ) || ! $ fs -> exists ( $ path . '/deploy/production.rb' ) ) { return $ fs -> mirror ( $ bundleDir . '/Resources/config... | Dump capistrano configuration skin from Resources directory . |
232,930 | protected function configureDeploy ( InputInterface $ input , OutputInterface $ output , QuestionHelper $ questionHelper , $ appName ) { $ data = [ ] ; $ properties = array ( 'application' => array ( 'helper' => $ appName , 'label' => 'Application' , 'autocomplete' => [ $ appName ] , ) , 'repo_url' => array ( 'helper' ... | Configure deploy . rb capistrano file . |
232,931 | protected function checkComposer ( InputInterface $ input , OutputInterface $ output , QuestionHelper $ questionHelper , $ deployData ) { $ question = new Question ( '<info>Download composer</info> [<comment>yes</comment>]: ' , 'yes' ) ; $ question -> setAutocompleterValues ( [ 'yes' , 'no' ] ) ; $ downloadComposer = $... | Check need of composer . |
232,932 | protected function checkSchemaUpdate ( InputInterface $ input , OutputInterface $ output , QuestionHelper $ questionHelper , $ deployData ) { $ question = new Question ( '<info>Update database schema</info> [<comment>yes</comment>]: ' , 'yes' ) ; $ question -> setAutocompleterValues ( [ 'yes' , 'no' ] ) ; $ wantDump = ... | Check for database schema update . |
232,933 | protected function configureSSH ( InputInterface $ input , OutputInterface $ output , QuestionHelper $ questionHelper , $ deployData ) { $ serverOptions = [ 'domain' => [ 'helper' => $ deployData [ 'ssh_user' ] , 'label' => 'Domain name' , ] , ] ; $ sshOptions = [ 'forwardAgent' => [ 'label' => 'SSH forward agent' , 'h... | Configure SSH options for production staging . |
232,934 | public static function randomStr ( $ base ) { $ result = "" ; if ( is_int ( $ base ) ) for ( $ i = 0 ; $ i < $ base ; $ i ++ ) $ result .= static :: $ randomCharMap [ random_int ( 0 , count ( static :: $ randomCharMap ) ) ] ; else for ( $ i = 0 ; $ i < strlen ( $ base ) ; $ i ++ ) $ result .= static :: randomChar ( $ b... | Scrambles of string of characters but keeps the results either uppercase lowercase or numeric |
232,935 | public static function randomChars ( $ seed , $ len ) { $ result = '' ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) $ result .= $ seed [ random_int ( 0 , strlen ( $ seed ) ) ] ; return $ result ; } | Randomizes from the provided seed |
232,936 | public static function randomChar ( $ char ) { if ( strlen ( $ char ) == 0 ) return '' ; $ char = ord ( $ char ) ; if ( $ char > 64 && $ char < 91 ) return static :: randomCharRange ( 65 , 90 ) ; if ( $ char > 96 && $ char < 123 ) return static :: randomCharRange ( 97 , 122 ) ; if ( $ char > 47 && $ char < 58 ) return ... | Randomizes the first character of string preserves uppercase lowercase and numeric . |
232,937 | public static function randomCharRange ( $ start , $ end ) { if ( count ( static :: $ randomCharMap ) == 0 ) static :: populate ( ) ; return chr ( random_int ( $ start , $ end ) ) ; } | Returns a random character within the specified range |
232,938 | public static function stacktrace ( $ stack = null , $ withPre = false ) { if ( is_null ( $ stack ) ) $ stack = debug_backtrace ( ) ; $ output = $ withPre ? '<pre>' : '' ; $ stackLen = count ( $ stack ) ; for ( $ i = 1 ; $ i < $ stackLen ; $ i ++ ) { $ entry = $ stack [ $ i ] ; $ func = $ entry [ 'function' ] . '(' ; $... | Creates a human readable stack trace |
232,939 | protected function processStatistics ( $ query = null ) { $ this -> unchangedCount = 0 ; $ this -> changedCount = 0 ; $ this -> failedCount = 0 ; $ this -> nodesCountByOS = [ ] ; $ this -> nodesPercentageByOS = [ ] ; $ this -> recentlyRebootedNodes = [ ] ; $ nodes = $ this -> getNodeService ( ) -> getAll ( $ query ) ; ... | Browse all nodes and process all the statistics |
232,940 | public function setPath ( $ path ) { if ( ! $ this -> files -> exists ( $ path ) ) { $ result = $ this -> files -> put ( $ path , '{}' ) ; if ( $ result === false ) { throw new NotWritableException ( "Could not write to $path." ) ; } } if ( ! $ this -> files -> isWritable ( $ path ) ) { throw new NotWritableException (... | Set the path for the JSON file . |
232,941 | public function isCurrent ( $ page , $ pattern ) { $ page = str_replace ( $ this -> getBuilder ( ) -> app -> getSetting ( 'url' ) , '' , $ page ) ; return str_is ( $ pattern , $ page ) ; } | Is given URL the current page? |
232,942 | private static function collect ( ) { $ message = '' ; $ message .= sprintf ( "\r\nURL: %s\r\n" , $ _SERVER [ 'REQUEST_URI' ] ) ; if ( ! empty ( $ _POST ) ) { $ message .= "\r\n" ; foreach ( $ _POST as $ key => $ value ) { if ( in_array ( $ key , [ 'password' , 'password2' ] ) ) { continue ; } $ message .= 'post #' . $... | collects data for current request |
232,943 | public function setDoctrineFunctions ( \ StingerSoft \ DoctrineCommons \ Utils \ DoctrineFunctionsInterface $ doctrineFunctions = null ) { $ this -> doctrineFunctions = $ doctrineFunctions ; } | Set the doctrine commons functions to be used by the twig extension . |
232,944 | public function unproxifyFilter ( $ object ) { if ( $ this -> hasDoctrineFunctions ( ) && method_exists ( $ this -> doctrineFunctions , 'unproxifyFilter' ) ) { return $ this -> doctrineFunctions -> unproxifyFilter ( $ object ) ; } return $ object ; } | Transforms the given doctrine proxy object into a real entity |
232,945 | public static function create ( $ id , array $ config ) { static :: $ databaseConnections [ $ id ] = static :: createDatabaseConnection ( $ config ) ; if ( static :: $ activeDatabaseConnection === null ) { static :: select ( $ id ) ; } } | Set a database connection . |
232,946 | public static function get ( $ id = null ) { if ( $ id === null && static :: $ activeDatabaseConnection === null ) { throw new MissingDatabaseConnectionException ( 'No databases defined.' ) ; } if ( $ id === null ) { return static :: $ databaseConnections [ static :: $ activeDatabaseConnection ] ; } else { return stati... | Get a database connection . |
232,947 | public function run ( Storage $ storage ) { parent :: run ( $ storage ) ; $ components = $ this -> getParametersWithoutNamespace ( ) ; foreach ( $ components as $ namespace => $ component ) { $ this -> loadComponent ( $ namespace , $ component ) ; } } | Runs all components that are set |
232,948 | private function loadComponent ( $ namespace , $ component ) { $ fullyQualifiedCloudControlComponent = '\\CloudControl\\Cms\\components\\' . $ component ; $ fullyQualifiedComponent = '\\components\\' . $ component ; if ( class_exists ( $ fullyQualifiedCloudControlComponent , true ) ) { $ this -> runComponent ( $ namesp... | Tries to determine component class name and wheter it exists |
232,949 | private function runComponent ( $ namespace , $ fullyQualifiedComponent ) { $ parameters = $ this -> getParametersForNameSpace ( $ namespace ) ; $ parameters [ self :: PARAMETER_MULTI_COMPONENT ] = $ this ; $ component = new $ fullyQualifiedComponent ( '' , $ this -> request , $ parameters , $ this -> matchedSitemapIte... | Instantiates the component and runs it |
232,950 | private function getParametersForNameSpace ( $ namespace ) { $ parameters = array ( ) ; foreach ( $ this -> parameters as $ key => $ value ) { if ( 0 === strpos ( $ key , $ namespace . ':' ) ) { $ parameters [ substr ( $ key , strlen ( $ namespace ) + 1 ) ] = $ value ; } } return $ parameters ; } | Retrieves all parameters for the given namespace |
232,951 | private function getParametersWithoutNamespace ( ) { $ parameters = array ( ) ; foreach ( $ this -> parameters as $ key => $ value ) { if ( strpos ( $ key , ':' ) === false ) { $ parameters [ $ key ] = $ value ; } } return $ parameters ; } | Retrieves all parameters that have no namespace |
232,952 | public function resolve ( NodeRouteInterface $ route ) { foreach ( $ this -> classes as $ class ) { $ qb = $ this -> manager -> createQueryBuilder ( ) -> select ( 'n' ) -> from ( $ class , 'n' ) -> join ( 'n.routes' , 'r' ) -> where ( 'r.id = :route' ) -> setParameter ( 'route' , $ route -> getId ( ) ) ; $ node = $ qb ... | loads the Node by the given NodeRouteInterface |
232,953 | protected function getRoutableNodeClasses ( ) { $ metadata = $ this -> manager -> getClassMetadata ( Node :: class ) ; $ routables = array_values ( array_filter ( $ metadata -> subClasses , function ( $ subNode ) { $ reflection = new \ ReflectionClass ( $ subNode ) ; return $ reflection -> implementsInterface ( Routabl... | builds a list of all classes implementing RoutableNodeInterface |
232,954 | protected function format ( ) { if ( ( $ this -> getParameter ( 'value' ) == null || $ this -> getParameter ( 'value' ) == "0" ) ) return '' ; elseif ( ( $ this -> getParameter ( 'value' ) != null ) && $ this -> getParameter ( 'value' ) instanceof Meta ) { $ dateTime = $ this -> getParameter ( 'value' ) ; $ dateTime = ... | Returns the date in a specified format |
232,955 | protected function ago ( ) { $ threshold = $ this -> getParameter ( 'threshold' ) ; if ( ( $ this -> getParameter ( 'value' ) == null || $ this -> getParameter ( 'value' ) == "0" ) ) return '' ; elseif ( ( $ this -> getParameter ( 'value' ) != null ) && $ this -> getParameter ( 'value' ) instanceof Meta ) { $ dateTime ... | Displays a short text description of how long ago the specified timestamp was current . |
232,956 | protected function heartbeatAgo ( ) { if ( $ this -> getParameter ( 'value' ) != null ) { $ min = $ this -> getParameter ( 'value' ) ; if ( $ min < 60 ) return $ min . ' min ago' ; elseif ( $ min < 1440 ) return floor ( $ min / 60 ) . ' hrs ' . ( $ min % 60 > 0 ? floor ( $ min % 60 ) . ' min ' : '' ) . 'ago' ; else ret... | Displays the specified minutes in a logical format |
232,957 | private static function determinePlaceholderPositions ( $ query , $ placeholder ) { $ placeholderPositions = array ( ) ; $ escaped = false ; $ placeholderLength = strlen ( $ placeholder ) ; $ placeolderPositionLimit = strlen ( $ query ) - $ placeholderLength + 1 ; for ( $ placeholderPosition = 0 ; $ placeholderPosition... | Determines the placeholder positions in the query . |
232,958 | private static function generateNewPlaceholders ( $ placeholder , $ count ) { $ newPlaceholders = array ( ) ; for ( $ index = 1 ; $ index <= $ count ; $ index ++ ) { $ newPlaceholders [ ] = $ placeholder . $ index ; } return $ newPlaceholders ; } | Generates the new placeholders according to the placeholder and the number of parameter . |
232,959 | private static function rewriteQuery ( $ query , array $ placeholderPositions , $ placeholderLength , array $ newPlaceholders ) { $ positionGap = 0 ; $ placeholders = implode ( ', ' , $ newPlaceholders ) ; $ placeholdersLength = strlen ( $ placeholders ) ; foreach ( $ placeholderPositions as $ placeholderPosition ) { $... | Rewrites the named query according to the placeholder length and positions and the new placeholders . |
232,960 | private static function rewriteParameterAndType ( array $ parameters , array $ types , $ parameter , array $ newPlaceholders ) { $ type = static :: extractType ( $ types [ $ parameter ] ) ; foreach ( $ newPlaceholders as $ newPlaceholderIndex => $ newPlaceholder ) { $ newParameter = substr ( $ newPlaceholder , 1 ) ; $ ... | Rewrites the query parameter & type by expanding them according to the parameter and the new placeholders . |
232,961 | public function printBenchmarkIntro ( Benchmark $ benchmark ) { printf ( "## %s\n" , $ benchmark -> getName ( ) ) ; if ( $ description = $ benchmark -> getDescription ( ) ) { printf ( "%s\n" , $ description ) ; } print ( "\n" ) ; printf ( "This benchmark consists of %s tests. Each test is executed %s times, the results... | Outputs an introduction prior to test execution |
232,962 | public function writeCache ( ) { $ cacheFile = $ this -> getCacheFile ( ) ; if ( ! $ cacheFile ) { return ; } if ( is_writeable ( dirname ( $ cacheFile ) ) ) { file_put_contents ( $ cacheFile , sprintf ( '<?php return %s;' , var_export ( $ this -> mergedConfig , true ) ) ) ; } } | Writes config to filesystem . |
232,963 | public function getPage ( ) { $ pageData = $ this -> core -> getSettings ( ) -> pagedata ; $ routeID = $ this -> route -> id ; $ this -> logger -> info ( 'Requested route: ' . $ routeID ) ; $ this -> logger -> debug ( 'Route info' , array ( $ this -> route ) ) ; if ( isset ( $ pageData -> $ routeID -> active ) ) $ this... | Displays a template based page by rendering a template file which is generated by route name plus . html ending |
232,964 | public function execute ( IDS_Report $ data ) { $ data = $ this -> prepareData ( $ data ) ; if ( is_string ( $ data ) ) { if ( file_exists ( $ this -> logfile ) ) { $ data = trim ( $ data ) ; if ( ! empty ( $ data ) ) { if ( is_writable ( $ this -> logfile ) ) { $ handle = fopen ( $ this -> logfile , 'a' ) ; fwrite ( $... | Stores given data into a file |
232,965 | public static function isCalledByWhoops ( ) : bool { $ trace = debug_backtrace ( ) ; $ trace = end ( $ trace ) ; return isset ( $ trace [ 'class' ] ) && $ trace [ 'class' ] == 'Whoops\Run' ; } | Check if this is an exception |
232,966 | public function notify ( ) { foreach ( $ this -> watchers as $ watcher ) { if ( $ this -> stopNotify === true ) { break ; } $ watcher -> update ( $ this ) ; } } | Notify all available watchers |
232,967 | private function isRequired ( $ field , $ file ) { if ( true === isset ( $ this -> required [ $ field ] ) ) { if ( false === $ this -> required [ $ field ] && ( null === $ file || trim ( $ file [ 'tmp_name' ] ) === '' ) ) { return true ; } } return false ; } | Evaluates if file is required or not |
232,968 | private function getFile ( $ field , $ prefix ) { if ( null !== $ prefix ) { $ field = $ prefix . '[' . $ field . ']' ; } $ helper = new StringToArray ( ) ; $ data = $ helper -> execute ( $ field , null , $ this -> getData ( ) ) ; return $ data ; } | Returns the file array for a given field |
232,969 | private static function writeParameter ( $ file_handle , $ name , $ parameter , $ depth = 0 ) { if ( $ depth > 1 ) throw new \ DomainException ( "Cannot nest arrays more than once in INI-file" ) ; $ str = "" ; if ( WF :: is_array_like ( $ parameter ) ) { foreach ( $ parameter as $ key => $ val ) { $ prefix = $ name . "... | Recursive function that writes a parameter or a series of parameters to the INI file |
232,970 | public function getAcceptedEncodings ( ) { if ( null === $ this -> encodings ) { if ( isset ( $ _SERVER [ 'HTTP_ACCEPT_ENCODING' ] ) ) { $ this -> encodings = strtolower ( trim ( $ _SERVER [ 'HTTP_ACCEPT_ENCODING' ] ) ) ; } else { $ this -> encodings = '' ; } } return $ this -> encodings ; } | Returns the encodings the client accepts . from HTTP_ACCEPT_ENCODING |
232,971 | public static function toArrayFrom ( $ source , $ firstLevel = false , $ excludeClasses = [ ] , $ propertyPattern = null ) { $ object = new SerializerObject ( $ source ) ; $ object -> setStopFirstLevel ( $ firstLevel ) ; $ object -> setDoNotParse ( $ excludeClasses ) ; if ( ! is_null ( $ propertyPattern ) ) { if ( ! is... | Get all properties from a source object as an associative array |
232,972 | protected function setPropValue ( $ obj , $ propName , $ value ) { if ( method_exists ( $ obj , 'set' . $ propName ) ) { $ obj -> { 'set' . $ propName } ( $ value ) ; } elseif ( isset ( $ obj -> { $ propName } ) || $ obj instanceof stdClass ) { $ obj -> { $ propName } = $ value ; } else { $ className = get_class ( $ ob... | Set the property value |
232,973 | public static function convertDomElementToArray ( \ DOMElement $ element , $ checkPrefix = true ) { $ prefix = ( string ) $ element -> prefix ; $ empty = true ; $ config = array ( ) ; foreach ( $ element -> attributes as $ name => $ node ) { if ( $ checkPrefix && ! in_array ( ( string ) $ node -> prefix , array ( '' , ... | Converts a \ DOMElement object to a PHP array . |
232,974 | public static function phpize ( $ value ) { $ value = ( string ) $ value ; $ lowercaseValue = strtolower ( $ value ) ; switch ( true ) { case 'null' === $ lowercaseValue : return ; case ctype_digit ( $ value ) : $ raw = $ value ; $ cast = ( int ) $ value ; return '0' == $ value [ 0 ] ? octdec ( $ value ) : ( ( ( string... | Converts an xml value to a PHP type . |
232,975 | public function indexAction ( ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; if ( true === $ this -> get ( 'security.context' ) -> isGranted ( 'ROLE_SUPER_ADMIN' ) ) { $ entities = $ em -> getRepository ( 'ACSACSPanelWordpressBundle:WPSetup' ) -> findAll ( ) ; } elseif ( true === $ this -> get ( 'security.con... | Lists all WPSetup entities . |
232,976 | public function newAction ( ) { $ entity = new WPSetup ( ) ; $ form = $ this -> createForm ( new WPSetupType ( $ this -> container ) , $ entity ) ; return $ this -> render ( 'ACSACSPanelWordpressBundle:WPSetup:new.html.twig' , array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ) ; } | Displays a form to create a new WPSetup entity . |
232,977 | public function createAction ( Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = new WPSetup ( ) ; $ form = $ this -> createForm ( new WPSetupType ( $ this -> container ) , $ entity ) ; $ form -> bind ( $ request ) ; if ( $ form -> isValid ( ) ) { $ user = $ this -> get ( 'security.c... | Creates a new WPSetup entity . |
232,978 | public function editAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'ACSACSPanelWordpressBundle:WPSetup' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find WPSetup entity.' ) ; } $ editForm = $ this -> createForm (... | Displays a form to edit an existing WPSetup entity . |
232,979 | public function updateAction ( Request $ request , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'ACSACSPanelWordpressBundle:WPSetup' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find WPSetup entity.' ) ; } $ deleteForm ... | Edits an existing WPSetup entity . |
232,980 | protected function validateParameter ( $ key , $ value ) { if ( $ this -> isSafeValue ( $ value ) ) { return true ; } $ this -> enforceNonObjectValue ( $ key , $ value ) ; $ this -> enforceMultidimensionalArrayOfScalars ( $ key , $ value ) ; return true ; } | Check that the value to bind is a scalar or an array multi - dimensional of scalars |
232,981 | public function getDriverInstance ( $ sSlug = null ) { $ oDriverService = Factory :: service ( 'Driver' , 'nails/module-geo-ip' ) ; $ sEnabledDriver = appSetting ( $ oDriverService -> getSettingKey ( ) , 'nails/module-geo-ip' ) ; $ oEnabledDriver = $ oDriverService -> getEnabled ( ) ; if ( empty ( $ sEnabledDriver ) &&... | Returns an instance of the driver |
232,982 | public function lookup ( $ sIp = '' ) { $ sIp = trim ( $ sIp ) ; if ( empty ( $ sIp ) && ! empty ( $ _SERVER [ 'REMOTE_ADDR' ] ) ) { $ sIp = $ _SERVER [ 'REMOTE_ADDR' ] ; } $ oCache = $ this -> getCache ( $ sIp ) ; if ( ! empty ( $ oCache ) ) { return $ oCache ; } $ oIp = $ this -> oDriver -> lookup ( $ sIp ) ; if ( ! ... | Return all information about a given IP |
232,983 | public function setCurrentTime ( \ DateTimeImmutable $ fixedTime ) : void { $ this -> fixedTime = $ fixedTime -> setTimezone ( $ this -> timeZone ) ; } | Set fixed date . |
232,984 | public function load ( $ file , $ namespace = '' , $ parser = null , $ env = null ) { $ config = [ ] ; $ this -> currentFile = $ file ; if ( is_object ( $ this -> cache ) ) { $ config = $ this -> cache -> get ( 'Eureka.Component.Config.Test.' . $ env . '.' . md5 ( $ file ) . '.cache' ) ; } if ( empty ( $ config ) ) { i... | Get config value for config var specified . |
232,985 | public function loadYamlFromDirectory ( $ directory , $ namespace = 'global.' , $ environment = null ) { if ( $ environment === null ) { $ environment = $ this -> environment ; } foreach ( glob ( $ directory . '/*.yml' ) as $ filename ) { $ this -> load ( $ filename , $ namespace . basename ( $ filename , '.yml' ) , ne... | Load yaml files froem given directory . |
232,986 | private function replaceReferences ( array & $ config ) { foreach ( $ config as $ key => & $ value ) { if ( is_array ( $ value ) ) { $ this -> replaceReferences ( $ value ) ; continue ; } if ( ! is_string ( $ value ) ) { continue ; } if ( ! ( bool ) preg_match ( '`%(.*?)%`' , $ value , $ matches ) ) { continue ; } $ re... | Replace references values in all configurations . |
232,987 | public function findCalculateDate ( Range $ interval ) : array { $ result = [ ] ; if ( ! isset ( $ this -> isCalculated [ ( string ) $ interval ] ) ) { $ this -> isCalculated [ ( string ) $ interval ] = true ; if ( $ interval -> to -> format ( 'Y-m-d' ) >= ( new DateTime ) -> format ( 'Y-m-d' ) ) { $ last = $ this -> c... | Vrati datum ktere je treba prepocitat |
232,988 | public static function isBool ( & $ var = null ) : bool { $ parse = filter_var ( $ var , FILTER_VALIDATE_BOOLEAN , FILTER_NULL_ON_FAILURE ) ; if ( $ parse !== null ) { $ var = $ parse ; return true ; } return false ; } | Check if var is boolean and parseBool by ref |
232,989 | protected function obtenerConfiguracionDominio ( $ destino , $ fichero ) { $ yaml = new \ Symfony \ Component \ Yaml \ Parser ( ) ; $ valor = $ yaml -> parse ( file_get_contents ( $ fichero ) ) ; $ parametros = $ valor [ 'ldapPM' ] ; if ( $ parametros [ 'solo_default' ] ) { } else { return $ parametros [ 'servidores' ]... | Recoge la configuracion del dominio dado |
232,990 | public function run ( $ console = false ) { $ commands = $ this -> commands ; is_string ( $ commands ) && $ commands = $ this -> classes ( ) ; foreach ( ( array ) $ commands as $ command ) { $ item = $ this -> container -> get ( $ command ) ; $ this -> console -> add ( $ instance = $ item ) ; } $ console === false && $... | Runs the console instance . |
232,991 | protected function classes ( ) { list ( $ items , $ pattern ) = array ( array ( ) , '/\\.[^.\\s]{3,4}$/' ) ; $ files = glob ( $ this -> commands . '/*.php' ) ; $ path = strlen ( $ this -> commands . DIRECTORY_SEPARATOR ) ; foreach ( ( array ) $ files as $ file ) { $ substring = substr ( $ file , $ path ) ; $ class = pr... | Returns an array of command classes . |
232,992 | protected function parse ( $ file ) { $ search = '%%CURRENT_DIRECTORY%%' ; $ yaml = file_get_contents ( $ file ) ; $ yaml = str_replace ( $ search , $ this -> root , $ yaml ) ; $ result = Yaml :: parse ( $ yaml ) ; $ this -> commands = $ result [ 'paths' ] [ 'commands' ] ; $ this -> namespace = $ result [ 'namespaces' ... | Parses the YAML file . |
232,993 | public function needsToRun ( ) { $ this -> initializeVersions ( ) ; if ( empty ( $ this -> migratedVersions ) && empty ( $ this -> availableVersions ) ) { return false ; } $ needsToRun = $ this -> hasUnmigratedVersions ( ) ; return $ needsToRun ; } | Flags if migrations need to be executed |
232,994 | private function initializeVersions ( ) { $ env = $ this -> manager -> getEnvironment ( $ this -> environment ) ; $ this -> migratedVersions = $ env -> getVersions ( ) ; $ this -> availableVersions = $ this -> manager -> getMigrations ( ) ; $ this -> currentVersion = $ env -> getCurrentVersion ( ) ; } | Initializes the migrated available and current versions |
232,995 | private function hasUnmigratedVersions ( ) { $ needsToRun = false ; foreach ( $ this -> availableVersions as $ migration ) { $ isTargetMigrated = in_array ( $ migration -> getVersion ( ) , $ this -> migratedVersions ) ; if ( $ isTargetMigrated ) { continue ; } $ needsToRun = true ; break ; } return $ needsToRun ; } | Flags if unmigrated versions exists |
232,996 | private function AddPasswordField ( ) { $ name = 'Password' ; $ this -> AddField ( Input :: Password ( $ name ) ) ; $ this -> AddValidator ( $ name , new StringLength ( 6 , 20 ) ) ; if ( Request :: PostData ( 'PasswordRepeat' ) || ! $ this -> user -> Exists ( ) ) { $ this -> SetRequired ( $ name ) ; } } | Adds the password field |
232,997 | public function removeValue ( $ key ) { if ( ! $ this -> isValid ( ) ) { throw new \ LogicException ( 'Session is in an invalid state.' ) ; } if ( $ this -> storage -> hasValue ( $ key ) ) { $ this -> storage -> removeValue ( $ key ) ; return true ; } return false ; } | removes a value from the session |
232,998 | public function valueKeys ( ) { if ( ! $ this -> isValid ( ) ) { throw new \ LogicException ( 'Session is in an invalid state.' ) ; } return array_values ( array_filter ( $ this -> storage -> valueKeys ( ) , function ( $ valueKey ) { return substr ( $ valueKey , 0 , 11 ) !== '__stubbles_' ; } ) ) ; } | return an array of all keys registered in this session |
232,999 | public function get ( string $ name = null ) : Database { return new Database ( $ this -> connections -> get ( $ name ) ) ; } | returns the database |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.