idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
15,100 | public function isPassedByReference ( ) { if ( $ class = $ this -> reflection -> getClass ( ) and $ class -> isTrait ( ) ) { return true ; } if ( $ class = $ this -> reflection -> getClass ( ) ) { $ reflection = ( new ReflectionClass ( $ class ) ) -> getConstructor ( ) ; foreach ( $ reflection -> getParameters ( ) as $... | Guesstimate if the argument should be passed by reference . This is true for objects with constructor parameters without defaults as well as other non - guessable defaults . |
15,101 | public function getDefault ( ) { if ( $ this -> reflection -> isDefaultValueAvailable ( ) and $ default = $ this -> reflection -> getDefaultValue ( ) ) { if ( is_scalar ( $ default ) ) { return $ default ; } else { return $ this -> tostring ( $ default ) ; } } if ( $ this -> reflection -> isArray ( ) ) { return '[]' ; ... | Return the default value for the requested parameter . |
15,102 | private function getType ( ) { if ( $ class = $ this -> reflection -> getClass ( ) ) { return $ class -> name ; } if ( $ this -> reflection -> isArray ( ) ) { return 'array' ; } if ( version_compare ( phpversion ( ) , '7.0' , '>=' ) and $ type = $ this -> reflection -> getType ( ) ) { return $ type ; } return '' ; } | Internal helper method to guesstimate the argument s type hint . |
15,103 | private function tostring ( $ value ) { if ( ! isset ( $ value ) ) { return 'null' ; } if ( $ value === true ) { return 'true' ; } if ( $ value === false ) { return 'false' ; } if ( is_array ( $ value ) ) { $ out = '[' ; $ i = 0 ; foreach ( $ value as $ key => $ entry ) { if ( $ i ) { $ out .= ', ' ; } $ out .= $ key .... | Internal helper method to render a PHP variable as a string . |
15,104 | public function setFileName ( $ fileName ) { $ this -> fileName = $ fileName ; $ this -> setContentType ( mime_content_type ( $ this -> fileName ) ) ; } | Sets the name of the file that contains the image . |
15,105 | public function setSlides ( SS_List $ slides ) { $ list = ArrayList :: create ( ) ; foreach ( $ slides as $ slide ) { $ list -> push ( $ slide -> setParentInstance ( $ this ) ) ; } $ this -> slides = $ list ; } | Defines the slides property for the receiver . |
15,106 | public function getWrapperAttributes ( ) { $ attributes = [ 'id' => $ this -> WrapperID , 'class' => $ this -> WrapperClass ] ; $ this -> extend ( 'updateWrapperAttributes' , $ attributes ) ; $ attributes = array_merge ( $ attributes , $ this -> getWrapperDataAttributes ( ) ) ; return $ attributes ; } | Answers an array of HTML tag attributes for the wrapper . |
15,107 | public static function toObject ( $ object ) { if ( ! is_object ( $ object ) && ! is_array ( $ object ) && ! ( $ object instanceof \ Traversable ) ) { return null ; } if ( is_array ( $ object ) ) { $ _properties = new \ stdClass ( ) ; foreach ( $ object as $ _key => $ _value ) { $ _properties -> { $ _key } = $ _value ;... | Dynamically generates the object from the declared properties of the given object or array |
15,108 | public static function createArray ( $ data ) { $ _result = array ( ) ; $ _count = func_num_args ( ) ; for ( $ _i = 0 ; $ _i < $ _count ; $ _i ++ ) { if ( null !== ( $ _arg = func_get_arg ( $ _i ) ) ) { if ( ! is_array ( $ _arg ) ) { $ _result [ ] = $ _arg ; } else { foreach ( $ _arg as $ _value ) { $ _result [ ] = $ _... | Takes parameters and returns an array of the values . |
15,109 | public static function toArray ( $ object ) { if ( is_object ( $ object ) ) { return get_object_vars ( $ object ) ; } if ( is_array ( $ object ) ) { return array_map ( array ( __CLASS__ , 'toArray' ) , $ object ) ; } return $ object ; } | Down and dirty object to array function |
15,110 | public static function kvpToString ( $ array , $ uppercaseKeys = false , $ trueConvert = 1 , $ falseConvert = 0 ) { $ _result = array ( ) ; foreach ( Option :: clean ( $ array ) as $ _key => $ _value ) { if ( null !== $ _value ) { if ( false === $ _value ) { $ _value = $ falseConvert ; } else if ( true === $ _value ) {... | Takes a KVP traversable and converts to a key = value string suitable for framing . |
15,111 | public static function all ( $ parent ) { is_eloquent_object ( $ parent , true ) ; $ cache = static :: getCache ( ) ; if ( isset ( $ cache [ $ parent ] ) ) { return $ cache [ $ parent ] ; } return [ ] ; } | Returns the cached relations for a given parent model . |
15,112 | public function bigActionButton ( $ linkText , array $ url , $ bgColor = '#368ee0' , $ textColor = "#ffffff" ) { return $ this -> _View -> element ( 'Wasabi/Core.Email/big-action-button' , [ 'linkText' => $ linkText , 'url' => $ this -> Url -> build ( $ url , true ) , 'bgColor' => $ bgColor , 'textColor' => $ textColor... | Render a big action button . |
15,113 | public function linkToCmsHomepage ( ) { return $ this -> Html -> link ( preg_replace ( '/https{0,1}:\/{2}/' , '' , $ this -> Url -> build ( '/' , true ) ) , $ this -> Url -> build ( '/' , true ) ) ; } | Link to the home page . |
15,114 | public function init ( ) { $ posts = array ( ) ; if ( ! $ posts = wp_cache_get ( 'sidebars' , 'custom_sidebars' ) ) { $ args = array ( 'post_type' => Custom_Sidebars :: get_post_types ( ) , 'meta_query' => array ( array ( 'key' => '_custom_sidebar' , 'value' => true , ) ) ) ; $ query = new WP_Query ( $ args ) ; if ( $ ... | The WP admin_init action callback |
15,115 | public static function get_sidebar ( $ post_id = null ) { if ( empty ( $ post_id ) ) { $ post_id = get_post ( ) -> ID ; } $ sidebar = get_post_meta ( $ post_id , '_custom_sidebar_id' , true ) ; if ( $ sidebar == false && isset ( self :: $ default_sidebar_id ) ) { $ sidebar = self :: $ default_sidebar_id ; } return $ si... | Get the sidebar_id assigned to a specific post |
15,116 | public function sidebars_widgets ( $ sidebar_widgets ) { if ( ! is_admin ( ) && ! empty ( $ this -> get_sidebar ( ) ) ) { foreach ( $ sidebar_widgets as $ key => $ widgets ) { $ sidebar_widgets [ $ key ] = $ sidebar_widgets [ $ this -> get_sidebar ( ) ] ; } } return $ sidebar_widgets ; } | Filter the sidebar widgets |
15,117 | private function createCreateForm ( Media $ entity ) { $ types = $ this -> container -> getParameter ( 'flowcode_media.media_types' ) ; $ class = $ types [ $ entity -> getMediaType ( ) ] [ "class_type" ] ; $ form = $ this -> createForm ( new $ class ( ) , $ entity , array ( 'action' => $ this -> generateUrl ( 'admin_me... | Creates a form to create a Media entity . |
15,118 | public function newAction ( $ type ) { $ entity = new Media ( ) ; $ entity -> setMediaType ( $ type ) ; $ form = $ this -> createCreateForm ( $ entity ) ; return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ; } | Displays a form to create a new Media entity . |
15,119 | public function addArgument ( IArgument $ arg ) : IRequest { if ( $ arg instanceof IMergeableArgument ) { if ( ! isset ( $ this -> mergeableArguments [ $ arg -> getKey ( ) ] ) ) { $ this -> mergeableArguments [ $ arg -> getKey ( ) ] = new ArgMerger ( $ arg :: glue ( ) ) ; } $ this -> mergeableArguments [ $ arg -> getKe... | Add a request argument . |
15,120 | public function removeArgument ( IArgument $ arg ) : IRequest { if ( $ arg instanceof IMergeableArgument ) { if ( ! isset ( $ this -> mergeableArguments [ $ arg -> getKey ( ) ] ) ) { throw new \ InvalidArgumentException ( "This argument doesn't exists" ) ; } $ this -> mergeableArguments [ $ arg -> getKey ( ) ] -> remov... | Remove a request argument . |
15,121 | public function requestOptions ( ) : array { if ( $ this -> requestType ( ) -> is ( RequestType :: HTTP_GET ( ) ) ) { return [ ] ; } $ options = [ RequestOptions :: JSON => $ this -> toArray ( ) , ] ; return $ options ; } | Options for this request to be used by the client . |
15,122 | private function generateUrl ( ) : string { static $ re = '/\%5B\d+\%5D/m' ; static $ subst = '%5B%5D' ; $ query = [ ] ; foreach ( $ this -> arguments as $ key => $ value ) { $ query [ $ key ] = $ value -> toPrimitive ( ) ; } foreach ( $ this -> mergeableArguments as $ key => $ value ) { $ query [ $ key ] = $ value -> ... | Generate the URL |
15,123 | public function handle ( Request $ request ) { try { $ this -> loadConfiguration ( ) ; $ calls = $ this -> resolveController ( $ request ) ; $ controller = $ calls [ 'controller' ] ; $ callable = $ calls [ 'callable' ] ; $ res = $ controller -> $ callable ( ) ; if ( is_a ( $ res , 'Symfony\Component\HttpFoundation\Resp... | Handles request . |
15,124 | public function loadConfig ( $ fileName ) { if ( file_exists ( $ fileName ) ) { $ file = file_get_contents ( $ fileName ) ; } else { if ( file_exists ( $ this -> getRootDir ( ) . '/config/' . $ fileName ) ) { $ file = file_get_contents ( $ this -> getRootDir ( ) . '/config/' . $ fileName ) ; } else { throw new \ Invali... | Loads app Configuration . |
15,125 | public function resolveController ( Request $ request ) { $ route = $ this -> getRouting ( $ request ) -> resolveRoute ( ) ; $ controllerClass = $ route -> getController ( ) ; $ callable = $ route -> getCalls ( ) ; if ( ! empty ( $ controllerClass ) ) { if ( ! class_exists ( $ controllerClass ) ) { throw new \ Exceptio... | Resolves controller for a given request . |
15,126 | public function getRouting ( Request $ request ) { if ( $ this -> getConfig ( ) -> hasParameter ( 'routing' ) ) { $ routerClass = $ this -> getConfig ( ) -> getParameter ( 'routing' ) ; $ router = new $ routerClass ( ) ; return $ router ; } $ router = new Router ( $ request ) ; return $ router ; } | Gets routing system . |
15,127 | private function parsePath ( ) { $ components = array ( ) ; $ uri = $ this -> getUri ( ) ; if ( $ uri !== false ) { Logger :: get ( ) -> debug ( 'Parsing URI: ' . $ uri ) ; $ components = $ this -> getHttpParameters ( ) ; $ matched = false ; foreach ( self :: getRoutes ( ) as $ route ) { if ( preg_match ( "#^{$route['u... | Extracts the responder action and parameter from an HTTP request . |
15,128 | public function getAcceptedContentTypes ( ) { if ( empty ( $ this -> acceptedContentTypes ) ) { $ this -> acceptedContentTypes = array ( ) ; $ acceptHeader = strtolower ( str_replace ( ' ' , '' , @ $ _SERVER [ 'HTTP_ACCEPT' ] ? : '*/*' ) ) ; $ acceptHeaderItems = explode ( ',' , $ acceptHeader ) ; foreach ( $ acceptHea... | Reads the Accepted header in the request and returns a list of content types sorted by preference . |
15,129 | public function getLocale ( ) { if ( class_exists ( '\Locale' ) ) { $ locale = \ Locale :: acceptFromHttp ( @ $ _SERVER [ 'HTTP_ACCEPT_LANGUAGE' ] ) ; } if ( empty ( $ locale ) ) { $ locale = Application :: getSettings ( ) -> locale -> default ; } return $ locale ; } | Finds out which locale the request would want for the response . |
15,130 | public function getParameters ( ) { if ( is_null ( $ this -> parameters ) ) { $ this -> parameters = $ this -> parsePath ( ) ; } return $ this -> parameters ; } | Returns an array with all the request s parameters . |
15,131 | private function getUri ( ) { if ( empty ( $ this -> uri ) && ( $ this -> uri !== false ) ) { $ this -> uri = $ _SERVER [ 'REQUEST_URI' ] ; $ paramsStart = strpos ( $ this -> uri , '?' ) ; if ( $ paramsStart !== false ) { $ this -> uri = substr ( $ this -> uri , 0 , $ paramsStart ) ; } } return $ this -> uri ; } | Returns the current request s URI finding it out if needed . |
15,132 | private function getHttpParameters ( ) { if ( empty ( $ this -> httpParameters ) ) { $ uri = $ _SERVER [ 'REQUEST_URI' ] ; $ paramsStart = strpos ( $ uri , '?' ) ; if ( $ paramsStart !== false ) { parse_str ( substr ( $ uri , $ paramsStart + 1 ) , $ this -> httpParameters ) ; } $ this -> httpParameters = array_merge ( ... | Returns the parameters that came in the HTTP request . |
15,133 | public static function getRoutes ( ) { if ( empty ( self :: $ routes ) ) { if ( is_readable ( self :: ROUTES_FILE_LOCATION ) ) { self :: $ routes = json_decode ( file_get_contents ( self :: ROUTES_FILE_LOCATION ) , true ) ; } if ( empty ( self :: $ routes ) ) { throw new Exception ( 'No routes could be obtained. Please... | Returns the URL - Responder map . |
15,134 | public static function getContentTypeToken ( $ contentType ) { $ token = null ; switch ( $ contentType ) { case 'text/html' : $ token = 'Html' ; break ; case 'application/json' : case 'text/json' : $ token = 'Json' ; break ; case 'application/xml' : case 'text/xml' : $ token = 'Xml' ; break ; case 'image/png' : case 'i... | Produces a token that uniquely identifies a content type and can be used as part of a method name . |
15,135 | public function beginTransaction ( ) { if ( $ this -> inTransaction ) { return false ; } $ this -> inTransaction = $ this -> pdo -> beginTransaction ( ) ; return $ this -> inTransaction ; } | Normalize to only a single transactions . In order to take advantange of drivers that support nested transactions access the underlying PDO object directly . |
15,136 | public function connectTo ( $ schema ) { $ info = clone $ this -> getInfo ( ) ; $ info -> setSchema ( $ schema ) ; return new DatabaseConnection ( $ info ) ; } | Create a new database connection to the given schema using the same credentials and options as the current connection . The current connection is not closed . |
15,137 | public function exec ( $ statement ) { try { return $ this -> pdo -> exec ( $ statement ) ; } catch ( PDOException $ e ) { throw $ this -> exceptionAdapter -> adapt ( $ e , $ statement ) ; } } | Executes the given SQL query and returns a QueryResult object containing the results of the query . |
15,138 | public function prepare ( $ statement , $ driverOpts = null ) { if ( $ driverOpts === null ) { $ driverOpts = [ ] ; } try { $ stmt = $ this -> pdo -> prepare ( $ statement , $ driverOpts ) ; return new PreparedStatement ( $ stmt , $ this -> pdo , $ this -> exceptionAdapter ) ; } catch ( PDOException $ e ) { throw $ thi... | Create a prepared statement for the given query . |
15,139 | public function query ( $ statement ) { try { $ stmt = $ this -> pdo -> query ( $ statement ) ; return new QueryResult ( $ stmt , $ this -> pdo ) ; } catch ( PDOException $ e ) { throw $ this -> exceptionAdapter -> adapt ( $ e , $ statement ) ; } } | Issue a one - off SELECT statment . |
15,140 | protected function prepareQuery ( $ query , array $ bindings ) { if ( false !== strpos ( $ query , '%' ) && count ( $ bindings ) > 0 ) { $ query = $ this -> wpdb -> prepare ( $ query , $ this -> prepareBindings ( $ bindings ) ) ; } return $ query ; } | Prepares a SQL query for safe execution . |
15,141 | public function setQueryGrammar ( QueryGrammar $ grammar ) { $ this -> queryGrammar = $ grammar ; $ this -> queryGrammar -> setTablePrefix ( $ this -> wpdb -> prefix ) ; return $ this ; } | Set the query grammar used by the connection . |
15,142 | public function enableQueryLog ( ) { $ this -> loggingQueries = true ; if ( ! $ this -> logger ) { $ this -> setLogger ( new QueryLogger ) ; } return $ this ; } | Enable the query log on the connection . |
15,143 | public function add ( $ id , $ msg ) { if ( isset ( $ this -> errors [ $ id ] ) && ! is_array ( $ this -> errors [ $ id ] ) ) $ this -> errors [ $ id ] = array ( $ msg ) ; else $ this -> errors [ $ id ] [ ] = $ msg ; } | Manually add an error |
15,144 | public function css ( $ header = true ) { $ out = '' ; if ( count ( $ this -> errors ) > 0 ) { if ( $ header ) $ out .= '<style type="text/css" media="screen">' ; $ out .= "#" . implode ( ", #" , array_keys ( $ this -> errors ) ) . " { {$this->style} }" ; if ( $ header ) $ out .= '</style>' ; } echo $ out ; } | Outputs the CSS to style the error elements |
15,145 | public function ul ( $ class = 'warn' ) { if ( count ( $ this -> errors ) == 0 ) return '' ; $ out = "<ul class='$class'>" ; foreach ( $ this -> errors as $ error ) $ out .= "<li>" . implode ( "</li><li>" , $ error ) . "</li>" ; $ out .= "</ul>" ; return $ out ; } | Returns an unordered list of error messages |
15,146 | public function alert ( ) { if ( count ( $ this -> errors ) == 0 ) return '' ; $ out = '' ; foreach ( $ this -> errors as $ error ) $ out .= "<p class='alert error'>" . implode ( ' ' , $ error ) . "</p>" ; return $ out ; } | Returns error alerts |
15,147 | public function length ( $ val , $ lower , $ upper , $ id , $ name = null ) { if ( strlen ( $ val ) < $ lower ) { if ( is_null ( $ name ) ) $ name = ucwords ( $ id ) ; $ this -> add ( $ id , "$name must be at least $lower characters." ) ; return false ; } elseif ( strlen ( $ val ) > $ upper ) { if ( is_null ( $ name ) ... | Is a string an appropriate length? |
15,148 | public function passwords ( $ pass1 , $ pass2 , $ id ) { if ( $ pass1 !== $ pass2 ) { $ this -> add ( $ id , 'The passwords you entered do not match.' ) ; return false ; } return true ; } | Do the passwords match? |
15,149 | public function regex ( $ val , $ regex , $ id , $ msg ) { if ( preg_match ( $ regex , $ val ) === 0 ) { $ this -> add ( $ id , $ msg ) ; return false ; } return true ; } | Does a value match a given regex? |
15,150 | public function email ( $ val , $ id = 'email' ) { if ( ! preg_match ( "/^([_a-z0-9+-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i" , $ val ) ) { $ this -> add ( $ id , 'The email address you entered is not valid.' ) ; return false ; } return true ; } | Is an email address valid? |
15,151 | public function date ( $ val , $ id ) { if ( chkdate ( $ val ) === false ) { $ this -> add ( $ id , 'Please enter a valid date' ) ; return false ; } return true ; } | Is a string a parseable and valid date? |
15,152 | public function adult ( $ val , $ id ) { if ( dater ( $ val ) > ( ( date ( 'Y' ) - 18 ) . date ( '-m-d H:i:s' ) ) ) { $ this -> add ( $ id , 'You must be at least 18 years old.' ) ; return false ; } return true ; } | Is a birth date at least 18 years old? |
15,153 | public function phone ( $ val , $ id ) { $ val = preg_replace ( '/[^0-9]/' , '' , $ val ) ; if ( strlen ( $ val ) != 7 && strlen ( $ val ) != 10 ) { $ this -> add ( $ id , 'Please enter a valid 7 or 10 digit phone number.' ) ; return false ; } return true ; } | Is a string a valid phone number? |
15,154 | private function _createValue ( $ name , $ type , $ label , $ value , $ help , $ formOptions , $ position ) { $ created = $ this -> configBuilder -> addValue ( 'demo' , 'demo' , $ name , $ type , $ label , $ value , $ help , $ formOptions , $ position ) ; if ( $ created ) { $ this -> output -> writeln ( sprintf ( '<inf... | Create a value |
15,155 | public function execute ( Request $ request ) { $ phases = [ 'prepare' , 'respond' , 'close' ] ; $ response = null ; foreach ( $ phases as $ phase ) { $ key = 0 ; if ( $ phase === 'respond' && is_null ( $ response ) ) { throw new StackException ; } else if ( $ phase === 'close' && $ key === 0 ) { $ response -> send ( )... | Loops through all registered middlewares until a response is returned . |
15,156 | private function addMiddleware ( $ middleware , $ args , $ push = true ) { $ instance = $ this -> resolve ( $ middleware ) ; $ types = $ this -> getTypes ( $ instance ) ; if ( ! count ( $ types ) ) { throw new InvalidArgumentException ( 'The first argument must be an instance of PrepareableInterface, RespondableInterfa... | Adds a middleware to aggregates |
15,157 | private function getTypes ( $ middleware ) { $ types = [ ] ; if ( $ middleware instanceof PrepareableInterface ) { $ types [ ] = 'prepareable' ; } if ( $ middleware instanceof RespondableInterface ) { $ types [ ] = 'respondable' ; } if ( $ middleware instanceof CloseableInterface ) { $ types [ ] = 'closeable' ; } retur... | Returns the applicable types for the middleware |
15,158 | private function resolve ( $ definition ) { return ! is_null ( $ this -> resolver ) ? $ this -> resolver -> resolve ( $ definition ) : $ definition ; } | Resolve the argument to an actual middleware instance |
15,159 | public function AddError ( $ errorMsg , $ fieldNames = NULL ) { $ errorMsgUtf8 = iconv ( mb_detect_encoding ( $ errorMsg , mb_detect_order ( ) , TRUE ) , "UTF-8" , $ errorMsg ) ; $ fieldNamesArr = $ fieldNames === NULL ? [ ] : ( gettype ( $ fieldNames ) == 'array' ? $ fieldNames : [ $ fieldNames ] ) ; $ newErrorRec = [... | Add form submit error and switch form result to zero - to error state . |
15,160 | public function & AddJsSupportFile ( $ jsRelativePath = '/fields/custom-type.js' , $ jsClassName = 'MvcCoreForm.FieldType' , $ constructorParams = [ ] ) { $ this -> jsSupportFiles [ ] = [ $ jsRelativePath , $ jsClassName , $ constructorParams ] ; return $ this ; } | Add supporting javascript file . |
15,161 | public static function isSupported ( $ encoding , $ convertEncoding = null ) { $ supportedEncodings = static :: getSupportedEncodings ( ) ; if ( ! in_array ( strtoupper ( $ encoding ) , $ supportedEncodings ) ) { return false ; } if ( $ convertEncoding !== null && ! in_array ( strtoupper ( $ convertEncoding ) , $ suppo... | Check if the given character encoding is supported by this wrapper and the character encoding to convert to is also supported . |
15,162 | public function convert ( $ str , $ reverse = false ) { $ encoding = $ this -> getEncoding ( ) ; $ convertEncoding = $ this -> getConvertEncoding ( ) ; if ( $ convertEncoding === null ) { throw new Exception \ LogicException ( 'No convert encoding defined' ) ; } if ( $ encoding === $ convertEncoding ) { return $ str ; ... | Convert a string from defined character encoding to the defined convert encoding |
15,163 | private static function page ( $ page , array $ details ) { if ( ( $ page === '*' && is_page ( ) ) || is_page ( $ page ) ) { self :: loadController ( $ details ) ; exit ; } } | Check for a specific page . |
15,164 | private static function search ( $ postType , array $ details ) { $ s = isset ( $ _GET [ 'post_type' ] ) ? $ _GET [ 'post_type' ] : false ; if ( $ s === $ postType && is_search ( ) ) { self :: loadController ( $ details ) ; exit ; } } | Check if we are loading a search page . |
15,165 | private static function loadController ( $ pointer ) { $ controllerData = $ pointer [ 'uses' ] ; $ parts = explode ( '@' , $ controllerData ) ; $ controller = "UltraPress\\Controllers\\$parts[0]" ; $ method = $ parts [ 1 ] ; $ obj = new $ controller ; $ obj -> $ method ( ) ; } | Get a controller action from the supplied string . |
15,166 | public function & createStorage ( string $ storage_name ) : ConfigStorage { if ( isset ( $ this -> storage [ $ storage_name ] ) ) { return $ this -> getStorage ( $ storage_name ) ; } $ storage = new ConfigStorage ( ) ; $ storage -> setName ( $ storage_name ) ; $ this -> storage [ $ storage_name ] = $ storage ; return $... | Creates a named config storage object adds it to the storages list and returns a reference to it . |
15,167 | public function set ( string $ storage_name , string $ key , $ val ) { $ this -> storage [ $ storage_name ] -> set ( $ key , $ val ) ; } | Set a cfg value . |
15,168 | public function exists ( $ storage_name , $ key = null ) { if ( ! isset ( $ this -> storage [ $ storage_name ] ) ) { return false ; } if ( ! isset ( $ key ) ) { return true ; } return isset ( $ this -> storage [ $ storage_name ] -> { $ key } ) && ! empty ( $ this -> storage [ $ storage_name ] -> { $ key } ) ; } | Checks the state of a cfg setting |
15,169 | public function load ( $ refresh = false ) { $ results = $ this -> repository -> read ( ) ; foreach ( $ results as $ config ) { $ storage = $ this -> createStorage ( $ config -> getStorage ( ) ) ; $ storage -> set ( $ config -> getId ( ) , $ config -> getValue ( ) ) ; } } | Loads config from database |
15,170 | public function setCss ( $ css ) { if ( is_array ( $ css ) ) $ css = implode ( ' ' , $ css ) ; $ this -> css = $ css ; return $ this ; } | Sets css classes to be used in menulink . Argument can an array and will be transformed into a string |
15,171 | public function setOption ( $ option , $ value = '' ) { if ( is_array ( $ option ) ) { foreach ( $ option as $ key => $ value ) { $ this -> options [ $ key ] = $ value ; } } else { $ this -> options [ $ option ] = $ value ; } return $ this ; } | Sets one or more options . |
15,172 | public function getName ( array $ options = array ( ) ) { $ result = "" ; foreach ( $ this -> getUnitedTypes ( ) as $ type ) { if ( $ result !== "" ) $ result .= "|" ; $ result .= $ type -> getName ( ) ; } return $ result ; } | Gets the name of the union type . This name is canonical so two equal union types have the same name . |
15,173 | public function find ( $ view ) { $ view = str_replace ( '.' , DIRECTORY_SEPARATOR , $ view ) . '.php' ; foreach ( $ this -> locations as $ location ) { if ( is_file ( $ path = $ location . '/' . $ view ) ) { return $ path ; } } return false ; } | Search for the view and return the path |
15,174 | public function powerSupplyStatus ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> walk1d ( self :: OID_POWER_SUPPLY_STATUS ) ; if ( ! $ translate ) return $ states ; return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ POWER_SUPPLY_STATES ) ; } | Get the identifiers of the power supplies |
15,175 | public function powerSupplySource ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> walk1d ( self :: OID_POWER_SUPPLY_SOURCE ) ; if ( ! $ translate ) return $ states ; return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ POWER_SUPPLY_SOURCES ) ; } | The power supply unit input source . |
15,176 | public function systemPowerState ( $ translate = false ) { $ states = $ this -> getSNMP ( ) -> get ( self :: OID_SYSTEM_POWER_STATE ) ; if ( ! $ translate ) return $ states ; return $ this -> getSNMP ( ) -> translate ( $ states , self :: $ POWER_STATES ) ; } | The system power state |
15,177 | public function transform ( $ returnClass , $ config , $ values , $ local_config = null , $ result_type = 'object' ) { $ value = $ this -> setLocalConfig ( $ local_config ) -> process ( $ returnClass , $ config , $ values ) ; $ value = $ this -> converter -> convertTo ( $ value , $ result_type ) ; return $ value ; } | This method transforms an array an object or a json into the needed format . It will validate the structure and the values with reference to a given configuration array . |
15,178 | public function reverseTransform ( $ object , $ config , $ local_config = null , $ result_type = 'object' ) { $ value = $ this -> setLocalConfig ( $ local_config ) -> reverseProcess ( $ config , $ object ) ; $ value = $ this -> converter -> convertTo ( $ value , $ result_type ) ; return $ value ; } | This method reverses the transforming . |
15,179 | public function getEmptyObjectStructureFromConfig ( $ config , $ result_type = 'object' ) { $ value = $ this -> createEmptyObjectStructure ( $ config ) ; $ value = $ this -> converter -> convertTo ( $ value , $ result_type ) ; return $ value ; } | Creates the Structure of an Object with NULL - Values |
15,180 | public function convert ( $ value , $ to , array $ exclude = array ( ) , $ max_nesting_level = null ) { return $ this -> converter -> convertTo ( $ value , $ to , $ exclude , $ max_nesting_level ) ; } | Converts a value to an other format . |
15,181 | public function aliases ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_ALIASES , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets aliases from cat api |
15,182 | public function allocation ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_ALLOCATION , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets allocation from cat api |
15,183 | public function count ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_COUNT , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets count from cat api |
15,184 | public function fielddata ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_FIELDDATA , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets fielddata from cat api |
15,185 | public function health ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_HEALTH , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets health from cat api |
15,186 | public function indices ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_INDICES , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets indices from cat api |
15,187 | public function master ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_MASTER , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets master from cat api |
15,188 | public function nodes ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_NODES , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets nodes from cat api |
15,189 | public function pendingTasks ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_PENDING_TASKS , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets pending tasks from cat api |
15,190 | public function plugins ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_PLUGINS , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets plugins from cat api |
15,191 | public function recovery ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_RECOVERY , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets recovery from cat api |
15,192 | public function segments ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_SEGMENTS , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets segments from cat api |
15,193 | public function shards ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_SHARDS , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets shards from cat api |
15,194 | public function threadPool ( ) { $ request = $ this -> createRequestInstance ( self :: CAT_THREAD_POOL , null , null ) ; return $ this -> client -> send ( $ request ) ; } | Gets thread pool from cat api |
15,195 | protected function getClass ( $ class ) { if ( ClientVersionMapInterface :: VERSION_V090X === $ this -> versionFolder ) { throw new RepositoryException ( 'Version folder ' . ClientVersionMapInterface :: VERSION_V090X . ' is not allowed for cat repository' ) ; } return parent :: getClass ( $ class ) ; } | gets the right class string of a version |
15,196 | protected function installFromFile ( ) { if ( ! file_exists ( $ path = base_path ( 'components.json' ) ) ) { $ this -> error ( "File 'components.json' does not exist in your project root." ) ; return ; } $ components = Json :: make ( $ path ) ; $ dependencies = $ components -> get ( 'require' , [ ] ) ; foreach ( $ depe... | Install components from components . json file . |
15,197 | protected function install ( $ name , $ version = 'dev-master' , $ type = 'composer' , $ tree = false ) { $ installer = new Installer ( $ name , $ version , $ type ? : $ this -> option ( 'type' ) , $ tree ? : $ this -> option ( 'tree' ) ) ; $ installer -> setRepository ( $ this -> laravel [ 'components' ] ) ; $ install... | Install the specified component . |
15,198 | protected function getWebPath ( $ output ) { $ path = trim ( dirname ( $ output ) , '/' ) ; $ count = count ( explode ( '/' , $ path ) ) ; $ path = '' ; for ( $ i = 0 ; $ i < $ count - 1 ; $ i ++ ) { $ path .= '/..' ; } return $ path ; } | Computes the relative path within the web root folder . Expects the standard hive - app project layout . |
15,199 | public function add ( $ request ) { $ tickets = $ this -> registration -> Event ( ) -> getAvailableTickets ( ) ; $ form = $ this -> AttendeeForm ( ) ; if ( ! $ tickets -> count ( ) ) { return $ this -> redirect ( $ this -> BackURL ) ; } $ formHasData = $ form -> hasSessionData ( ) ; $ attendee = $ this -> createAttende... | Add action renders the add attendee form . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.