idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
231,800 | public function setRole ( $ role_id ) { if ( ! empty ( $ role_id ) && $ this -> policy === Rule :: NOINHERIT ) throw new Exception ( "Rule::NOINHERIT can not be used in combination with a role" ) ; if ( $ role_id instanceof Role ) { $ this -> role = $ role_id ; $ role_id = $ role_id -> getID ( ) ; } elseif ( ! is_scala... | Set the role this Rule applies to . |
231,801 | public function setEntity ( $ entity_id ) { if ( $ entity_id instanceof Entity ) { $ this -> entity = $ entity_id ; $ entity_id = $ entity_id -> getID ( ) ; } elseif ( ! is_scalar ( $ entity_id ) ) throw new Exception ( "Entity-ID must be an Entity or a scalar" ) ; if ( $ entity_id !== $ this -> entity_id ) { $ this ->... | Set the entity this Rule applies to |
231,802 | public function setPolicy ( int $ policy ) { if ( ! ( $ policy === Rule :: ALLOW || $ policy === Rule :: DENY || $ policy === Rule :: INHERIT || $ policy === Rule :: NOINHERIT ) ) throw new Exception ( "Policy must be either Rule::ALLOW, Rule::DENY, Rule::INHERIT or Rule::NOINHERIT" ) ; if ( $ policy === Rule :: NOINHE... | Set the policy on the entity |
231,803 | public function setAction ( string $ action ) { if ( ! empty ( $ action ) && $ this -> policy === Rule :: NOINHERIT ) throw new Exception ( "Rule::NOINHERIT can not be used in combination with an action" ) ; $ action = ( string ) $ action ; if ( $ action !== $ this -> action ) { $ validator = $ this -> acl -> getAction... | Set the action on the entity |
231,804 | public static function isRegistered ( $ runtime = false ) { $ extension = $ runtime ? self :: EXTN_RUNTIME : self :: EXTN_HANDLEBARS ; return isset ( V8Js :: getExtensions ( ) [ $ extension ] ) ; } | Returns true if the handlebars has been registered with V8Js |
231,805 | public static function registerHandlebarsExtension ( $ source , $ runtime = false ) { if ( ! self :: isRegistered ( $ runtime ) ) { $ extension = $ runtime ? self :: EXTN_RUNTIME : self :: EXTN_HANDLEBARS ; V8Js :: registerExtension ( $ extension , $ source , [ ] , false ) ; } } | Registers handlebars script with V8Js |
231,806 | public static function create ( $ runtime = false , $ extensions = [ ] , $ report_uncaught_exceptions = true ) { return new Handlebars ( $ runtime , $ extensions , $ report_uncaught_exceptions ) ; } | Returns configured Handlebars instance |
231,807 | public function precompile ( $ template , $ options = [ ] ) { if ( $ this -> isRuntime ) { throw new \ BadMethodCallException ( "Cannot precompile templates using runtime" ) ; } $ this -> v8 -> template = $ template ; $ this -> v8 -> options = $ options ; return $ this -> v8 -> executeString ( 'jsHb.precompile(phpHb.te... | Precompiles a given template so it can be sent to the client and executed without compilation |
231,808 | public function registerPartial ( $ name , $ partial = false ) { $ partials = [ ] ; if ( is_array ( $ name ) ) { $ partials = $ name ; } elseif ( is_object ( $ name ) ) { $ partials = get_object_vars ( $ name ) ; } if ( count ( $ partials ) ) { $ this -> registerPhpArray ( 'partial' , $ partials ) ; } elseif ( $ partia... | Registers partials accessible by any template in the environment |
231,809 | public function registerHelper ( $ name , $ helper = false ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ n => $ helper ) { $ this -> registerHelper ( $ n , $ helper ) ; } } elseif ( is_object ( $ name ) ) { $ this -> registerJavascriptObject ( 'helper' , $ this -> wrapHelperObject ( $ name ) ) ; } elseif ( $ h... | Registers helpers accessible by any template in the environment |
231,810 | public function registerDecorator ( $ name , $ decorator ) { if ( is_object ( $ name ) ) { $ this -> registerJavascriptObject ( 'decorator' , $ this -> wrapDecoratorObject ( $ name ) ) ; } elseif ( $ decorator === false ) { $ this -> registerJavascriptObject ( 'decorator' , $ name ) ; } elseif ( is_callable ( $ decorat... | Registers a decorator accessible by any template in the environment |
231,811 | public static function is_int_val ( $ val ) { if ( is_int ( $ val ) ) return true ; if ( is_bool ( $ val ) ) return false ; if ( ! is_string ( $ val ) ) return false ; return ( string ) ( ( int ) $ val ) === $ val ; } | Check if the provided value contains an integer value . The value may be an int or anything convertable to an int . After conversion the string representation of the value before and after conversion are compared and if they are equal the value is considered a proper integral value . |
231,812 | public static function str ( $ obj , $ html = false , $ depth = 0 ) { if ( is_null ( $ obj ) ) return "NULL" ; if ( is_bool ( $ obj ) ) return $ obj ? "TRUE" : "FALSE" ; if ( is_scalar ( $ obj ) ) return ( string ) $ obj ; $ str = "" ; if ( $ obj instanceof Throwable ) { $ str = self :: exceptionToString ( $ obj ) ; } ... | Convert any object to a string representation . |
231,813 | public static function sprint_r ( $ obj ) { ob_start ( ) ; print_r ( $ obj ) ; $ str = ob_get_contents ( ) ; ob_end_clean ( ) ; $ str = preg_replace ( "/\s+\\(\s+/" , " ( " , $ str ) ; $ str = preg_replace ( "/\n\s+/" , ", " , $ str ) ; $ str = preg_replace ( "/\n\s*\\)/" , " )" , $ str ) ; return $ str ; } | Format an object using print_r formatting to a singe line object notation |
231,814 | public static function debug ( string $ format ) { if ( ! is_resource ( self :: $ debug_stream ) ) self :: $ debug_stream = fopen ( 'php://output' , 'w' ) ; $ args = func_get_args ( ) ; foreach ( $ args as $ idx => & $ arg ) { if ( $ idx === 0 ) $ arg .= PHP_SAPI === 'cli' ? "\n" : "<br>\n" ; if ( ! is_scalar ( $ arg )... | Log an output message to a specified stream |
231,815 | public static function fillPlaceholders ( string $ msg , array $ values ) { foreach ( $ values as $ key => $ value ) $ msg = str_replace ( '{' . $ key . '}' , self :: str ( $ value ) , $ msg ) ; return $ msg ; } | Fill a placeholder string |
231,816 | public static function clamp ( int $ value , int $ min , int $ max ) { return $ value < $ min ? $ min : ( $ value > $ max ? $ max : $ value ) ; } | Restrict the value to a specific valid range . |
231,817 | protected static function translateParsedLocaleToAppValue ( \ stdClass $ parsedLocale ) { if ( ! static :: $ windowsPlatform ) { $ result = $ parsedLocale ; } else { $ result = ( object ) array_merge ( [ ] , ( array ) $ parsedLocale ) ; if ( ! static :: $ LANGS ) static :: prepareWinConfigOppositeArrays ( ) ; $ langAnd... | Translate parsed system locale value into application locale value . Do not translate anything on non - windows plaforms but translate windows system locale value language terotiry and encoding combination into standard application values . |
231,818 | public function verifyAuthentication ( Registration $ registration , SignRequest $ request , SignResponse $ response ) { if ( ! $ this -> appId -> equals ( new AppId ( $ request -> appId ) ) ) { return AuthenticationVerificationResult :: appIdMismatch ( ) ; } if ( $ response -> errorCode > 0 ) { return AuthenticationVe... | Request signing of a sign request . Does not support U2F s sign counter system . |
231,819 | public function serialize ( ) { $ data = array ( ) ; foreach ( get_object_vars ( $ this ) as $ propertyName => $ propertyValue ) { $ data [ $ propertyName ] = $ propertyValue ; } return serialize ( $ data ) ; } | Implements of \ Serializable |
231,820 | public function unserialize ( $ str ) { $ data = @ unserialize ( $ str ) ; if ( $ data === false ) { throw new \ RuntimeException ( sprintf ( 'Can\'t unserialize model data: %s' , $ str ) ) ; } if ( ! is_array ( $ data ) ) { throw new \ RuntimeException ( sprintf ( 'Unserialized data must be array, "%s" given.' , getty... | Implements if \ Serializable |
231,821 | public function get ( $ key = false , $ default = false ) { if ( $ key === false ) { return $ this -> params ; } if ( ! $ this -> has ( $ key ) && $ default === false ) { return new Param ( $ key , null ) ; } if ( ! $ this -> has ( $ key ) && $ default !== false ) { return new Param ( $ key , $ default ) ; } return new... | Get param value by key or false for all params Optional set default if not found |
231,822 | protected function _getCurrentIterableKey ( & $ iterable ) { $ current = $ this -> _getCurrentIterableValue ( $ iterable ) ; return ( $ current instanceof KeyAwareInterface ) ? $ current -> getKey ( ) : key ( $ iterable ) ; } | Retrieves the key for the current element of an iterable . |
231,823 | private function registerOtherComposers ( ) { $ this -> composer ( 'auth::admin.roles._partials.permissions-checkbox' , 'Arcanesoft\Auth\ViewComposers\PermissionsComposer@composeRolePermissions' ) ; $ this -> composer ( 'auth::admin.users.index' , 'Arcanesoft\Auth\ViewComposers\RolesComposer@composeFilters' ) ; $ this ... | Register other view composers . |
231,824 | public function addField ( $ field , $ title , array $ rules = array ( ) ) { $ this -> _fields [ $ field ] = $ title ; if ( $ rules ) { foreach ( $ rules as $ rule => $ options ) { if ( is_numeric ( $ rule ) ) { $ rule = $ options ; $ options = array ( ) ; } $ this -> addRule ( $ field , $ rule , null , $ options ) ; }... | Add a field to be used in validation . Can optionally apply an array of validation rules . |
231,825 | public function addRule ( $ field , $ rule , $ message , $ options = array ( ) ) { if ( empty ( $ this -> _fields [ $ field ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Field %s does not exist' , $ field ) ) ; } if ( isset ( $ this -> _messages [ $ rule ] ) ) { $ message = $ message ? : $ this -> _messages [... | Add a validation rule to a field . Can supply an optional error message and options . |
231,826 | public function validate ( ) { if ( ! $ this -> _data ) { return false ; } $ fields = $ this -> getFields ( ) ; $ messages = $ this -> getMessages ( ) ; foreach ( $ this -> _data as $ field => $ value ) { if ( empty ( $ this -> _rules [ $ field ] ) ) { continue ; } foreach ( $ this -> _rules [ $ field ] as $ rule => $ ... | Validate the data against the rules schema . Return true if all fields passed validation . |
231,827 | public static function makeFromShorthand ( array $ data = array ( ) , array $ fields = array ( ) ) { $ obj = new static ( $ data ) ; foreach ( $ fields as $ field => $ data ) { $ title = $ field ; if ( is_string ( $ data ) ) { $ data = array ( 'rules' => $ data ) ; } else if ( ! is_array ( $ data ) ) { continue ; } els... | Create a validator instance from a set of shorthand or expanded rule sets . |
231,828 | public static function splitShorthand ( $ shorthand ) { $ rule = null ; $ message = '' ; $ opts = array ( ) ; if ( strpos ( $ shorthand , ':' ) !== false ) { $ parts = explode ( ':' , $ shorthand , 3 ) ; $ rule = $ parts [ 0 ] ; if ( ! empty ( $ parts [ 1 ] ) ) { $ opts = $ parts [ 1 ] ; if ( strpos ( $ opts , ',' ) !=... | Split a shorthand rule into multiple parts . |
231,829 | public function write ( Response $ response , $ value ) { $ cookie = $ this -> createCookieWithValue ( $ value ) ; $ response -> headers -> setCookie ( $ cookie ) ; return $ cookie ; } | Write a new value for the current cookie to a given Response . |
231,830 | public function read ( Request $ request ) { if ( ! $ request -> cookies -> has ( $ this -> cookieSettings -> getName ( ) ) ) { return null ; } return $ this -> createCookieWithValue ( $ request -> cookies -> get ( $ this -> cookieSettings -> getName ( ) ) ) ; } | Retrieve the current cookie from the Request if it exists . |
231,831 | public function redirect ( $ to , $ full = false ) { $ to = trim ( $ to , '/' ) ; if ( ! $ full && ! Str :: startsWith ( App :: $ Alias -> baseUrl , $ to ) ) { $ to = App :: $ Alias -> baseUrl . '/' . $ to ; } $ redirect = new FoundationRedirect ( $ to ) ; $ redirect -> send ( ) ; exit ( 'Redirecting to ' . $ to . ' ..... | Fast redirect in web environment |
231,832 | public function connect ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'CONNECT' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in CONNECT HTTP method . |
231,833 | public function delete ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'DELETE' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in DELETE HTTP method . |
231,834 | public function get ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'GET' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in GET HTTP method . |
231,835 | public function head ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'HEAD' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in HEAD HTTP method . |
231,836 | public function options ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'OPTIONS' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in OPTIONS HTTP method . |
231,837 | public function patch ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'PATCH' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in PATCH HTTP method . |
231,838 | public function post ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'POST' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in POST HTTP method . |
231,839 | public function purge ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'PURGE' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in PURGE HTTP method . |
231,840 | public function put ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'PUT' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in PUT HTTP method . |
231,841 | public function trace ( $ uri , $ handler , $ middlewares = array ( ) ) { return $ this -> add ( $ this -> route ( 'TRACE' , $ uri , $ handler , $ middlewares ) ) ; } | Adds a new route instance in TRACE HTTP method . |
231,842 | protected function route ( $ method , $ uri , $ handler , $ middlewares ) { if ( is_string ( $ handler ) === true ) { $ namespace = $ this -> namespace ; $ namespace !== '' && $ namespace .= '\\' ; $ handler = $ namespace . $ handler ; } return new Route ( $ method , $ uri , $ handler , $ middlewares ) ; } | Prepares a new route instance . |
231,843 | protected function getSentry ( Container $ container ) : callable { return function ( $ c ) { $ config = $ c [ 'config' ] ( 'suit.sentry' ) ; $ client = new \ Raven_Client ( $ config [ 'dsn' ] , $ config [ 'options' ] ?? [ ] ) ; $ client -> install ( ) ; if ( $ c -> has ( 'user' ) ) { $ client -> user_context ( ( array... | Add Sentry integration . |
231,844 | protected function setErrorHandler ( Container $ container ) : callable { return function ( Container $ container ) { return function ( ServerRequestInterface $ request , ResponseInterface $ response , Throwable $ e ) use ( $ container ) { $ container -> sentry -> captureException ( $ e ) ; if ( $ container -> has ( 'a... | Set error handler with sentry . |
231,845 | protected function prepare ( array $ product ) { $ data = array ( ) ; foreach ( $ this -> job [ 'data' ] [ 'header' ] as $ key => $ value ) { $ data [ $ key ] = isset ( $ product [ $ key ] ) ? $ product [ $ key ] : '' ; } $ this -> prepareImages ( $ data , $ product ) ; $ this -> preparePrice ( $ data , $ product ) ; $... | Prepares export data |
231,846 | public function up ( $ limit = 0 ) { $ migrations = $ this -> getNewMigrations ( ) ; if ( empty ( $ migrations ) ) { $ this -> messages [ ] = 'No new migration found. Your system is up-to-date.' ; return true ; } foreach ( $ migrations as $ migration ) { if ( ! $ this -> migrateUp ( $ migration ) ) { $ this -> messages... | Upgrades the application by applying new migrations . |
231,847 | protected function migrateUp ( $ class ) { if ( $ class === self :: BASE_MIGRATION ) { return true ; } $ this -> messages [ ] = "*** applying $class" ; $ start = microtime ( true ) ; $ migration = $ this -> createMigration ( $ class ) ; ob_start ( ) ; $ result = $ migration -> up ( ) ; $ messages = ob_get_contents ( ) ... | Upgrades with the specified migration class . |
231,848 | protected function getMigrationHistory ( $ limit ) { if ( $ this -> db -> schema -> getTableSchema ( $ this -> migrationTable , true ) === null ) { $ this -> createMigrationHistoryTable ( ) ; } $ query = new Query ; $ rows = $ query -> select ( [ 'version' , 'apply_time' ] ) -> from ( $ this -> migrationTable ) -> orde... | Returns the migration history . |
231,849 | public function locate ( $ source ) { $ sources = [ ] ; $ normalizedSources = [ ] ; $ endingWithWilCard = substr ( $ source , strlen ( $ source ) - 2 ) === '/*' ; if ( $ endingWithWilCard ) { $ source = substr ( $ source , 0 , strlen ( $ source ) - 2 ) ; } if ( is_dir ( $ source ) || $ endingWithWilCard ) { $ finder = ... | Locate a source either if it a file or a directory and normalize it . Return an array of SplFileInfo . |
231,850 | protected function getSourcesFromFinder ( $ source ) { $ array = explode ( DIRECTORY_SEPARATOR , $ source ) ; $ filename = array_pop ( $ array ) ; $ directory = $ source ; $ pattern = '*' ; if ( strstr ( $ filename , '.' ) !== false ) { $ pattern = $ filename ; $ directory = implode ( '/' , $ array ) ; } $ finder = new... | Return files sources using the finder to allow wild wards . |
231,851 | private function removeLastSlash ( $ string ) { if ( '/' === substr ( $ string , strlen ( $ string ) - 1 ) ) { $ string = substr ( $ string , 0 , strlen ( $ string ) - 1 ) ; } return $ string ; } | Remove the last slash of the string . |
231,852 | public function SetContent ( Content $ content ) { $ this -> texts = array ( ) ; $ wordings = ContentWording :: Schema ( ) -> FetchByContent ( false , $ content ) ; foreach ( $ wordings as $ wording ) { $ prefix = Str :: Replace ( '-' , '.' , $ content -> GetType ( ) ) ; $ this -> texts [ $ prefix . '.' . $ wording -> ... | Set the current content to retrieve customized wording texts |
231,853 | public function GetReplacement ( $ placeholder ) { if ( isset ( $ this -> texts [ $ placeholder ] ) ) { return $ this -> texts [ $ placeholder ] ; } return $ this -> phpTranslator -> GetReplacement ( $ placeholder ) ; } | Gets the placeholder replacement text |
231,854 | public function decodePair ( string $ keyValuePair ) : array { if ( strpos ( $ keyValuePair , "+" ) !== false ) { $ keyValuePair = str_replace ( "+" , " " , $ keyValuePair ) ; } $ parts = explode ( "=" , $ keyValuePair , 2 ) ; $ key = rawurldecode ( $ parts [ 0 ] ) ; $ value = ( count ( $ parts ) === 1 ) ? null : rawur... | Decode a urlencoded parameter key value pair |
231,855 | public function decode ( $ query ) : array { foreach ( explode ( "&" , $ query ) as $ keyValuePair ) { list ( $ key , $ value ) = $ this -> decodePair ( $ keyValuePair ) ; $ this -> values -> addValue ( $ key , $ value ) ; } return $ this -> values -> getValues ( ) ; } | Decode a query string |
231,856 | public function crossJoin ( $ table , $ first = null , $ operator = null , $ second = null ) { if ( $ first ) { return $ this -> join ( $ table , $ first , $ operator , $ second , 'cross' ) ; } $ this -> joins [ ] = new JoinClause ( 'cross' , $ table ) ; return $ this ; } | Add a cross join clause to the query . |
231,857 | public function lock ( $ value = true ) { $ this -> lock = $ value ; if ( $ this -> lock ) { $ this -> useWritePdo ( ) ; } return $ this ; } | Lock the selected rows in the table . |
231,858 | public function getMemberUsers ( ) { $ memberTable = CmnTables :: getTableName ( CmnTables :: TABLE_GROUP_MEMBER ) ; return $ this -> hasMany ( User :: class , [ 'id' => 'userId' ] ) -> viaTable ( $ memberTable , [ 'groupId' => 'id' ] ) ; } | Return all the group member users . |
231,859 | public static function queryWithAuthor ( $ config = [ ] ) { $ config [ 'relations' ] [ ] = [ 'avatar' , 'modelContent' , 'modelContent.template' , 'modelContent.banner' , 'creator' ] ; $ config [ 'relations' ] [ ] = [ 'creator.avatar' => function ( $ query ) { $ fileTable = CoreTables :: getTableName ( CoreTables :: TA... | Return query to find the model with avatar content template banner author and author avatar . |
231,860 | public function addResourceItem ( ProductionMenuCollectionEvent $ event ) : void { $ menu = $ event -> getMenu ( ) ; $ group = $ event -> getGroup ( ) ; $ resources = $ this -> factory -> createItem ( 'menu_item.resources' , [ 'route' => 'bkstg_resource_index' , 'routeParameters' => [ 'production_slug' => $ group -> ge... | Add the resource menu items . |
231,861 | public function render ( ) { $ allMessages = [ 'danger' => array_unique ( array_merge ( $ this -> flashMessenger -> getErrorMessages ( ) , $ this -> flashMessenger -> getCurrentErrorMessages ( ) ) ) , 'success' => array_unique ( array_merge ( $ this -> flashMessenger -> getSuccessMessages ( ) , $ this -> flashMessenger... | Outputs message depending on flag |
231,862 | public function getInlinedHtml ( $ body ) { $ inliner = new \ TijsVerkoyen \ CssToInlineStyles \ CssToInlineStyles ; $ inliner -> setHtml ( $ body ) ; $ inliner -> setUseInlineStylesBlock ( ) ; return $ inliner -> convert ( ) ; } | sets body after mashing in inline styles this is the method for doing tagging simple now! |
231,863 | final public function execute ( $ bound_input_params = null ) { if ( ! is_array ( $ bound_input_params ) or empty ( $ bound_input_params ) ) { $ success = parent :: execute ( ) ; } else { $ success = parent :: execute ( $ this -> bindConversion ( $ bound_input_params ) ) ; } if ( is_null ( $ this -> _success ) ) { $ th... | Execute the prepared statement |
231,864 | public function getLogFiles ( $ count = 20 ) { $ files = glob ( storage_path ( 'logs/*' ) ) ; $ files = array_combine ( $ files , array_map ( "filemtime" , $ files ) ) ; arsort ( $ files ) ; $ files = array_map ( 'basename' , array_keys ( $ files ) ) ; return array_slice ( $ files , 0 , $ count ) ; } | Get log file list in storage . |
231,865 | public function getPrevPageUrl ( ) { if ( $ this -> pageOffset [ 'end' ] >= $ this -> getFilesize ( ) - 1 ) { return false ; } return [ 'file' => $ this -> file , 'offset' => $ this -> pageOffset [ 'end' ] ] ; } | Get previous page url . |
231,866 | public function tail ( $ seek ) { $ f = fopen ( $ this -> filePath , "rb" ) ; if ( ! $ seek ) { fseek ( $ f , - 1 , SEEK_END ) ; } else { fseek ( $ f , abs ( $ seek ) ) ; } $ output = '' ; while ( ! feof ( $ f ) ) { $ output .= fread ( $ f , 4096 ) ; } $ pos = ftell ( $ f ) ; fclose ( $ f ) ; $ logs = [ ] ; foreach ( $... | Get tail logs in log file . |
231,867 | protected function renderTableRow ( $ log ) { $ color = LogViewer :: $ levelColors [ $ log [ 'level' ] ] ?? 'black' ; $ index = uniqid ( ) ; $ button = '' ; if ( ! empty ( $ log [ 'trace' ] ) ) { $ button = "<a class=\"btn btn-primary btn-xs\" data-toggle=\"collapse\" data-target=\".trace-{$index}\"><i class=\"fa fa-in... | Render table row . |
231,868 | public function setMedia ( ChildMedia $ v = null ) { if ( $ v === null ) { $ this -> setMediaId ( NULL ) ; } else { $ this -> setMediaId ( $ v -> getId ( ) ) ; } $ this -> aMedia = $ v ; if ( $ v !== null ) { $ v -> addM2P ( $ this ) ; } return $ this ; } | Declares an association between this object and a ChildMedia object . |
231,869 | public function getMedia ( ConnectionInterface $ con = null ) { if ( $ this -> aMedia === null && ( $ this -> media_id != 0 ) ) { $ this -> aMedia = ChildMediaQuery :: create ( ) -> findPk ( $ this -> media_id , $ con ) ; } return $ this -> aMedia ; } | Get the associated ChildMedia object |
231,870 | public function setPage ( ChildPage $ v = null ) { if ( $ v === null ) { $ this -> setPageId ( NULL ) ; } else { $ this -> setPageId ( $ v -> getId ( ) ) ; } $ this -> aPage = $ v ; if ( $ v !== null ) { $ v -> addM2P ( $ this ) ; } return $ this ; } | Declares an association between this object and a ChildPage object . |
231,871 | public function getPage ( ConnectionInterface $ con = null ) { if ( $ this -> aPage === null && ( $ this -> page_id != 0 ) ) { $ this -> aPage = ChildPageQuery :: create ( ) -> findPk ( $ this -> page_id , $ con ) ; } return $ this -> aPage ; } | Get the associated ChildPage object |
231,872 | public static function determinePlugins ( $ packages , $ pluginsDir = 'plugins' , $ vendorDir = 'vendor' ) { $ plugins = [ ] ; foreach ( $ packages as $ package ) { if ( $ package -> getType ( ) !== 'skinny-plugin' ) { continue ; } $ ns = static :: primaryNamespace ( $ package ) ; $ path = $ vendorDir . DIRECTORY_SEPAR... | Find all plugins available . |
231,873 | public static function writeConfigFile ( $ configFile , $ plugins , $ root = null ) { $ root = $ root ? : dirname ( dirname ( $ configFile ) ) ; $ data = [ ] ; foreach ( $ plugins as $ name => $ pluginPath ) { $ pluginPath = str_replace ( '\\' , '/' , $ pluginPath ) ; $ pluginPath .= '/' ; $ pluginPath = str_replace ( ... | Rewrite the config file with a complete list of plugins . |
231,874 | public static function primaryNamespace ( $ package ) { $ primaryNs = null ; $ autoLoad = $ package -> getAutoload ( ) ; foreach ( $ autoLoad as $ type => $ pathMap ) { if ( $ type !== 'psr-4' ) { continue ; } $ count = count ( $ pathMap ) ; if ( $ count === 1 ) { $ primaryNs = key ( $ pathMap ) ; break ; } $ matches =... | Get the primary namespace for a plugin package . |
231,875 | public function install ( InstalledRepositoryInterface $ repo , PackageInterface $ package ) { parent :: install ( $ repo , $ package ) ; $ path = $ this -> getInstallPath ( $ package ) ; $ ns = static :: primaryNamespace ( $ package ) ; $ this -> updateConfig ( $ ns , $ path ) ; } | Installs specific plugin . |
231,876 | public function update ( InstalledRepositoryInterface $ repo , PackageInterface $ initial , PackageInterface $ target ) { parent :: update ( $ repo , $ initial , $ target ) ; $ ns = static :: primaryNamespace ( $ initial ) ; $ this -> updateConfig ( $ ns , null ) ; $ path = $ this -> getInstallPath ( $ target ) ; $ ns ... | Updates specific plugin . |
231,877 | public function updateConfig ( $ name , $ path ) { $ name = str_replace ( '\\' , '/' , $ name ) ; $ configFile = static :: configFile ( $ this -> vendorDir ) ; $ this -> ensureConfigFile ( $ configFile ) ; $ return = include $ configFile ; if ( is_array ( $ return ) && empty ( $ config ) ) { $ config = $ return ; } if ... | Update the plugin path for a given package . |
231,878 | protected function _modify ( ) { $ this -> _table -> alter ( 'MODIFY ' . $ this -> _database -> prepareIdentifier ( $ this -> _name ) . ' ' . $ this -> getDefinition ( ) ) ; } | Modify column in the database according to current properties |
231,879 | public function saveRoles ( $ inputRoles ) { if ( ! empty ( $ inputRoles ) ) { $ this -> roles ( ) -> sync ( $ inputRoles ) ; } else { $ this -> roles ( ) -> detach ( ) ; } } | Save the inputted roles . |
231,880 | private function extractEntry ( $ class ) { if ( $ class != $ this -> baseClass && ! is_subclass_of ( $ class , $ this -> baseClass ) ) { return false ; } if ( ! preg_match_all ( '~/?([a-zA-Z0-9]+)~' , $ class , $ namespaces ) ) { throw new \ Exception ( "Unexpected class {$class}." ) ; } $ prefix = $ suffix = null ; $... | Extracts the discriminator name from the given class . |
231,881 | public function validateAttribute ( $ model , $ attribute ) { $ value = $ model -> $ attribute ; $ result = $ this -> validateValue ( $ value ) ; if ( ! empty ( $ result ) ) { $ this -> addError ( $ model , $ attribute , $ this -> renderMessage ( $ model , $ attribute ) ) ; } } | Validates a single attribute . |
231,882 | private function renderMessage ( $ model , $ attribute ) { $ attributeLabel = $ model -> getAttributeLabel ( $ attribute ) ; $ message = strtr ( $ this -> message , [ '{attribute}' => $ attributeLabel ] ) ; return $ message ; } | Renders the attribute s error message . |
231,883 | public function findQuery ( $ strQuery ) { foreach ( $ this -> queries as $ query ) { if ( $ query -> matches ( $ strQuery ) ) { return $ query ; } } return null ; } | Try to find the query matching the given string . |
231,884 | public static function register ( $ action , $ closure ) { if ( false === is_string ( $ action ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ action ) ) , E_USER_ERROR ) ; } if ( false === is_object ( $ closure ) ) { return trigger_er... | Register a new template function |
231,885 | public function getException ( $ code ) { if ( ! isset ( $ this -> exceptions [ $ code ] ) ) { throw new Exceptions \ ExceptionNotDefinedException ( $ this , $ code ) ; } return $ this -> exceptions [ $ code ] ; } | Retrieve an exception class given code . |
231,886 | public function setColors ( $ textColor = null , $ fillColor = null ) { $ this -> desiredState -> setTextColor ( $ textColor ) ; $ this -> desiredState -> setFillColor ( $ fillColor ) ; return $ this ; } | Set both the fill and text colors |
231,887 | public function clear ( $ rightAway = false ) { $ this -> desiredState -> clear ( ) ; if ( $ rightAway ) { $ this -> output ( EscapeSequenceGenerator :: generateClearSequence ( ) ) ; $ this -> currentState = new TerminalState ( ) ; $ this -> desiredState = new TerminalState ( ) ; } return $ this ; } | Clear away all formatting - bold underscore text and fill color |
231,888 | public function outputEscapeSequence ( ) { $ this -> output ( $ this -> generator -> generate ( $ this -> currentState , $ this -> desiredState ) ) ; $ this -> currentState = clone $ this -> desiredState ; } | Send out the escape sequence which will accomplish the desired state |
231,889 | public function newLine ( $ count = 1 ) { $ this -> outputEscapeSequence ( ) ; if ( is_int ( $ count ) && $ count > 1 ) { for ( $ i = 0 ; $ i < $ count ; ++ $ i ) { $ this -> output ( "\n" ) ; } } else { $ this -> output ( "\n" ) ; } $ this -> carriageReturn ( ) ; return $ this ; } | Move the cursor to the next line This is not an ANSI sequence but rather the ASCII code 12 or \ n |
231,890 | public function clearScreen ( ) { $ this -> outputEscapeSequence ( ) ; $ this -> output ( EscapeSequenceGenerator :: generateClearScreenSequence ( ) ) ; $ this -> carriageReturn ( ) ; return $ this ; } | Clear the screen and move cursor to the top . |
231,891 | public function prompt ( $ text ) { $ this -> outputEscapeSequence ( ) ; $ prompt = $ text . $ this -> promptCaret . " " ; return $ this -> readUserInput ( $ prompt ) ; } | Prompt for a value . |
231,892 | public static function getScreenHeight ( ) { set_error_handler ( "self::errorHandler" , E_WARNING ) ; $ output = [ ] ; $ height = exec ( "tput lines 2>&1" , $ output ) ; if ( $ height == 0 || $ height == "" || is_null ( $ height ) ) { self :: errorHandler ( null , null ) ; } restore_error_handler ( ) ; return intval ( ... | Get the current screen height |
231,893 | public static function getScreenWidth ( ) { set_error_handler ( "self::errorHandler" , E_WARNING ) ; $ output = [ ] ; $ width = exec ( "tput cols 2>&1" , $ output ) ; if ( count ( $ output ) == 0 || $ width == 0 || $ width == "" || is_null ( $ width ) ) { self :: errorHandler ( null , null ) ; } restore_error_handler (... | Get the current screen width |
231,894 | public function sendContent ( ) { if ( ! $ this -> isSuccessful ( ) ) { return parent :: sendContent ( ) ; } if ( 0 === $ this -> maxlen ) { return $ this ; } $ out = fopen ( 'php://output' , 'wb' ) ; $ in = $ this -> resource -> getStream ( ) ; stream_copy_to_stream ( $ in , $ out , $ this -> maxlen , $ this -> offset... | Sends the resource . |
231,895 | public function open ( $ options = [ ] ) { $ options [ 'method' ] = self :: getMethod ( $ options ) ; $ options [ 'action' ] = self :: getAction ( $ options ) ; $ options [ 'accept-charset' ] = 'UTF-8' ; if ( isset ( $ options [ 'files' ] ) && $ options [ 'files' ] ) { $ options [ 'enctype' ] = 'multipart/form-data' ; ... | Open a new form object . |
231,896 | public function input ( $ type , $ name , $ value = '' , $ options = [ ] ) { if ( ! isset ( $ options [ 'id' ] ) ) { $ options [ 'id' ] = $ name ; } if ( ! empty ( $ value ) ) { $ options [ 'value' ] = $ value ; } $ options [ 'type' ] = $ type ; $ options [ 'name' ] = $ name ; return '<input' . $ this -> attributes ( $... | Creates a form input element . |
231,897 | public function textarea ( $ name , $ value = '' , $ options = [ ] ) { if ( ! isset ( $ options [ 'id' ] ) ) { $ options [ 'id' ] = $ name ; } $ options [ 'name' ] = $ name ; return '<textarea' . $ this -> attributes ( $ options ) . '>' . $ value . '</textarea>' ; } | Creates a textarea form input box . |
231,898 | private function getAction ( $ options ) { if ( isset ( $ options [ 'action' ] ) ) { $ action = $ this -> _generator -> to ( $ options [ 'action' ] ) ; } else { $ action = $ _SERVER [ 'REQUEST_URI' ] ; } return $ action ; } | Gets the form action . |
231,899 | private function getId ( $ options ) { $ id = '' ; if ( ! isset ( $ options [ 'id' ] ) ) { $ id = $ options [ 'name' ] ; } else { $ id = $ options [ 'id' ] ; } return $ id ; } | Gets an input s id or sets it if not supplied . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.