idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
57,900 | public function getAllowed ( $ file ) { $ commands = array ( ) ; foreach ( $ this -> getHandlers ( ) as $ id => $ command ) { if ( $ this -> isAllowed ( $ command , $ file ) ) { $ commands [ $ id ] = $ command ; } } return $ commands ; } | Returns an array of allowed commands for the given file |
57,901 | public function callHandler ( array $ command , $ method , $ args = array ( ) ) { try { $ handlers = $ this -> getHandlers ( ) ; return Handler :: call ( $ handlers , $ command [ 'command_id' ] , $ method , $ args ) ; } catch ( Exception $ ex ) { return $ ex -> getMessage ( ) ; } } | Call a command handler |
57,902 | public function submit ( array $ command , array $ args ) { $ result = ( array ) $ this -> callHandler ( $ command , 'submit' , $ args ) ; $ result += array ( 'redirect' => '' , 'message' => '' , 'severity' => '' ) ; return $ result ; } | Submit a command |
57,903 | public function getUrl ( ) { $ query = $ this -> getQueryString ( ) ; return sprintf ( '%s://%s/%s/%s%s' , $ this -> getScheme ( ) , trim ( $ this -> getHost ( ) , '/' ) , trim ( $ this -> config -> getRootEndpoint ( ) , '/' ) , $ this -> getEntityType ( ) , empty ( $ query ) ? '' : sprintf ( '?%s' , $ query ) ) ; } | Generates the request URL based on its current object state . |
57,904 | public function getQueryString ( ) { $ query = [ ] ; if ( ! empty ( $ this -> pagination ) ) { $ query [ self :: PARAM_PAGINATION ] = $ this -> pagination ; } if ( ! empty ( $ this -> filters ) ) { $ query [ self :: PARAM_FILTERING ] = $ this -> filters ; } foreach ( $ this -> fields as $ modelType => $ fields ) { $ qu... | Gets the query string based on the current object properties . |
57,905 | public function isAutocomplete ( ) { if ( false === $ this -> hasFilter ( self :: FILTER_AUTOCOMPLETE ) ) { return false ; } $ autocomplete = $ this -> getFilter ( self :: FILTER_AUTOCOMPLETE ) ; return isset ( $ autocomplete [ self :: FILTER_AUTOCOMPLETE_KEY ] ) && isset ( $ autocomplete [ self :: FILTER_AUTOCOMPLETE_... | Determines if this has an autocomplete filter enabled . |
57,906 | public function getAutocompleteKey ( ) { if ( false === $ this -> isAutocomplete ( ) ) { return null ; } return $ this -> getFilter ( self :: FILTER_AUTOCOMPLETE ) [ self :: FILTER_AUTOCOMPLETE_KEY ] ; } | Gets the autocomplete attribute key . |
57,907 | public function getAutocompleteValue ( ) { if ( false === $ this -> isAutocomplete ( ) ) { return null ; } return $ this -> getFilter ( self :: FILTER_AUTOCOMPLETE ) [ self :: FILTER_AUTOCOMPLETE_VALUE ] ; } | Gets the autocomplete search value . |
57,908 | public function isQuery ( ) { if ( false === $ this -> hasFilter ( self :: FILTER_QUERY ) ) { return false ; } $ query = $ this -> getFilter ( self :: FILTER_QUERY ) ; return isset ( $ query [ self :: FILTER_QUERY_CRITERIA ] ) ; } | Determines if this has the database query filter enabled . |
57,909 | public function getQueryCriteria ( ) { if ( false === $ this -> isQuery ( ) ) { return [ ] ; } $ queryKey = self :: FILTER_QUERY ; $ criteriaKey = self :: FILTER_QUERY_CRITERIA ; $ decoded = @ json_decode ( $ this -> getFilter ( $ queryKey ) [ $ criteriaKey ] , true ) ; if ( ! is_array ( $ decoded ) ) { $ param = sprin... | Gets the query criteria value . |
57,910 | public function getFilter ( $ key ) { if ( ! isset ( $ this -> filters [ $ key ] ) ) { return null ; } return $ this -> filters [ $ key ] ; } | Gets a specific filter by key . |
57,911 | private function parsePath ( $ path ) { $ parts = explode ( '/' , trim ( $ path , '/' ) ) ; for ( $ i = 0 ; $ i < 1 ; $ i ++ ) { if ( false === $ this -> issetNotEmpty ( $ i , $ parts ) ) { throw RestException :: invalidEndpoint ( $ path ) ; } } $ this -> extractEntityType ( $ parts ) ; $ this -> extractIdentifier ( $ ... | Parses the incoming request path and sets appropriate properties on this RestRequest object . |
57,912 | private function extractRelationship ( array $ parts ) { if ( isset ( $ parts [ 2 ] ) ) { if ( 'relationships' === $ parts [ 2 ] ) { if ( ! isset ( $ parts [ 3 ] ) ) { throw RestException :: invalidRelationshipEndpoint ( $ this -> parsedUri [ 'path' ] ) ; } $ this -> relationship = [ 'type' => 'self' , 'field' => $ par... | Extracts the entity relationship properties from an array of path parts . |
57,913 | private function parseQueryString ( $ queryString ) { parse_str ( $ queryString , $ parsed ) ; $ supported = $ this -> getSupportedParams ( ) ; foreach ( $ parsed as $ param => $ value ) { if ( ! isset ( $ supported [ $ param ] ) ) { throw RestException :: unsupportedQueryParam ( $ param , array_keys ( $ supported ) ) ... | Parses the incoming request query string and sets appropriate properties on this RestRequest object . |
57,914 | private function extractInclusions ( array $ params ) { if ( false === $ this -> issetNotEmpty ( self :: PARAM_INCLUSIONS , $ params ) ) { if ( true === $ this -> config -> includeAllByDefault ( ) ) { $ this -> inclusions = [ '*' => true ] ; } return $ this ; } $ inclusions = explode ( ',' , $ params [ self :: PARAM_IN... | Extracts relationship inclusions from an array of query params . |
57,915 | private function extractSorting ( array $ params ) { if ( false === $ this -> issetNotEmpty ( self :: PARAM_SORTING , $ params ) ) { return $ this ; } $ sort = explode ( ',' , $ params [ self :: PARAM_SORTING ] ) ; $ this -> sorting = [ ] ; foreach ( $ sort as $ field ) { $ direction = 1 ; if ( 0 === strpos ( $ field ,... | Extracts sorting criteria from an array of query params . |
57,916 | private function extractFields ( array $ params ) { if ( false === $ this -> issetNotEmpty ( self :: PARAM_FIELDSETS , $ params ) ) { return $ this ; } $ fields = $ params [ self :: PARAM_FIELDSETS ] ; if ( ! is_array ( $ fields ) ) { throw RestException :: invalidQueryParam ( self :: PARAM_FIELDSETS , 'The field param... | Extracts fields to return from an array of query params . |
57,917 | private function extractFilters ( array $ params ) { if ( false === $ this -> issetNotEmpty ( self :: PARAM_FILTERING , $ params ) ) { return $ this ; } $ filters = $ params [ self :: PARAM_FILTERING ] ; if ( ! is_array ( $ filters ) ) { throw RestException :: invalidQueryParam ( self :: PARAM_FILTERING , 'The filter p... | Extracts filtering criteria from an array of query params . |
57,918 | public function getSupportedParams ( ) { return [ self :: PARAM_INCLUSIONS => true , self :: PARAM_FIELDSETS => true , self :: PARAM_SORTING => true , self :: PARAM_PAGINATION => true , self :: PARAM_FILTERING => true , ] ; } | Gets query string parameters that this request supports . |
57,919 | public function userAction ( ) { $ page = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'page' ) ; $ userId = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'userId' ) ; $ user = \ SoliantEntityAudit \ Module :: getModuleOptions ( ) -> getEntityManager ( ) -> getRepository ( \ Sol... | Renders a paginated list of revisions for the given user |
57,920 | public function revisionEntityAction ( ) { $ this -> mapAllAuditedClasses ( ) ; $ page = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'page' ) ; $ revisionEntityId = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'revisionEntityId' ) ; $ revisionEntity = \ SoliantEntityAudit \ Mo... | Show the detail for a specific revision entity |
57,921 | public function entityAction ( ) { $ page = ( int ) $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'page' ) ; $ entityClass = $ this -> getEvent ( ) -> getRouteMatch ( ) -> getParam ( 'entityClass' ) ; return array ( 'entityClass' => $ entityClass , 'page' => $ page , ) ; } | Lists revisions for the supplied entity . Takes an audited entity class or audit class |
57,922 | private function packHeader ( int $ id , int $ offset , int $ size , int $ flags = 0 ) : string { return pack ( 'SSQI' , $ id , $ offset , $ size , $ flags ) ; } | Blocking method writes process result state to state file |
57,923 | public function & setDatabaseName ( $ database_name , $ select_database = true ) { if ( empty ( $ select_database ) || $ this -> link -> select_db ( $ database_name ) ) { $ this -> database_name = $ database_name ; } else { throw new ConnectionException ( "Failed to select database '$database_name'" ) ; } return $ this... | Set database name and optionally select that database . |
57,924 | private function tryToRecoverFromFailedQuery ( $ sql , $ arguments , $ load_mode , $ return_mode ) { switch ( $ this -> link -> errno ) { case 1196 : return null ; case 2006 : case 2013 : return $ this -> handleMySqlGoneAway ( $ sql , $ arguments , $ load_mode , $ return_mode ) ; case 1213 : return $ this -> handleDead... | Try to recover from failed query . |
57,925 | public function onLogQuery ( callable $ callback = null ) { if ( $ callback === null || is_callable ( $ callback ) ) { $ this -> on_log_query = $ callback ; } else { throw new InvalidArgumentException ( 'Callback needs to be NULL or callable' ) ; } } | Set a callback that will receive every query after we run it . |
57,926 | public function getLanguageId ( string $ shortCode ) : string { $ query = $ this -> Languages -> find ( 'all' , [ 'conditions' => [ 'Languages.code' => $ shortCode ] ] ) ; $ language = $ query -> first ( ) ; if ( empty ( $ language -> id ) ) { throw new InvalidArgumentException ( "Unsupported language code [$shortCode]... | Retrive language ID by code |
57,927 | public static function _genRijndael256IV ( $ cypher = FALSE ) { if ( ! $ cypher ) { $ cypher = mcrypt_module_open ( 'rijndael-256' , '' , 'ofb' , '' ) ; } $ iv = mcrypt_create_iv ( mcrypt_enc_get_iv_size ( $ cypher ) , MCRYPT_RAND ) ; mcrypt_module_close ( $ cypher ) ; return $ iv ; } | Generate a rijndael 256 initialisation vector |
57,928 | public static function _encryptRijndael256 ( $ str , $ key , $ iv = FALSE ) { if ( empty ( $ str ) ) { return '' ; } $ cypher = mcrypt_module_open ( 'rijndael-256' , '' , 'ofb' , '' ) ; if ( $ iv === FALSE ) { $ iv = self :: _genRijndael256IV ( $ cypher ) ; } $ key = substr ( $ key , 0 , mcrypt_enc_get_key_size ( $ cyp... | Encrypt and return a string using the Rijndael 256 cypher |
57,929 | public static function _decryptRijndael256 ( $ str , $ key , $ iv ) { if ( empty ( $ str ) ) { return '' ; } $ cypher = mcrypt_module_open ( 'rijndael-256' , '' , 'ofb' , '' ) ; $ key = substr ( $ key , 0 , mcrypt_enc_get_key_size ( $ cypher ) ) ; mcrypt_generic_init ( $ cypher , $ key , $ iv ) ; $ decrypted = mdecrypt... | Decrypt and return a string using the Rijndael 256 cypher |
57,930 | public function updateActionPost ( ) : object { $ response = $ this -> di -> get ( "response" ) ; $ request = $ this -> di -> get ( "request" ) ; $ session = $ this -> di -> get ( "session" ) ; $ key = $ request -> getPost ( "stylechooser" ) ; if ( $ key === "none" ) { $ session -> set ( "flashmessage" , "Unsetting the... | Update current selected style . |
57,931 | public function updateActionGet ( $ style ) : object { $ response = $ this -> di -> get ( "response" ) ; $ session = $ this -> di -> get ( "session" ) ; $ key = $ this -> cssUrl . "/" . $ style . ".css" ; $ keyMin = $ this -> cssUrl . "/" . $ style . ".min.css" ; if ( $ style === "none" ) { $ session -> set ( "flashmes... | Update current selected style using a GET url and redirect to last page visited . |
57,932 | public function get ( $ class = null ) { $ class = $ this -> getClass ( $ class ) ; if ( Arrays :: exists ( $ class , $ this -> reflections ) ) { return $ this -> reflections [ $ class ] ; } throw new Exception ( "Class not found: $class" ) ; } | Get an Instantiated ReflectionClass . |
57,933 | protected function appendIgnorePattern ( $ config , $ latestWrapper , $ previousWrapper ) { $ latestWrapper -> setFilter ( $ config -> filter ( ) ) ; $ previousWrapper -> setFilter ( $ config -> filter ( ) ) ; } | Add pattern to exclude files . |
57,934 | public function debug ( $ message ) { if ( ! $ this -> getOutput ( ) -> isDebug ( ) ) { return null ; } if ( func_num_args ( ) > 1 ) { $ message = vsprintf ( $ message , array_slice ( func_get_args ( ) , 1 ) ) ; } $ this -> getOutput ( ) -> writeln ( $ message ) ; } | Print debug message . |
57,935 | public function getEnvironment ( $ config = null ) { if ( ! $ this -> environment ) { if ( null == $ config ) { $ config = $ this -> getConfig ( ) ; } $ this -> environment = new Environment ( $ config ) ; } return $ this -> environment ; } | Get environment object . |
57,936 | protected function getPreviousWrapper ( ) { if ( $ this -> previousWrapper ) { return $ this -> previousWrapper ; } $ input = $ this -> getInput ( ) ; $ this -> previousWrapper = $ this -> getWrapperInstance ( $ input -> getArgument ( 'previous' ) , $ input -> getOption ( 'type' ) ) ; return $ this -> previousWrapper ;... | Get the wrapper for the VCS . |
57,937 | protected function getWrapperInstance ( $ base , $ type = 'Directory' ) { $ wrapper = $ this -> getWrapperClass ( $ type ) ; if ( ! $ wrapper ) { throw new \ InvalidArgumentException ( sprintf ( '<error>Unknown wrapper-type "%s"</error>' , $ type ) ) ; } if ( is_dir ( $ base ) ) { $ wrapper = $ this -> getWrapperClass ... | Create a wrapper for the given target . |
57,938 | protected function parseFiles ( $ wrapper , $ prefix ) { $ this -> verbose ( $ prefix . 'Fetching files ...' ) ; $ time = microtime ( true ) ; $ fileAmount = count ( $ wrapper -> getAllFileNames ( ) ) ; $ this -> verbose ( sprintf ( "\r" . $ prefix . "Collected %d files in %0.2f seconds." , $ fileAmount , microtime ( t... | Parse files within a wrapper . |
57,939 | protected function printConfig ( ) { $ config = $ this -> getConfig ( ) ; $ output = $ this -> getOutput ( ) ; foreach ( $ config -> ruleSet ( ) -> getChildren ( ) as $ ruleSet ) { $ output -> writeln ( 'Using rule set ' . $ ruleSet -> getName ( ) ) ; if ( ! $ output -> isDebug ( ) ) { continue ; } if ( ! $ ruleSet -> ... | Print debug information of the used config . |
57,940 | protected function resolveConfigFile ( ) { $ ruleSet = $ this -> getInput ( ) -> getOption ( 'ruleSet' ) ; if ( null === $ ruleSet && file_exists ( 'phpsemver.xml' ) ) { return 'phpsemver.xml' ; } if ( null === $ ruleSet ) { $ ruleSet = 'SemVer2' ; } if ( file_exists ( $ ruleSet ) ) { return $ ruleSet ; } $ defaultPath... | Resolve path to rule set XML . |
57,941 | public function url ( ) { if ( $ this -> type === self :: FORGOT_PASSWORD ) { return $ this -> getApp ( ) [ 'base_url' ] . 'users/forgot/' . $ this -> link ; } else if ( $ this -> type === self :: TEMPORARY ) { return $ this -> getApp ( ) [ 'base_url' ] . 'users/signup/' . $ this -> link ; } return false ; } | Gets the URL for this link . |
57,942 | public function getTokens ( ) { fseek ( $ this -> stream , 0 ) ; $ this -> buffer = new StreamBuffer ( $ this -> stream , static :: BUFFER_SIZE , $ this -> minLength ) ; $ this -> buffer -> read ( ) ; $ last = null ; while ( ! $ this -> buffer -> isEof ( ) ) { foreach ( $ this -> state -> match ( $ this -> buffer ) as ... | Loop through the stream pulling maximum type length each time find the largest type that matches and create a token then move on length characters |
57,943 | public function persistAndFlush ( ) { if ( 0 === func_num_args ( ) ) { throw new \ LogicException ( 'Missing arguments' ) ; } $ persists = [ ] ; $ entities = func_get_args ( ) ; foreach ( $ entities as $ entity ) { if ( true === is_array ( $ entity ) ) { $ persists = array_merge ( $ persists , $ entity ) ; } else { $ p... | Persist and Flush |
57,944 | public function removeAndFlush ( ) { if ( 0 === func_num_args ( ) ) { throw new \ LogicException ( 'Missing arguments' ) ; } foreach ( func_get_args ( ) as $ remove ) { $ this -> getDoctrine ( ) -> getManager ( ) -> remove ( $ remove ) ; } $ this -> getDoctrine ( ) -> getManager ( ) -> flush ( ) ; return $ this ; } | Remove and Flush |
57,945 | public function registerPages ( ) { foreach ( $ this -> menus as $ menu ) { $ this -> registerPage ( $ menu [ 'title' ] , $ menu [ 'cap' ] , $ menu [ 'link' ] , $ menu [ 'class' ] , $ menu [ 'callback' ] , $ menu [ 'type' ] ) ; } $ this -> hideMenu ( ) ; } | register menu pages |
57,946 | private function registerPage ( $ title , $ capabilities , $ url_param , $ class , $ callback , $ type ) { if ( $ type == 'submenu' ) { add_submenu_page ( $ this -> url , $ title , $ title , $ capabilities , $ url_param , array ( $ class , $ callback ) ) ; } else { add_menu_page ( $ title , $ title , $ capabilities , $... | register using add_submenu_page |
57,947 | private function sort ( ) { uksort ( $ this -> tokens , function ( $ first , $ second ) { return strlen ( $ second ) - strlen ( $ first ) ; } ) ; } | Sort the tokens into reverse key length order |
57,948 | private function validHmac ( $ hmac , $ compareHmac ) { if ( function_exists ( "hash_equals" ) ) { return hash_equals ( $ hmac , $ compareHmac ) ; } $ hashLength = mb_strlen ( $ hmac , '8bit' ) ; $ compareLength = mb_strlen ( $ compareHmac , '8bit' ) ; if ( $ hashLength !== $ compareLength ) { return false ; } $ result... | Validates if the provided hmac is equal to the expected hmac |
57,949 | public function encrypt ( $ original_string , $ cipher_key ) { $ cipher_key = $ this -> _genKey ( $ cipher_key ) ; $ ivSize = openssl_cipher_iv_length ( 'AES-256-CBC' ) ; $ iv = openssl_random_pseudo_bytes ( $ ivSize ) ; $ cipher_text = $ iv . openssl_encrypt ( $ original_string , 'AES-256-CBC' , $ cipher_key , OPENSSL... | Encrypts a string using a secret |
57,950 | public function decrypt ( $ cipher_string , $ cipher_key ) { $ cipher_key = $ this -> _genKey ( $ cipher_key ) ; $ hmacSize = 64 ; $ hmacString = mb_substr ( $ cipher_string , 0 , $ hmacSize , "8bit" ) ; $ cipher_text = mb_substr ( $ cipher_string , $ hmacSize , null , "8bit" ) ; if ( ! $ this -> validHmac ( $ hmacStri... | Decrypts a string using a secret |
57,951 | public function listen ( $ action , $ logged = 'no' , $ callable ) { if ( ! is_string ( $ action ) || strlen ( $ action ) == 0 ) { throw new AjaxException ( "Invalid parameter for the action." ) ; } if ( is_callable ( $ callable ) ) { $ this -> registerWithClosure ( $ action , $ logged , $ callable ) ; } else { if ( st... | Handle the Ajax response . Run the appropriate action hooks used by WordPress in order to perform POST ajax request securely . Developers have the option to run ajax for the Front - end Back - end either users are logged in or not or both . |
57,952 | public function validate ( $ nonce = null , $ value = null , $ message = null , $ data = null ) { $ nonce = ( $ nonce ) ? $ nonce : $ this -> app [ 'request' ] -> get ( 'nonce' ) ; $ value = ( $ value ) ? $ value : $ this -> app [ 'config' ] -> get ( 'app.key' ) ; if ( ! wp_verify_nonce ( $ nonce , $ value ) ) { $ defa... | Check nonce against app . key |
57,953 | public function insert ( $ key , $ value ) { $ this -> file -> flock ( LOCK_SH ) ; $ this -> file -> fseek ( 0 , SEEK_END ) ; $ position = $ this -> file -> ftell ( ) ; if ( is_array ( $ value ) || is_object ( $ value ) ) { $ value = json_encode ( $ value ) ; } $ this -> file -> flock ( LOCK_EX ) ; $ this -> file -> fw... | Write the new record to the database file |
57,954 | public function read ( $ position ) { $ this -> file -> flock ( LOCK_SH ) ; $ metadata = $ this -> getMetadata ( $ position ) ; $ this -> file -> fseek ( $ metadata -> klen , SEEK_CUR ) ; $ value = $ this -> file -> fread ( $ metadata -> vlen ) ; $ this -> file -> flock ( LOCK_UN ) ; $ mixed = json_decode ( $ value , t... | Retrieves the data from the database for a Key based on position |
57,955 | public function update ( $ position , $ key , $ value ) { $ this -> remove ( $ position ) ; return $ this -> insert ( $ key , $ value ) ; } | Updates an existing key by removing it from the existing file and appending the new value to the end of the file . |
57,956 | public function truncate ( ) { $ this -> file -> flock ( LOCK_EX ) ; $ result = $ this -> file -> ftruncate ( 0 ) ; $ this -> file -> flock ( LOCK_UN ) ; return $ result ; } | Truncates the collection removing all the data from the file |
57,957 | public static function create ( $ context , $ type , LoggerInterface $ logger = null , $ persistentId = null , $ onNewSocket = null ) { if ( ! is_callable ( $ onNewSocket ) ) { $ onNewSocket = null ; } $ newSocket = false ; $ callback = function ( ) use ( $ onNewSocket , & $ newSocket ) { $ newSocket = true ; if ( $ on... | Create a new Socket . |
57,958 | public function hasEvents ( $ timeout = 0 ) { $ poll = new ZMQPoll ( ) ; $ poll -> add ( $ this , ZMQ :: POLL_IN ) ; $ read = $ write = array ( ) ; $ events = $ poll -> poll ( $ read , $ write , $ timeout ) ; if ( $ events > 0 ) { return true ; } return false ; } | Poll for new Events on this Socket . |
57,959 | public function mrecv ( $ mode = 0 ) { if ( $ this -> verbose ) { $ this -> getLogger ( ) -> debug ( 'PRE RECV: ' . $ this -> id ) ; } $ data = array ( ) ; while ( true ) { $ data [ ] = $ this -> recv ( $ mode ) ; if ( ! $ this -> getSockOpt ( ZMQ :: SOCKOPT_RCVMORE ) ) { break ; } } $ message = new Message ( $ data ) ... | Receive a Message . |
57,960 | public function msend ( Message $ msg ) { if ( ZMQ :: SOCKET_ROUTER === $ this -> getSocketType ( ) ) { $ msg -> prepend ( $ msg -> getRoutingInformation ( ) ) ; } if ( $ this -> verbose ) { $ this -> getLogger ( ) -> debug ( 'SEND: ' . $ this -> id ) ; $ this -> getLogger ( ) -> debug ( $ msg ) ; } $ parts = $ msg -> ... | Send a Messsage . |
57,961 | private function createResolverFactories ( $ config , ContainerBuilder $ container ) { if ( null !== $ this -> factories ) { return $ this -> factories ; } $ tempContainer = new ContainerBuilder ( ) ; $ parameterBag = $ container -> getParameterBag ( ) ; $ loader = new XmlFileLoader ( $ tempContainer , new FileLocator ... | Creates the resolver factories |
57,962 | public function getPagedResults ( $ limit = 50 , $ page = 0 ) { $ dql = sprintf ( self :: DQL_GET_PAGED , AuditEvent :: class ) ; return $ this -> getPaginator ( $ dql , $ limit , $ page ) ; } | Get all audit events paged . |
57,963 | public function connect ( ) { $ this -> errorHandler -> start ( ) ; if ( $ this -> configuration -> getSSL ( ) ) { $ this -> resource = $ this -> driver -> sslConnect ( $ this -> configuration -> getHost ( ) , $ this -> configuration -> getPort ( ) , $ this -> configuration -> getTimeout ( ) ) ; } else { $ this -> reso... | Standard function for creating a FTP connection and logging in . |
57,964 | public function fput ( $ stream , $ remote ) { $ this -> isAlive ( true ) ; $ this -> errorHandler -> start ( ) ; if ( $ this -> driver -> fput ( $ this -> resource , $ remote , $ stream , FTP_BINARY ) ) { $ this -> errorHandler -> stop ( ) ; return true ; } $ this -> errorHandler -> stop ( ) ; return false ; } | Similar to put but does not get the file localy . |
57,965 | public function putContents ( $ contents , $ remote ) { $ stream = fopen ( 'data://text/plain,' . $ contents , 'r' ) ; return $ this -> fput ( $ stream , $ remote ) ; } | Write the contents of a string to the remote . |
57,966 | public function fget ( $ remote ) { $ this -> isAlive ( true ) ; $ this -> errorHandler -> start ( ) ; $ handle = fopen ( 'php://temp' , 'r+' ) ; if ( $ this -> driver -> fget ( $ this -> resource , $ handle , $ remote , FTP_BINARY ) ) { rewind ( $ handle ) ; $ this -> errorHandler -> stop ( ) ; return $ handle ; } $ t... | Similar to get but does not save file localy . |
57,967 | public static function getActivity ( int $ id ) : Activity { self :: initializeActivities ( ) ; if ( ! isset ( self :: $ activities [ $ id ] ) ) { throw new RuneScapeException ( sprintf ( "Activity with id %d does not exist." , $ id ) ) ; } return self :: $ activities [ $ id ] ; } | Retrieve an activity by ID . You can use the ACTIVITY_ constants in this class for IDs . |
57,968 | public function kill_process ( $ pid ) { if ( ! is_numeric ( $ pid ) ) return false ; $ pid = ( int ) $ pid ; $ sql = "KILL $pid" ; return $ this -> db -> query ( $ sql ) ; } | kill a specific process |
57,969 | public function setArray ( $ key , array $ values ) { $ this -> validateKey ( $ key ) ; if ( empty ( $ values ) ) { throw new \ InvalidArgumentException ( "Missing value." ) ; } foreach ( $ values as $ v ) { $ this -> validateValue ( $ v ) ; } $ this -> params [ $ key ] = [ ] ; foreach ( $ values as $ v ) { $ this -> p... | Sets several values for the given parameter key . |
57,970 | public function remove ( $ key ) { $ this -> validateKey ( $ key ) ; if ( $ this -> has ( $ key ) ) { unset ( $ this -> params [ $ key ] ) ; return true ; } else { return false ; } } | Return all parameters with the given key . |
57,971 | public function replace ( array $ new ) { foreach ( $ new as $ key => $ values ) { $ this -> validateKey ( $ key ) ; if ( ! is_array ( $ values ) ) { $ values = $ new [ $ key ] = [ $ values ] ; } foreach ( $ values as $ v ) { $ this -> validateValue ( $ v ) ; } } foreach ( $ new as $ key => $ values ) { $ this -> setAr... | Sets several new parameters replacing the old values if already present . |
57,972 | public function getArray ( $ key ) { $ this -> validateKey ( $ key ) ; return $ this -> has ( $ key ) ? $ this -> params [ $ key ] : [ ] ; } | Returns all values of the parameters with the given key . If no parameter with the given key exists an empty array is returned . |
57,973 | public function toArray ( $ onlyFirst = false ) { $ r = [ ] ; foreach ( $ this -> params as $ key => $ values ) { $ r [ $ key ] = $ onlyFirst ? $ values [ 0 ] : $ values ; } return $ r ; } | Get all parameters as an associative array with the parameter keys as array keys . Returns either only the first values of the parameters or all values of the parameters . |
57,974 | public function count ( $ key = null ) { if ( is_null ( $ key ) ) { return count ( $ this -> params ) ; } return count ( $ this -> getArray ( $ key ) ) ; } | Counts the parameters . Parameter keys that appear multiple times count as one array parameter . |
57,975 | function isProperty ( ) { $ i = $ this -> getAnnotationIndex ( self :: PROPERTY ) ; if ( $ i >= 0 ) { $ this -> format = $ this -> annotations [ $ i ] -> format ; return true ; } else { return false ; } } | Checks if this property is indeed a property . |
57,976 | function getValue ( $ entity ) { $ raw = $ this -> property -> getValue ( $ entity ) ; switch ( $ this -> format ) { case 'scalar' : return $ raw ; case 'object' : case 'array' : return serialize ( $ raw ) ; case 'json' : return json_encode ( $ raw ) ; case 'date' : if ( $ raw ) { $ value = clone $ raw ; $ value -> set... | Gets this property s value in the given entity . |
57,977 | function setValue ( $ entity , $ value ) { switch ( $ this -> format ) { case 'scalar' : $ this -> property -> setValue ( $ entity , $ value ) ; break ; case 'object' : case 'array' : $ this -> property -> setValue ( $ entity , unserialize ( $ value ) ) ; break ; case 'json' : $ this -> property -> setValue ( $ entity ... | Sets this property s value in the given entity . |
57,978 | function matches ( $ names ) { foreach ( func_get_args ( ) as $ name ) { if ( 0 === strcasecmp ( $ name , $ this -> name ) || 0 === strcasecmp ( $ name , $ this -> property -> getName ( ) ) || 0 === strcasecmp ( $ name , Reflection :: normalizeProperty ( $ this -> property -> getName ( ) ) ) ) { return true ; } } retur... | Checks if a supplied name matches this property s name . |
57,979 | private function validateAnnotations ( ) { $ count = 0 ; foreach ( $ this -> annotations as $ a ) { if ( strrpos ( get_class ( $ a ) , self :: ANNOTATION_NAMESPACE ) !== false ) { $ count ++ ; } } switch ( $ count ) { case 0 : return ; case 1 : if ( $ this -> getAnnotationIndex ( self :: INDEX ) < 0 ) { return ; } thro... | Validates the annotation combination on a property . |
57,980 | private function getAnnotationIndex ( $ name ) { for ( $ i = 0 ; $ i < count ( $ this -> annotations ) ; $ i ++ ) { if ( $ this -> annotations [ $ i ] instanceof $ name ) { return $ i ; } } return - 1 ; } | Gets the index of a annotation with the value specified or - 1 if it s not in the annotations array . |
57,981 | protected function update ( $ keyValue = null , String $ key , String $ table , Array $ properties = [ ] ) { if ( isset ( $ properties [ $ key ] ) ) { unset ( $ properties [ $ key ] ) ; } $ this -> queryBuilder ( ) -> where ( $ key , $ keyValue ) -> update ( $ table , $ properties ) ; } | Updates an existing record in the database table . |
57,982 | public function add ( $ index , $ data = null , $ toAdmin = false ) { if ( ! $ this -> has ( $ index ) ) { $ this -> data = Arr :: add ( $ this -> data , $ index , $ data ) ; $ this -> metas = Arr :: add ( $ this -> metas , $ this -> firstIndex ( $ index ) , [ 'admin' => $ toAdmin ] ) ; } return $ this ; } | Append new data |
57,983 | public function toJson ( $ admin = false ) { $ data = $ this -> prepareDataToJson ( $ admin ) ; if ( count ( $ data ) == 0 ) { return '{}' ; } return json_encode ( $ data ) ; } | Return the data as JSON |
57,984 | public function load ( ) { if ( false === $ this -> isLoaded ) { $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ . '.pre' , $ this , [ ] ) ; $ this -> generate ( ) ; $ this -> injectBlocks ( ) ; $ this -> isLoaded = true ; $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ . '.post' , $ this , [ ] ) ; } re... | inject blocks into the root view model |
57,985 | private function isAllowed ( $ blockId , ModelInterface $ block ) { $ result = $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ , $ this , [ 'block_id' => $ blockId , 'block' => $ block ] ) ; if ( $ result -> stopped ( ) ) { return $ result -> last ( ) ; } return true ; } | Determines whether a block should be allowed given certain parameters |
57,986 | public function addBlock ( $ blockId , ModelInterface $ block ) { $ this -> blockPool -> add ( $ blockId , $ block ) ; return $ this ; } | adds a block to the registry |
57,987 | protected function prepareDataForEntity ( array $ data ) { foreach ( $ this -> getMapper ( ) -> getTable ( ) -> getColumns ( ) as $ name => $ Column ) { if ( array_key_exists ( $ name , $ data ) === false ) { if ( $ Column -> isPk ( ) ) { $ data [ $ name ] = null ; } else if ( $ Column -> isNullable ( ) === false ) { t... | Makes sure data defined in the Entity is in proper format and all keys are set |
57,988 | protected function getNodes ( ReadBlockInterface $ block ) { $ nodes = null ; $ nodeName = $ block -> getAttribute ( 'nodeName' ) ; $ siteId = $ this -> currentSiteManager -> getSiteId ( ) ; if ( ! is_null ( $ nodeName ) ) { $ nodes = $ this -> nodeRepository -> getSubMenu ( $ nodeName , $ block -> getAttribute ( 'nbLe... | Get nodes to display |
57,989 | public static function defaultCommandFactory ( Description $ description ) { return function ( $ name , array $ args = [ ] , GuzzleClientInterface $ client ) use ( $ description ) { $ operation = null ; if ( $ description -> hasOperation ( $ name ) ) { $ operation = $ description -> getOperation ( $ name ) ; } else { $... | We re overriding this to support operation - specific requestion options . Currently this is for disabling auth on specific operations . |
57,990 | protected function processConfig ( array $ config ) { $ config [ 'command_factory' ] = self :: defaultCommandFactory ( $ this -> getDescription ( ) ) ; parent :: processConfig ( array_merge ( $ config , [ 'process' => false , ] ) ) ; if ( ! isset ( $ config [ 'process' ] ) || $ config [ 'process' ] === true ) { $ this ... | We re overriding this to use our command factory from above and to use custom objects for API results . |
57,991 | private function mapElements ( array $ elements , array $ mainElements , array & $ map , array & $ inverse ) : void { foreach ( $ elements as $ index => $ element ) { $ elementId = ( int ) $ element [ 'id' ] ; if ( ! array_key_exists ( $ index , $ mainElements ) ) { $ this -> logger -> warning ( 'Content element {id} h... | Map the passed elements . |
57,992 | public function authenticate ( string $ auth ) { if ( $ this -> router === null ) { return ; } try { $ response = $ this -> router -> authenticate ( $ auth , 'Basic' ) ; if ( ! ( $ response instanceof Response ) ) { $ response = new Response ; $ response -> status = HttpResponse :: HTTP_NO_CONTENT ; } $ response -> out... | Authenticates a Basic Authorization Header |
57,993 | public function run ( string $ method , string $ uri , array $ headers , string $ body ) { if ( $ this -> router === null ) { return ; } try { $ response = $ this -> router -> run ( $ method , $ uri , $ headers , $ body ) ; if ( $ response !== null ) { $ response -> output ( ) ; } } catch ( RouterException $ e ) { $ e ... | Runs the Router and outputs the Response |
57,994 | protected function createAssignment ( ) { $ url = config ( 'forge-publish.url' ) . config ( 'forge-publish.store_assignment_uri' ) ; try { $ response = $ this -> http -> post ( $ url , [ 'form_params' => [ 'name' => $ this -> assignmentName , 'repository_uri' => $ this -> repository_uri , 'repository_type' => $ this ->... | Create assignment . |
57,995 | public function close ( ) { if ( ! $ this -> link -> close ( ) ) { throw new DbException ( 'can\'t close database connection: ' . $ this -> link -> error , $ this -> link -> errno ) ; } return true ; } | Closes the connection . |
57,996 | protected function assembleComponent ( $ element ) { $ options = $ this -> getOptions ( ) ; $ element = parent :: __invoke ( $ element ) ; $ component = sprintf ( '<div style="padding: 0;" class="input-append color %s" data-color="%s" data-color-format="%s">%s' , $ options [ 'class' ] , $ options [ 'color' ] , $ option... | Put together the colorpicker component . |
57,997 | protected function prepareElement ( $ element ) { $ options = $ this -> getOptions ( ) ; $ currClass = $ element -> getAttribute ( 'class' ) ; $ class = $ currClass . ( null !== $ currClass ? ' ' : '' ) . $ options [ 'class' ] ; $ element -> setAttributes ( array ( 'class' => $ class , 'data-color' => $ options [ 'colo... | Prepare the element by applying all changes to it required for the colorpicker . |
57,998 | protected function setOptions ( $ options ) { $ options = array_merge ( array ( 'format' => 'hex' , 'invoke_inline' => false , 'include_dependencies' => false , 'as_component' => false , 'class' => 'colorpicker' , ) , $ options ) ; if ( ! in_array ( $ options [ 'format' ] , array ( 'hex' , 'rgb' , 'rgba' ) ) ) { throw ... | Set the options for the colorpicker . |
57,999 | protected function includeDependencies ( ) { $ view = $ this -> getView ( ) ; $ view -> headScript ( ) -> appendFile ( $ view -> basePath ( ) . '/js/bootstrap-colorpicker.js' ) ; $ view -> headLink ( ) -> prependStylesheet ( $ view -> basePath ( ) . '/css/colorpicker.css' ) ; } | Include the colorpicker dependencies . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.