idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
237,800 | protected function configureRequest ( RequestInterface $ Request ) { if ( $ Request -> getStatus ( ) >= Curl :: STATUS_SENT ) { $ Request -> reset ( ) ; } if ( isset ( $ this -> properties [ self :: PROPERTY_HTTP_METHOD ] ) && $ this -> properties [ self :: PROPERTY_HTTP_METHOD ] !== '' ) { $ Request -> setMethod ( $ t... | Verifies URL and Data are setup then sets them on the Request Object |
237,801 | protected function configureResponse ( ResponseInterface $ Response ) { $ Response -> setRequest ( $ this -> Request ) ; $ Response -> extract ( ) ; return $ Response ; } | Configure the Response Object after sending of the Request |
237,802 | private function verifyUrl ( $ url ) { if ( strpos ( $ url , static :: $ _URL_VAR_CHARACTER ) !== false ) { throw new InvalidUrl ( array ( get_class ( $ this ) , $ url ) ) ; } return true ; } | Verify if URL is configured properly |
237,803 | protected function requiresOptions ( ) { $ url = $ this -> getEndPointUrl ( ) ; $ variables = $ this -> extractUrlVariables ( $ url ) ; return ! empty ( $ variables ) ; } | Checks if Endpoint URL requires Options |
237,804 | protected function extractUrlVariables ( $ url ) { $ variables = array ( ) ; $ pattern = "/(\\" . static :: $ _URL_VAR_CHARACTER . ".*?[^\\/]*)/" ; if ( preg_match ( $ pattern , $ url , $ matches ) ) { array_shift ( $ matches ) ; foreach ( $ matches as $ match ) { $ variables [ ] = $ match [ 0 ] ; } } return $ variable... | Helper method for extracting variables via Regex from a passed in URL |
237,805 | public function lead ( ) : Number { return $ this -> reduce ( new Integer ( 0 ) , static function ( Number $ lead , Number $ number ) : Number { if ( ! $ lead -> equals ( new Integer ( 0 ) ) ) { return $ lead ; } return $ number ; } ) ; } | First non zero number found |
237,806 | public function log ( $ message ) { if ( ! $ this -> enableLogging ) return ; if ( ! isset ( $ this -> log ) ) $ this -> log = \ lyquidity \ XPath2 \ lyquidity \ Log :: getInstance ( ) ; $ this -> log -> info ( $ message ) ; } | Log a message to the current log target |
237,807 | protected function yyExpecting ( $ state ) { $ token = 0 ; $ n = 0 ; $ len = 0 ; $ ok = array_fill ( 0 , count ( XPath2Parser :: $ yyName ) , false ) ; if ( ( $ n = XPath2Parser :: $ yySindex [ $ state ] ) != 0 ) { for ( $ token = $ n < 0 ? - $ n : 0 ; ( $ token < count ( XPath2Parser :: $ yyName ) && ( $ n + $ token <... | computes list of expected tokens on error by tracing the tables . |
237,808 | public function get ( CacheableInterface $ item ) { $ targetFile = $ this -> getTargetFile ( $ item -> getHashKey ( ) ) ; $ return = false ; if ( file_exists ( $ targetFile ) ) { if ( $ item -> getTtl ( ) > 0 && ( ( filemtime ( $ targetFile ) + $ item -> getTtl ( ) ) < time ( ) ) ) { $ this -> remove ( $ item ) ; } els... | Get value from cache Must return false when cache is expired or invalid |
237,809 | public function init ( $ config = NULL ) { parent :: init ( $ config ) ; if ( ! isset ( $ config [ 'migration_path' ] ) ) { throw new \ InvalidArgumentException ( 'Missing migration_path parameter' ) ; } foreach ( $ config as $ key => $ value ) { switch ( $ key ) { case 'migration_path' : $ this -> migrationPath = $ va... | Initialises the migrator . |
237,810 | public function createMigration ( ) { $ date = new \ DateTime ( ) ; $ tStamp = substr ( $ date -> format ( 'U' ) , 2 ) ; if ( self :: STYLE_CAMEL_CASE !== $ this -> migrationClassStyle ) { $ parts = preg_split ( '/(?=[A-Z])/' , $ this -> migrationClass , - 1 , PREG_SPLIT_NO_EMPTY ) ; $ className = $ this -> classPrefix... | Creates a new migration class file . |
237,811 | public function getMigrationTemplate ( $ name ) { $ template = '<?php' . PHP_EOL . PHP_EOL ; if ( '' !== $ this -> migrationNamespace ) { $ template .= 'namespace ' . $ this -> migrationNamespace . ';' . PHP_EOL . PHP_EOL ; } $ template .= 'use RawPHP\RawMigrator\Migration;' . PHP_EOL ; $ template .= 'use RawPHP\RawDat... | Creates the migration template file code . |
237,812 | public function createMigrationTable ( ) { if ( empty ( $ this -> migrationTable ) ) { throw new RawException ( 'Migration table name must be set' ) ; } $ result = NULL ; $ table = array ( 'migration_id' => 'INTEGER(11) PRIMARY KEY AUTO_INCREMENT NOT NULL' , 'migration_name' => 'VARCHAR(128) NOT NULL' , 'migration_date... | Creates the migration database table if it doesn t exist . |
237,813 | public function getMigrations ( ) { $ migrations = array ( ) ; $ dir = opendir ( $ this -> migrationPath ) ; while ( ( $ file = readdir ( $ dir ) ) !== FALSE ) { if ( '.' !== $ file && '..' !== $ file ) { $ migrations [ ] = str_replace ( '.php' , '' , $ file ) ; } } closedir ( $ dir ) ; usort ( $ migrations , array ( $... | Returns a list of migration files . |
237,814 | public function getNewMigrations ( ) { $ exists = $ this -> db -> tableExists ( $ this -> migrationTable ) ; if ( ! $ exists ) { $ this -> createMigrationTable ( ) ; } $ query = "SELECT * FROM $this->migrationTable" ; $ applied = $ this -> db -> query ( $ query ) ; $ migrations = $ this -> getMigrations ( ) ; $ list = ... | Returns a list of new migrations . |
237,815 | public function getAppliedMigrations ( ) { $ query = "SELECT * FROM $this->migrationTable" ; $ applied = $ this -> db -> query ( $ query ) ; $ list = array ( ) ; foreach ( $ applied as $ mig ) { $ list [ ] = $ mig [ 'migration_name' ] ; } $ list = array_reverse ( $ list ) ; return $ this -> filter ( self :: ON_GET_APPL... | Returns a list of applied migrations . |
237,816 | public function migrateUp ( $ levels = NULL ) { if ( NULL !== $ levels ) { $ this -> levels = $ levels ; } $ newMigrations = $ this -> getNewMigrations ( ) ; $ i = 0 ; if ( self :: MIGRATE_ALL === $ this -> levels || $ this -> levels > count ( $ newMigrations ) ) { $ this -> levels = count ( $ newMigrations ) ; } while... | Runs the UP migration . |
237,817 | public function migrateDown ( $ levels = NULL ) { if ( NULL !== $ levels ) { $ this -> levels = $ levels ; } $ migrations = $ this -> getAppliedMigrations ( ) ; $ i = 0 ; if ( self :: MIGRATE_ALL === $ this -> levels || $ this -> levels > count ( $ migrations ) ) { $ this -> levels = count ( $ migrations ) ; } while ( ... | Runs the DOWN migration . |
237,818 | private function _addMigrationRecord ( $ class ) { $ name = $ this -> db -> prepareString ( $ class ) ; $ tm = new \ DateTime ( ) ; $ tm = $ tm -> getTimestamp ( ) ; $ query = "INSERT INTO $this->migrationTable ( migration_name, migration_date_applied ) VALUES ( " ; $ query .= "'$name', " ; $ query .= ... | Inserts an applied migration into the database . |
237,819 | private function _deleteMigrationRecord ( $ class ) { $ name = $ this -> db -> prepareString ( $ class ) ; $ query = "DELETE FROM $this->migrationTable WHERE migration_name = '$name'" ; $ this -> db -> lockTables ( $ this -> migrationTable ) ; $ result = $ this -> db -> execute ( $ query ) ; if ( $ this -> verbose ) { ... | Deletes a migration entry from the database . |
237,820 | public function lock ( $ lockName ) { $ lockHandle = $ this -> lockProvider -> lock ( $ lockName ) ; if ( $ lockHandle === false ) { return false ; } $ this -> lockList [ $ lockName ] = $ lockHandle ; return true ; } | Attempts to acquire a single lock by name and adds it to the lock set . |
237,821 | public function toArray ( ) { $ results = [ ] ; foreach ( $ this -> claims as $ claim ) { $ results [ $ claim -> getName ( ) ] = $ claim -> getValue ( ) ; } return $ results ; } | Get the array of claims . |
237,822 | public function addCalendarEvent ( $ postValues ) { $ responseData = array ( ) ; $ calendarTable = $ this -> getServiceLocator ( ) -> get ( 'MelisCalendarTable' ) ; $ melisCoreAuth = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreAuth' ) ; $ userAuthDatas = $ melisCoreAuth -> getStorage ( ) -> read ( ) ; $ userId =... | Adding and Updating Calendar Event |
237,823 | public function deleteCalendarEvent ( $ postValues ) { $ calId = null ; $ calendarTable = $ this -> getServiceLocator ( ) -> get ( 'MelisCalendarTable' ) ; $ resultEvent = $ calendarTable -> getEntryById ( $ postValues [ 'cal_id' ] ) ; if ( ! empty ( $ resultEvent ) ) { $ event = $ resultEvent -> current ( ) ; if ( ! e... | Deleting Calendar Item Event |
237,824 | protected function accessDenied ( $ user , $ message = NULL ) { http_response_code ( 403 ) ; Yii :: app ( ) -> controller -> renderOutput ( array ( ) , 403 , $ message ) ; } | Denies the access of the user . This method is invoked when access check fails . |
237,825 | public function addLoyaltyPoints ( $ user_id , $ transaction_value , $ platform = null , $ service = null , $ expires_in_days = null , $ transaction_id = null , $ meta = null , $ tag = null , $ frozen = false ) { $ url = $ this -> authenticationService -> getServerEndPoint ( ) . Endpoints :: VERSION . Endpoints :: BASE... | Add loyalty points to users wallet |
237,826 | public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ q = $ this -> getQuery ( ) ; $ t = $ this -> getType ( ) ; $ scope = $ params -> getSubScope ( $ this -> sub_scope_number ) ; $ this -> sub_scope_number = $ scope -> getScopeID ( ) ; return 'UNION ' . $ t . ' (' . $ params -> getDriver ( ) -> toSQL... | Write a UNION clause as SQL query synta |
237,827 | public static function getRules ( ) { $ rules = static :: rules ( ) ; if ( RevyAdmin :: isTranslationMode ( ) ) { $ object = new static ( ) ; foreach ( $ rules as $ field => $ rule ) { if ( $ object -> isTranslatableField ( $ field ) ) { unset ( $ rules [ $ field ] ) ; foreach ( Language :: getLocales ( ) as $ locale )... | Validation default rules |
237,828 | protected function resolveErrorKey ( $ messages = [ ] ) { if ( empty ( $ this -> errorKey ) ) { return $ messages ; } $ keys = explode ( '.' , $ this -> errorKey ) ; $ keys = array_reverse ( $ keys ) ; foreach ( $ keys as $ errorKey ) { $ messages = array ( $ errorKey => $ messages ) ; } return $ messages ; } | Nest messages according to error key |
237,829 | public function addErrors ( $ messages = [ ] ) { if ( ! is_array ( $ messages ) && ! $ messages instanceof MessageProvider ) { $ messages = ( array ) $ messages ; } return $ this -> errors -> merge ( $ this -> resolveErrorKey ( $ messages ) ) ; } | Add messages to error message bag |
237,830 | public function injectMessages ( Message $ messages ) { $ this -> messages = $ messages ; $ this -> messages -> setCookie ( $ this -> cookies ) ; } | Injects messages manager instance |
237,831 | private function formatBytes ( $ bytes , $ precision = 2 ) { $ unit = array ( 'B' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' ) ; if ( ! $ bytes ) { return "0 B" ; } return @ round ( $ bytes / pow ( 1024 , ( $ i = floor ( log ( $ bytes , 1024 ) ) ) ) , $ precision ) . ' ' . $ unit [ $ i ] ; } | formats a bigint into a human readable size |
237,832 | public function removeAll ( ) { foreach ( $ this -> handles as $ transaction ) { $ ch = $ this -> handles [ $ transaction ] ; curl_multi_remove_handle ( $ this -> multi , $ ch ) ; curl_close ( $ ch ) ; unset ( $ this -> handles [ $ transaction ] ) ; } } | Closes all of the requests associated with the underlying multi handle . |
237,833 | public function findTransaction ( $ handle ) { foreach ( $ this -> handles as $ transaction ) { if ( $ this -> handles [ $ transaction ] === $ handle ) { return $ transaction ; } } throw new AdapterException ( 'No curl handle was found' ) ; } | Find a transaction for a given curl handle |
237,834 | public function nextPending ( ) { if ( ! $ this -> hasPending ( ) ) { return null ; } $ current = $ this -> pending -> current ( ) ; $ this -> pending -> next ( ) ; return $ current ; } | Pop the next transaction from the transaction queue |
237,835 | public function addTransaction ( TransactionInterface $ transaction , $ handle ) { if ( isset ( $ this -> handles [ $ transaction ] ) ) { throw new AdapterException ( 'Transaction already registered' ) ; } $ code = curl_multi_add_handle ( $ this -> multi , $ handle ) ; if ( $ code != CURLM_OK ) { MultiAdapter :: throwM... | Add a transaction to the multi handle |
237,836 | public function removeTransaction ( TransactionInterface $ transaction ) { if ( ! isset ( $ this -> handles [ $ transaction ] ) ) { throw new AdapterException ( 'Transaction not registered' ) ; } $ handle = $ this -> handles [ $ transaction ] ; $ this -> handles -> detach ( $ transaction ) ; $ info = curl_getinfo ( $ h... | Remove a transaction and associated handle from the context |
237,837 | public function write ( string $ level , string $ message , array $ context ) { $ levnum = Logger :: getLevelNumeric ( $ level ) ; if ( $ levnum < $ this -> min_level ) return ; $ lvl = sprintf ( "%10s" , $ level ) ; $ message = $ this -> format ( $ lvl , $ message , $ context ) ; $ this -> log [ ] = $ message ; } | Log a line to the memory log if its level is high enough |
237,838 | protected function getSelect ( $ table = null ) { $ this -> initialize ( ) ; $ select = $ this -> getSlaveSql ( ) -> select ( ) ; $ select -> from ( $ table ? : $ this -> getTableName ( ) ) ; return $ select ; } | The version allows read - write access . |
237,839 | private function runCommand ( $ cmd , $ package = null , $ args , $ noAddtlArguments = false ) { $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ docPath = str_replace ( [ '\\' , 'public/../' ] , '' , $ this -> getDocumentRoot ( ) ) ; $ docPath = trim ( substr ( $ docPath , 0 , strlen ( $ docP... | This calls the composer CLI to execute a command |
237,840 | public function setDocumentRoot ( $ documentRoot ) { if ( $ documentRoot ) { $ this -> documentRoot = $ documentRoot ; } else { $ this -> documentRoot = $ this -> getDefaultDocRoot ( ) ; } } | Sets the path of the platform if nothing is set then it will use the default path of this platform |
237,841 | private function availableCommands ( ) { return [ self :: INSTALL , self :: UPDATE , self :: DUMP_AUTOLOAD , self :: DOWNLOAD , self :: REMOVE , ] ; } | Sets the limitation to what commands that can be executed |
237,842 | public function preFlush ( PreFlushEventArgs $ args ) { $ objectManager = $ args -> getEntityManager ( ) ; $ unitOfWork = $ objectManager -> getUnitOfWork ( ) ; $ entityMap = $ unitOfWork -> getIdentityMap ( ) ; foreach ( $ entityMap as $ objectClass => $ objects ) { if ( in_array ( UploadObjectInterface :: class , cla... | Prepares upload file references for all objects implementing the UploadObjectInterface . |
237,843 | public function prePersist ( LifecycleEventArgs $ args ) { $ object = $ args -> getObject ( ) ; if ( $ object instanceof UploadObjectInterface ) { $ this -> prepareUploadFileReferences ( $ object ) ; } } | Prepares upload file references for a new object implementing the UploadObjectInterface . |
237,844 | public function postPersist ( LifecycleEventArgs $ args ) { $ object = $ args -> getObject ( ) ; if ( $ object instanceof UploadObjectInterface ) { $ this -> storeFileUploads ( $ object ) ; } } | Stores the file uploads . |
237,845 | private function prepareUploadFileReferences ( UploadObjectInterface $ object ) { $ object -> setFileUploadPath ( $ this -> fileUploadPath ) ; $ reflectionClass = new ReflectionClass ( $ object ) ; $ objectName = $ reflectionClass -> getShortName ( ) ; $ fileUploads = $ object -> getFileUploads ( ) ; $ fileFieldConfigu... | Sets the new file references to the uploaded files on the object and schedules the previous file reference for deletion . |
237,846 | private function storeFileUploads ( UploadObjectInterface $ object ) { $ reflectionClass = new ReflectionClass ( $ object ) ; $ objectName = $ reflectionClass -> getShortName ( ) ; $ fileUploads = $ object -> getFileUploads ( ) ; $ fileFieldConfigurations = $ this -> flexModel -> getFieldsByDatatype ( $ objectName , 'F... | Stores the uploaded files to the specified file system location . |
237,847 | protected function setOrderCompletePage ( array $ order , $ model , $ controller ) { $ this -> order = $ model ; $ this -> data_order = $ order ; $ this -> controller = $ controller ; if ( $ order [ 'payment' ] === 'twocheckout' ) { $ this -> submitPayment ( ) ; $ this -> completePayment ( ) ; } } | Set order complete page |
237,848 | protected function completePayment ( ) { if ( $ this -> controller -> isQuery ( 'paid' ) ) { $ gateway = $ this -> getGateway ( ) ; $ this -> response = $ gateway -> completePurchase ( $ this -> getPurchaseParams ( ) ) -> send ( ) ; $ this -> processResponse ( ) ; } } | Performs actions when purchase is completed |
237,849 | public function replace ( array $ data ) { $ addFields = implode ( '`,`' , array_keys ( $ data ) ) ; return $ this -> command ( ) -> insertOrReplace ( "`{$addFields}`" , Str :: repeat ( '?' , $ data ) , array_values ( $ data ) ) ; } | INSERT OR REPLACE |
237,850 | protected function SetJSFieldValue ( $ field , $ value ) { $ jsField = Str :: ToJavascript ( $ field , false ) ; $ jsValue = Str :: ToJavascript ( $ value , false ) ; echo "<script>$($jsField).val($jsValue);</script>" ; } | Sets a field value as typical action of a modal form call |
237,851 | protected function SetJSHtml ( $ element , $ html ) { $ jsElement = Str :: ToJavascript ( $ element , false ) ; $ jsHtml = Str :: ToJavascript ( $ html , false ) ; echo "<script>$($jsElement).html($jsHtml);</script>" ; } | Sets element html content as a typical action of a modal form call |
237,852 | private function add ( $ field , $ args ) { if ( $ this -> hasField ( $ field ) && null !== $ args [ 0 ] ) { $ this -> virtualFieldsCollection [ $ field ] [ ] = $ args [ 0 ] ; } else if ( null === $ args [ 0 ] ) { throw new \ InvalidArgumentException ( "The argument given is null " ) ; } else { throw new \ BadMethodCal... | Add an object to a collection |
237,853 | public function setContentType ( $ type , $ statusCode = null ) { if ( isset ( static :: $ _types [ $ type ] ) ) { $ type = static :: $ _types [ $ type ] ; } $ this -> setHeader ( 'Content-Type' , $ type ) ; if ( $ statusCode ) { $ this -> _statusCode = $ statusCode ; } } | Set the response content type header and status code . |
237,854 | public function send ( ) { if ( headers_sent ( ) ) { return false ; } foreach ( $ this -> getHeaders ( ) as $ h ) { header ( $ h [ 0 ] . ': ' . $ h [ 1 ] , false , $ this -> _statusCode ) ; } if ( function_exists ( 'http_response_code' ) ) { http_response_code ( $ this -> _statusCode ) ; } echo $ this -> _content ; ret... | Send the response using the normal PHP functions . |
237,855 | public function convertExpressionsToStrings ( ) { $ this -> setMainQuery ( ( string ) $ this -> getMainQuery ( ) ) ; $ this -> setFilterQueries ( array_map ( function ( $ expr ) { return ( string ) $ expr ; } , $ this -> getFilterQueries ( ) ) ) ; return $ this ; } | Convert all expressions to strings . |
237,856 | protected function enqueue ( $ eventName , $ resourceOrEvent ) { if ( ! $ this -> isOpened ( ) ) { throw new RuntimeException ( "The event queue is closed." ) ; } if ( ! preg_match ( '~^[a-z_]+\.[a-z_]+\.[a-z_]+$~' , $ eventName ) ) { throw new InvalidArgumentException ( "Unexpected event name '{$eventName}'." ) ; } if... | Schedules a resource event of the given type . |
237,857 | protected function getQueueSortingCallback ( ) { $ parentMap = $ this -> registry -> getParentMap ( ) ; $ priorityMap = $ this -> registry -> getEventPriorityMap ( ) ; $ isChildOf = function ( $ a , $ b ) use ( $ parentMap ) { while ( isset ( $ parentMap [ $ a ] ) ) { $ parentId = $ parentMap [ $ a ] ; if ( $ parentId ... | Returns the queue sorting callback . |
237,858 | public function read ( string $ file ) : string { $ destFile = tempnam ( sys_get_temp_dir ( ) , 'pdf_to_text_' ) ; $ command = sprintf ( 'pdftotext -layout %s %s' , escapeshellarg ( realpath ( $ file ) ) , escapeshellarg ( $ destFile ) ) ; $ return = 0 ; $ output = system ( $ command , $ return ) ; $ content = file_get... | Read a file and returns text content |
237,859 | protected function writeMessage ( $ level , $ msg , $ vars = null ) { $ mtimeParts = explode ( ' ' , microtime ( ) ) ; $ repl = array ( Logger :: PATTERN_CLASS => $ this -> classContext , Logger :: PATTERN_CLASSNAME => StringUtils :: afterLast ( $ this -> classContext , '\\' ) , Logger :: PATTERN_LEVEL => str_pad ( $ l... | Writes the message with the given pattern into the defined log - file |
237,860 | protected function renderSlot ( Response $ response , SlotContent $ slotContent ) { if ( null === $ slotContent -> getSlotName ( ) ) { throw new \ RuntimeException ( 'No slot has been defined for the event ' . get_class ( $ this ) ) ; } $ isReplacing = $ slotContent -> isReplacing ( ) ; if ( null === $ isReplacing ) { ... | Renders the current slot |
237,861 | protected function injectContent ( SlotContent $ slotContent , $ content ) { $ regex = $ this -> getPattern ( $ slotContent -> getSlotName ( ) ) ; if ( false == preg_match ( $ regex , $ content , $ match ) ) { return ; } $ newContent = $ match [ 1 ] . PHP_EOL . $ slotContent -> getContent ( ) ; return preg_replace ( $ ... | Injects the content at the end of the given content |
237,862 | public function renderCell ( CellView $ cell ) { $ name = $ cell -> vars [ 'block_prefix' ] . '_cell' ; return trim ( $ this -> template -> renderBlock ( $ name , $ cell -> vars ) ) ; } | Renders a cell . |
237,863 | public function renderPager ( TableView $ view , $ viewName = 'twitter_bootstrap3' , array $ options = [ ] ) { if ( ! $ view -> pager ) { return '' ; } $ pageParam = $ view -> ui [ 'page_name' ] ; $ options = array_merge ( [ 'pageParameter' => '[' . $ pageParam . ']' , 'proximity' => 3 , 'next_message' => '»' , '... | Renders pager . |
237,864 | public function setOptions ( array $ options = array ( ) ) { if ( array_key_exists ( 'messages' , $ options ) ) { $ this -> setMessages ( $ options [ 'messages' ] ) ; } if ( array_key_exists ( 'hostname' , $ options ) ) { if ( array_key_exists ( 'allow' , $ options ) ) { $ this -> setHostnameValidator ( $ options [ 'ho... | Set options for the email validator |
237,865 | public function setValidateMx ( $ mx ) { if ( ( bool ) $ mx && ! $ this -> validateMxSupported ( ) ) { throw new Zend_Validate_Exception ( 'MX checking not available on this system' ) ; } $ this -> _options [ 'mx' ] = ( bool ) $ mx ; return $ this ; } | Set whether we check for a valid MX record via DNS |
237,866 | private function setLimit ( $ limit = self :: NO_LIMIT ) { if ( ! is_int ( $ limit ) ) { throw new Exceptions \ InvalidIntegerType ( gettype ( $ limit ) ) ; } if ( $ limit !== self :: NO_LIMIT && $ limit <= 0 ) { throw new Exceptions \ PositiveIntegerRequired ( $ limit ) ; } $ this -> limit = $ limit ; } | Stores the limit . |
237,867 | private function setTotalItems ( $ totalItems ) { if ( ! is_int ( $ totalItems ) ) { throw new Exceptions \ InvalidIntegerType ( gettype ( $ totalItems ) ) ; } if ( $ totalItems < 0 ) { throw new Exceptions \ PositiveIntegerRequired ( $ totalItems ) ; } $ this -> totalItems = $ totalItems ; $ this -> changedTotalItems ... | Stores the total amount of items . |
237,868 | private function calculateTotalPages ( ) { if ( $ this -> getTotalItems ( ) === 0 ) { $ this -> setTotalPages ( 1 ) ; return ; } $ totalPages = ceil ( $ this -> getTotalItems ( ) / $ this -> getLimit ( ) ) ; $ this -> setTotalPages ( ( int ) $ totalPages ) ; } | Calculates the total amount of pages . |
237,869 | private function setPage ( $ page ) { if ( ! is_int ( $ page ) ) { throw new Exceptions \ InvalidIntegerType ( gettype ( $ page ) ) ; } if ( $ page <= 0 ) { throw new Exceptions \ PositiveIntegerRequired ( $ page ) ; } $ this -> page = $ page ; $ this -> changedPage ( ) ; } | Stores the current page . |
237,870 | private function calculateOffset ( ) { if ( ! $ this -> hasLimit ( ) ) { $ this -> setOffset ( 0 ) ; return ; } $ offset = ( $ this -> getPage ( ) * $ this -> getLimit ( ) ) - $ this -> getLimit ( ) ; $ this -> setOffset ( ( int ) $ offset ) ; } | Calculates the offset for the current page and limit . |
237,871 | private function calculateFirstItemOnPage ( ) { $ offsetItem = $ this -> getOffset ( ) !== 0 ? 1 : 0 ; if ( $ this -> getTotalItems ( ) !== 0 && $ offsetItem === 0 ) { $ offsetItem = 1 ; } $ firstItem = $ this -> getOffset ( ) + $ offsetItem ; $ this -> setFirstItemOnPage ( ( int ) $ firstItem ) ; } | Calculates which item number is the first on the current page . |
237,872 | private function calculateLastItemOnPage ( ) { if ( ! $ this -> hasLimit ( ) ) { $ this -> setLastItemOnPage ( $ this -> getTotalItems ( ) ) ; return ; } $ lastItem = $ this -> getOffset ( ) + $ this -> getLimit ( ) ; if ( $ this -> getTotalItems ( ) !== 0 && $ lastItem > $ this -> getTotalItems ( ) ) { $ lastItem = $ ... | Calculates which item number is the last on the current page . |
237,873 | public function alert ( $ message , $ type = 'info' ) { Argument :: i ( ) -> test ( 2 , 'string' ) -> test ( 3 , 'string' ) ; return Alert :: i ( $ message , $ type ) ; } | Returns an alert |
237,874 | public function hero ( array $ images = array ( ) , $ delay = null ) { Argument :: i ( ) -> test ( 2 , 'scalar' , 'null' ) ; $ field = Hero :: i ( ) -> setImages ( $ images ) ; if ( ! is_null ( $ delay ) and is_numeric ( $ delay ) ) { $ field -> setDelay ( $ delay ) ; } return $ field ; } | Returns a hero |
237,875 | public function sort ( array $ query , $ key , $ label , $ url = null ) { Argument :: i ( ) -> test ( 2 , 'string' ) -> test ( 3 , 'string' ) -> test ( 4 , 'string' , 'null' ) ; $ block = Sort :: i ( $ query , $ key , $ label ) ; if ( $ url ) { $ block -> setUrl ( $ url ) ; } return $ block ; } | Returns table sort block |
237,876 | public function setPlatform ( PlatformInterface $ platform ) { $ this -> platform = $ platform ; $ this -> createTableSQLCollector -> setPlatform ( $ platform ) ; $ this -> dropTableSQLCollector -> setPlatform ( $ platform ) ; $ this -> alterTableSQLCollector -> setPlatform ( $ platform ) ; $ this -> init ( ) ; } | Sets the platform used to collect queries . |
237,877 | public function init ( ) { $ this -> createTableSQLCollector -> init ( ) ; $ this -> dropTableSQLCollector -> init ( ) ; $ this -> alterTableSQLCollector -> init ( ) ; $ this -> dropSequenceQueries = array ( ) ; $ this -> dropViewQueries = array ( ) ; $ this -> createViewQueries = array ( ) ; $ this -> createSequenceQu... | Reinitializes the SQL collector . |
237,878 | public function collect ( SchemaDiff $ schemaDiff ) { if ( $ schemaDiff -> getOldAsset ( ) -> getName ( ) !== $ schemaDiff -> getNewAsset ( ) -> getName ( ) ) { $ this -> renameSchemaQueries = array_merge ( $ this -> renameSchemaQueries , $ this -> platform -> getRenameDatabaseSQLQueries ( $ schemaDiff ) ) ; } $ this -... | Collects queries to alter a schema . |
237,879 | public function getQueries ( ) { return array_merge ( $ this -> getDropSequenceQueries ( ) , $ this -> getDropViewQueries ( ) , $ this -> getRenameTableQueries ( ) , $ this -> getDropCheckQueries ( ) , $ this -> getDropForeignKeyQueries ( ) , $ this -> getDropIndexQueries ( ) , $ this -> getDropPrimaryKeyQueries ( ) , ... | Gets the queries to alter the schema . |
237,880 | private function collectTables ( SchemaDiff $ schemaDiff ) { foreach ( $ schemaDiff -> getCreatedTables ( ) as $ table ) { $ this -> createTableSQLCollector -> collect ( $ table ) ; } foreach ( $ schemaDiff -> getDroppedTables ( ) as $ table ) { $ this -> dropTableSQLCollector -> collect ( $ table ) ; } foreach ( $ sch... | Collects queries about tables to alter a schema . |
237,881 | private function collectViews ( SchemaDiff $ schemaDiff ) { foreach ( $ schemaDiff -> getCreatedViews ( ) as $ view ) { $ this -> createViewQueries = array_merge ( $ this -> createViewQueries , $ this -> platform -> getCreateViewSQLQueries ( $ view ) ) ; } foreach ( $ schemaDiff -> getDroppedViews ( ) as $ view ) { $ t... | Collects queries about views to alter a schema . |
237,882 | private function collectSequences ( SchemaDiff $ schemaDiff ) { foreach ( $ schemaDiff -> getCreatedSequences ( ) as $ sequence ) { $ this -> createSequenceQueries = array_merge ( $ this -> createSequenceQueries , $ this -> platform -> getCreateSequenceSQLQueries ( $ sequence ) ) ; } foreach ( $ schemaDiff -> getDroppe... | Collects queries about sequences to a schema . |
237,883 | public static function is_wp_plugin_active ( $ plugin_file ) { $ active_plugins = ( array ) get_option ( 'active_plugins' , array ( ) ) ; if ( is_multisite ( ) ) { $ active_plugins = array_merge ( $ active_plugins , get_site_option ( 'active_sitewide_plugins' , array ( ) ) ) ; } return in_array ( $ plugin_file , $ acti... | Checks if plugin is active . Needs to be enabled in deferred way . |
237,884 | public function indexAction ( $ access ) { $ em = $ this -> getDoctrineManager ( ) ; $ sf = $ this -> container -> get ( 'sakonnin.files' ) ; $ files = $ sf -> getFilesForLoggedIn ( ) ; if ( $ this -> isRest ( $ access ) ) { return $ this -> returnRestData ( $ request , $ files , array ( 'html' => 'file:_index.html.twi... | Lists all file entities . |
237,885 | public function newAction ( Request $ request , $ access ) { $ file = new SakonninFile ( ) ; $ form = $ this -> createCreateForm ( $ file ) ; $ data = $ request -> request -> all ( ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ sf = $ this -> container -> get (... | Creates a new file entity . |
237,886 | public function showAction ( Request $ request , SakonninFile $ file , $ access ) { $ deleteForm = $ this -> createDeleteForm ( $ file ) ; return $ this -> render ( 'BisonLabSakonninBundle:SakonninFile:show.html.twig' , array ( 'file' => $ file , 'delete_form' => $ deleteForm -> createView ( ) , ) ) ; } | Finds and displays a file entity . |
237,887 | public function viewAction ( Request $ request , SakonninFile $ file , $ access ) { $ path = $ this -> getFilePath ( ) ; $ response = new BinaryFileResponse ( $ path . "/" . $ file -> getStoredAs ( ) ) ; return $ response ; } | View a file . |
237,888 | public function editAction ( Request $ request , SakonninFile $ file , $ access ) { $ deleteForm = $ this -> createDeleteForm ( $ file ) ; $ editForm = $ this -> createForm ( 'BisonLab\SakonninBundle\Form\SakonninFileType' , $ file ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isSubmitted ( ) && $ ... | Displays a form to edit an existing file entity . |
237,889 | public function deleteAction ( Request $ request , SakonninFile $ file , $ access ) { $ form = $ this -> createDeleteForm ( $ file ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrineManager ( ) ; $ em -> remove ( $ file ) ; $ em -> flush (... | Deletes a file entity . |
237,890 | public function createDeleteForm ( SakonninFile $ file ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'file_delete' , array ( 'id' => $ file -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> getForm ( ) ; } | Creates a form to delete a file entity . |
237,891 | public function onBootstrap ( EventInterface $ e ) { $ application = $ e -> getTarget ( ) ; $ serviceManager = $ application -> getServiceManager ( ) ; $ eventManager = $ application -> getEventManager ( ) ; $ eventManager -> attachAggregate ( $ serviceManager -> get ( 'Mailer\Mvc\PasswordRecoveryListener' ) ) ; $ even... | Registra delle azioni agli eventi che necesitano di invio email |
237,892 | public static function get ( $ type ) { $ instance = null ; switch ( $ type ) { case 'IM/Send' : $ instance = new SendService ( ) ; break ; case 'IM/Status' : $ instance = new StatusService ( ) ; break ; case 'TFA/Request' : $ instance = new RequestService ( ) ; break ; case 'TFA/Validate' : $ instance = new ValidateSe... | Get instance of the specified service . |
237,893 | public function make ( $ type ) { $ type = __NAMESPACE__ . "\\" . $ type ; if ( class_exists ( $ type ) ) { $ object = new $ type ( $ this -> helper ) ; $ result = $ object -> format ( ) ; if ( is_array ( $ result ) && ! empty ( $ result ) ) { return json_encode ( array_merge ( array ( '@context' => 'http://schema.org'... | Our schema . org object factory |
237,894 | public function shouldPassThrough ( Request $ request ) : bool { if ( empty ( $ this -> http_method ) && empty ( $ this -> http_path ) ) { return true ; } $ method = $ this -> http_method ; $ matches = array_map ( function ( $ path ) use ( $ method ) { $ path = trim ( config ( 'lia.route.prefix' ) , '/' ) . $ path ; if... | If request should pass through the current permission . |
237,895 | public function build ( $ aConnection , $ isDevMode = true ) { Type :: addType ( 'file_id' , FileIdType :: class ) ; return EntityManager :: create ( $ aConnection , Setup :: createYAMLMetadataConfiguration ( [ __DIR__ . '/Mapping' ] , $ isDevMode ) ) ; } | Decorates the doctrine entity manager with library s mappings and custom types . |
237,896 | public function message ( $ ruleOrMessage , $ message = null ) { if ( 1 === func_num_args ( ) ) { $ rule = $ this -> lastRule ; $ message = $ ruleOrMessage ; } else { $ rule = $ ruleOrMessage ; } $ this -> options [ 'messages' ] [ $ this -> lastKey ] [ $ rule ] = $ message ; return $ this ; } | Set rule message for current field |
237,897 | public function check ( $ data = null ) { $ validator = $ this -> getValidator ( $ data ) ; if ( $ validator -> isValid ( ) ) { return $ this -> suc ( ) ; } else { return $ this -> err ( $ validator -> getFirstMessage ( ) ) ; } } | Validate the data and return the ret array |
237,898 | public function data ( $ data ) { if ( ! $ data ) { return $ this ; } if ( ! $ this -> lastKey ) { $ data = [ '' => $ data ] ; } $ this -> options [ 'data' ] = $ data ; return $ this ; } | Set data for validation |
237,899 | protected function getValidator ( $ data = null ) { if ( ! $ this -> validator ) { if ( $ data ) { if ( $ this -> lastKey === '' ) { $ data = [ '' => $ data ] ; } $ this -> options [ 'data' ] = $ data ; } $ this -> validator = $ this -> wei -> validate ( $ this -> options ) ; } return $ this -> validator ; } | Instance validate object |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.