idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
59,800 | public function toSplit ( $ name , $ splitor = '-' , $ to = self :: LOWER ) { switch ( $ to ) { case self :: UPPER : return strtoupper ( preg_replace ( "/(.)([A-Z])/" , "$1{$splitor}$2" , $ name ) ) ; default : return strtolower ( preg_replace ( "/(.)([A-Z])/" , "$1{$splitor}$2" , $ name ) ) ; } } | usage example . CmsPageSort = > cms - page - sort |
59,801 | public static function getConstantValuesByPrefix ( $ className , $ prefix ) { $ prefixLength = strlen ( $ prefix ) ; $ result = [ ] ; $ reflection = new \ ReflectionClass ( $ className ) ; foreach ( $ reflection -> getConstants ( ) as $ constKey => $ constValue ) { if ( $ prefix === substr ( $ constKey , 0 , $ prefixLe... | Get Contant Values By Prefix |
59,802 | public function emptyData ( FormInterface $ form ) { $ file = $ form -> get ( 'bengor_file' ) -> getData ( ) ; if ( null === $ file ) { return ; } return new UploadFileCommand ( $ file -> getClientOriginalName ( ) , file_get_contents ( $ file -> getPathname ( ) ) , $ file -> getMimeType ( ) ) ; } | Method that encapsulates all the logic of build empty data . It returns an instance of data class object . |
59,803 | public function createDateTimeByUnixTime ( $ unixTime ) { $ dateTime = new \ DateTime ( '@' . $ unixTime ) ; $ dateTime -> setTimezone ( $ this -> specifiedTimeZone ) ; return $ dateTime ; } | Returns the created DateTime object specified the timezone . |
59,804 | private function createMultiLanguageController ( stdClass $ data ) { $ this -> createFileFromTemplate ( [ "destination" => $ data -> controllerDestination , "templateDestination" => __DIR__ . '/../templates/service/controller/multiLanguage.hctpl' , "content" => [ "namespace" => $ data -> controllerNamespace , "controll... | Creating multi language controller |
59,805 | private function getAdminListHeader ( stdClass $ data ) { $ output = '' ; $ model = $ data -> mainModel ; $ output .= $ this -> gatherHeaders ( $ model , array_merge ( $ this -> getAutoFill ( ) , [ 'id' ] ) , $ data -> translationsLocation , false ) ; if ( isset ( $ model -> multiLanguage ) ) $ output .= $ this -> gath... | Get list header from model data |
59,806 | private function getInputData ( stdClass $ data ) { $ output = '' ; $ skip = array_merge ( $ this -> getAutoFill ( ) , [ 'id' ] ) ; if ( ! empty ( $ data -> database ) ) { if ( isset ( $ data -> multiLanguage ) ) $ path = '/templates/service/controller/multilanguage/input.data.hctpl' ; else $ path = '/templates/service... | Get input keys from model data |
59,807 | private function getUseFiles ( stdClass $ data , bool $ multiLanguage = false ) { $ output = '' ; $ list = [ ] ; $ list [ ] = [ "nameSpace" => $ data -> modelNamespace , "name" => $ data -> mainModel -> modelName , ] ; if ( $ multiLanguage ) $ list [ ] = [ "nameSpace" => $ data -> modelNamespace , "name" => $ data -> m... | get use files |
59,808 | private function getSearchableFields ( stdClass $ data , bool $ multiLanguage = false ) { $ output = '' ; $ model = $ data -> mainModel ; $ whereTpl = file_get_contents ( __DIR__ . '/../templates/shared/where.hctpl' ) ; $ orWhereTpl = file_get_contents ( __DIR__ . '/../templates/shared/or.where.hctpl' ) ; $ skip = arra... | Get searchable fields from model data |
59,809 | private function getPropertyPath ( $ propertyPath ) { if ( ! isset ( $ this -> propertyPaths [ $ propertyPath ] ) ) { $ this -> propertyPaths [ $ propertyPath ] = new \ Symfony \ Component \ Form \ Util \ PropertyPath ( $ propertyPath ) ; } return $ this -> propertyPaths [ $ propertyPath ] ; } | Get property path object . |
59,810 | public function addCustomLayoutSectionsHook ( DataContainer $ dc ) { $ arrSections = $ this -> getActiveLayoutSections ( $ dc ) ; if ( isset ( $ GLOBALS [ 'TL_HOOKS' ] [ 'addLayoutSections' ] ) && is_array ( $ GLOBALS [ 'TL_HOOKS' ] [ 'addLayoutSections' ] ) ) { foreach ( $ GLOBALS [ 'TL_HOOKS' ] [ 'addLayoutSections' ... | Costum Column Hack |
59,811 | protected function saveModelData ( Model $ model , \ Ideil \ GenericFile \ Interpolator \ InterpolatorResult $ input ) { $ model_map = $ model -> getFileAssignMap ( ) ; $ model_fields = [ ] ; foreach ( $ input -> getData ( ) as $ field => $ value ) { $ model_fields [ isset ( $ model_map [ $ field ] ) ? $ model_map [ $ ... | Save file attributes required for interpolation to model . |
59,812 | public function moveUploadedFile ( File $ file , $ path_pattern = null , $ existing_model = null ) { $ model_class = $ this -> getConfig ( 'store.model' ) ; if ( ( $ model_class || $ existing_model ) && $ existing_model !== false ) { $ model_instance = $ existing_model ? : new $ model_class ( ) ; if ( ! $ model_instanc... | Move uploaded file to path by pattern and update model . |
59,813 | public function makeUrlToUploadedFile ( $ model , $ path_pattern = null , array $ model_map = array ( ) , $ domain = null ) { return parent :: makeUrlToUploadedFile ( $ model , $ path_pattern , $ model instanceof Model ? $ model -> getFileAssignMap ( ) : $ model_map , $ domain ) ; } | Make url to stored file . |
59,814 | public function makePathToUploadedFile ( $ model , $ path_pattern = null , array $ model_map = array ( ) ) { return parent :: makePathToUploadedFile ( $ model , $ path_pattern , $ model instanceof Model ? $ model -> getFileAssignMap ( ) : $ model_map ) ; } | Full path to stored file . |
59,815 | protected function flash ( string $ type , string $ message , string $ level ) { $ group = Session :: get ( $ type , new MessageBag ( ) ) ; Session :: flash ( $ type , $ group -> add ( $ level , $ message ) ) ; return $ this ; } | Flash message to the Session . |
59,816 | public function exist ( ) { $ this -> resCallback = $ this -> callback -> filter ( function ( HttpCallBack $ call ) { return $ this -> rutesManager -> existRutes ( $ call -> getPath ( ) , $ this -> peticion ) ; } ) ; } | Filtrar si existe algun controlador que pueda ser ejecutado sin importar si es el solicitado esto se verifica con la longitud de la rutas almacenada si coinciden con la ruta de la peticion . |
59,817 | public function compare ( ) { $ this -> resFilter = $ this -> resCallback -> filter ( function ( HttpCallBack $ call ) { return $ this -> rutesManager -> compareRute ( $ call -> getPath ( ) , $ this -> peticion ) ; } ) ; } | Filtrar si existe alguna ruta que sea identica a la ruta de la peticion esto se realiza a travez de la verificacion de patrones en las rutas . |
59,818 | public function execute ( ) { if ( $ this -> resFilter -> isEmpty ( ) && $ this -> rutesManager -> isRoot ( $ this -> actual , $ this -> peticion ) ) { $ this -> root ( ) ; return ; } if ( $ this -> resFilter -> isEmpty ( ) ) { $ this -> default ( ) ; return ; } $ this -> resFilter -> each ( function ( HttpCallBack $ c... | Ejecutar la ruta encontrada en caso de no encontrar nada ejecutar una por defecto |
59,819 | private function default ( ) { $ this -> callback -> filter ( function ( HttpCallBack $ test ) { return ! strcmp ( $ test -> getPath ( ) , $ this -> actual . '/**' ) ; } ) -> each ( function ( HttpCallBack $ test ) { $ test -> call ( $ this -> rutesManager -> getParameter ( ) ) ; } ) ; } | Metodo quen ejecuta el controlador por defecto cuando no existe una ruta posible a ejecutar . |
59,820 | protected function selfValidate ( ) { if ( $ this -> _isUndefined && $ this -> onUndefinedIgnore ) { $ this -> _safeVar = null ; $ this -> _isValid = true ; goto finish ; } if ( $ this -> isEmpty ( $ this -> _unsafeVar ) ) { if ( $ this -> onEmptyIgnore ) { $ this -> _safeVar = null ; $ this -> _isValid = true ; $ this... | Start validate the valley itself |
59,821 | final public function validate ( callable $ onDataInvalid = null ) : Validator { $ shell = $ this -> shell ; if ( count ( $ shell -> subValidators ) ) { $ shell -> _safeVar = [ ] ; foreach ( $ shell -> subValidators as $ key => $ validator ) { $ validator -> selfValidate ( ) ; if ( $ validator -> _isUndefined && $ vali... | Start validate the whole chain include the sub valleys |
59,822 | private function dispatchMetadataEvent ( $ eventName , EntityMetadata $ metadata ) { $ metadataArgs = new Events \ MetadataArguments ( $ metadata ) ; $ this -> dispatcher -> dispatch ( $ eventName , $ metadataArgs ) ; } | Dispatches a Metadata event |
59,823 | private function loadPersistenceMetadata ( EntityMetadata $ metadata ) { $ persisterKey = $ metadata -> persistence -> getKey ( ) ; $ persistenceFactory = $ this -> driver -> getPersistenceMetadataFactory ( $ persisterKey ) ; $ persistenceFactory -> handleLoad ( $ metadata ) ; $ persistenceFactory -> handleValidate ( $... | Handles persistence specific metadata loading . |
59,824 | private function loadSearchMetadata ( EntityMetadata $ metadata ) { if ( false === $ metadata -> isSearchEnabled ( ) ) { return $ metadata ; } $ clientKey = $ metadata -> search -> getKey ( ) ; $ searchFactory = $ this -> driver -> getSearchMetadataFactory ( $ clientKey ) ; $ searchFactory -> handleLoad ( $ metadata ) ... | Handles search specific metadata loading . |
59,825 | public function less ( $ num ) { self :: mustBeNumeric ( $ num , 'Tested number' ) ; if ( is_object ( $ num ) ) { return $ this -> value < $ num -> value ; } else { return $ this -> value < $ num ; } } | Checks whether current number is less than given one . |
59,826 | public function lte ( $ num ) { self :: mustBeNumeric ( $ num , 'Tested number' ) ; if ( is_object ( $ num ) ) { return $ this -> value <= $ num -> value ; } else { return $ this -> value <= $ num ; } } | Tests whether current number is less than or equal to given one . |
59,827 | public function greater ( $ num ) { self :: mustBeNumeric ( $ num , 'Tested number' ) ; if ( is_object ( $ num ) ) { return $ this -> value > $ num -> value ; } else { return $ this -> value > $ num ; } } | Tests whether current number is greater than given one . |
59,828 | public function gte ( $ num ) { self :: mustBeNumeric ( $ num , 'Tested number' ) ; if ( is_object ( $ num ) ) { return $ this -> value >= $ num -> value ; } else { return $ this -> value >= $ num ; } } | Tests whether current number is greater than or equal to the given number . |
59,829 | public function mod ( $ mod ) { self :: mustBeNumeric ( $ mod , 'Divisor' ) ; if ( $ mod instanceof N ) { $ mod = $ mod -> double ; } if ( $ mod == 0 ) { throw new \ InvalidArgumentException ( 'Cannot divide by 0!' ) ; } return new N ( fmod ( $ this -> value , $ mod ) ) ; } | Computes modulo of current number |
59,830 | protected function _prime ( ) { if ( $ this -> value < 2 ) { return false ; } if ( ! $ this -> _decimal ( ) -> zero ) { throw new \ RuntimeException ( 'You cannot test if number is prime numer if it is not an integer' ) ; } $ max = floor ( sqrt ( $ this -> value ) ) ; for ( $ i = 2 ; $ i <= $ max ; $ i ++ ) { if ( $ th... | Checks if current number is prime number |
59,831 | protected function _divisors ( ) { if ( ! $ this -> _decimal ( ) -> zero ) { throw new \ RuntimeException ( 'You can only get divisors from integers!' ) ; } $ n = abs ( $ this -> value ) ; $ a = new A ( ) ; for ( $ i = 1 ; $ i <= $ n ; $ i ++ ) { if ( $ n % $ i == 0 ) { $ a -> add ( new self ( $ i ) ) ; } } return $ a ... | Gets divisors for the current integer numbers . |
59,832 | public function pow ( $ num ) { self :: mustBeNumeric ( $ num , 'Power calculus' ) ; return new N ( pow ( $ this -> value , is_object ( $ num ) ? $ num -> value : $ num ) ) ; } | Computes current number at given power . |
59,833 | public function root ( $ num ) { self :: mustBeNumeric ( $ num , 'Root' ) ; $ n = is_object ( $ num ) ? $ num -> value : $ num ; if ( $ n == 0 ) { throw new \ InvalidArgumentException ( 'Root must be not nul' ) ; } return new N ( pow ( $ this -> value , 1 / $ n ) ) ; } | Gets nth root of current number . |
59,834 | protected function _factorial ( ) { if ( $ this -> value == 0 ) { return new N ( 1 ) ; } if ( $ this -> value < 0 ) { throw new \ RuntimeException ( 'Cannot get factorial of negative number!' ) ; } if ( ! $ this -> _decimal ( ) -> zero ) { throw new \ RuntimeException ( 'Cannot get factorial of non integer!' ) ; } retu... | Computes the factorial of current number . |
59,835 | public function equal ( $ num ) { self :: mustBeNumeric ( $ num , 'Test of equality' ) ; if ( is_object ( $ num ) ) { return $ this -> value == $ num -> value ; } else { return $ this -> value == $ num ; } } | Checks if current number is equal to given argument . |
59,836 | protected function _decimal ( ) { $ sign = 1 ; if ( $ this -> value < 0 ) { $ sign = - 1 ; } return new N ( $ sign * ( abs ( $ this -> value ) - floor ( abs ( $ this -> value ) ) ) ) ; } | Gets decimal part . |
59,837 | protected function _odd ( ) { if ( ( abs ( $ this -> value ) - floor ( abs ( $ this -> value ) ) ) != 0 ) { throw new \ RuntimeException ( 'Testing if number is odd or even only if it is an integer!' ) ; } return ( boolean ) ( $ this -> value & 1 ) ; } | Tests whether current number is odd . |
59,838 | public function plus ( $ number ) { self :: mustBeNumeric ( $ number , 'Value to add' ) ; $ number = is_object ( $ number ) ? $ number -> value : $ number ; return new self ( $ this -> value + $ number ) ; } | Adds current number to given argument . |
59,839 | public function minus ( $ number ) { self :: mustBeNumeric ( $ number , 'Value to substract' ) ; $ number = is_object ( $ number ) ? $ number -> value : $ number ; return new self ( $ this -> value - $ number ) ; } | Substract current number with other . |
59,840 | public function multiply ( $ number ) { self :: mustBeNumeric ( $ number , 'Value to multiply' ) ; $ number = is_object ( $ number ) ? $ number -> value : $ number ; return new self ( $ this -> value * $ number ) ; } | Creates new N by multipling the current to the given one |
59,841 | public function divide ( $ number ) { self :: mustBeNumeric ( $ number , 'Value to divide' ) ; $ number = is_object ( $ number ) ? $ number -> value : $ number ; if ( $ number == 0 ) { throw new \ InvalidArgumentException ( 'You cannot divide by zero!' ) ; } return new self ( $ this -> value / $ number ) ; } | Divide current number with given argument . |
59,842 | protected function _roman ( ) { if ( ! $ this -> _decimal ( ) -> zero || $ this -> value < 0 ) { throw new \ RuntimeException ( 'Converting into roman numerals uses only positive integers.' ) ; } $ arr_numerals = array ( ( object ) array ( 'integer' => 1000 , 'roman' => 'm' ) , ( object ) array ( 'integer' => 900 , 'ro... | Converts current number to roman number . |
59,843 | protected function _hex ( ) { if ( ! $ this -> _decimal ( ) -> zero ) { throw new \ RuntimeException ( 'Cannot get hexadecimal numbers from non integer.' ) ; } if ( $ this -> value < 0 ) { return new S ( '-' . dechex ( abs ( $ this -> value ) ) ) ; } else { return new S ( dechex ( $ this -> value ) ) ; } } | Converts to hexadecimal number . |
59,844 | protected function _oct ( ) { if ( ! $ this -> _decimal ( ) -> zero ) { throw new \ RuntimeException ( 'Cannot get octal numbers from non integer.' ) ; } if ( $ this -> value < 0 ) { return new S ( '-' . decoct ( abs ( $ this -> value ) ) ) ; } else { return new S ( decoct ( $ this -> value ) ) ; } } | Converts to octal number . |
59,845 | protected function _bin ( ) { if ( ! $ this -> _decimal ( ) -> zero ) { throw new \ RuntimeException ( 'Cannot get binary numbers from non integer.' ) ; } if ( $ this -> value < 0 ) { return new S ( '-' . decbin ( abs ( $ this -> value ) ) ) ; } else { return new S ( decbin ( $ this -> value ) ) ; } } | Converts to binary number . |
59,846 | public function base ( $ n ) { self :: mustBeInteger ( $ n , 'Base' ) ; if ( ! $ this -> _decimal ( ) -> zero ) { throw new \ RuntimeException ( 'Cannot convert to another base from non integer value.' ) ; } $ n = is_object ( $ n ) ? $ n -> int : $ n ; if ( ! is_numeric ( $ n ) || $ n < 2 || $ n > 36 ) { throw new \ In... | Converts current number into another base . |
59,847 | public function times ( $ callback ) { self :: mustBeCallable ( $ callback ) ; if ( ! $ this -> _decimal ( ) -> zero ) { throw new \ RuntimeException ( 'Cannot iterate given callback when number is not integer.' ) ; } if ( $ this -> value == 0 ) { throw new \ RuntimeException ( 'Cannot iterate given callback on a void ... | Repeats given callable param . |
59,848 | public function id ( String $ name = 'id' , int $ length = 15 , Bool $ null = false ) { return $ this -> integer ( $ name , $ length , $ null , true , [ 'primary' => true ] ) ; } | Represents an auto incremented field with a primary key index . |
59,849 | public function varchar ( String $ name , int $ length = 15 , Bool $ null = false , Bool $ autoIncrement = false , Array $ options = [ ] ) { return $ this -> setType ( 'Varchar' , $ name , $ length , $ null , $ autoIncrement , $ options ) ; } | Represents a variable - length non - binary string field . |
59,850 | public function decimal ( String $ name , $ length = 15 , Bool $ null = false , Bool $ autoIncrement = false , Array $ options = [ ] ) { return $ this -> setType ( 'Decimal' , $ name , $ length , $ null , $ autoIncrement , $ options ) ; } | Represents a fixed - point number field . |
59,851 | public function date ( String $ name , Bool $ null = false , Array $ options = [ ] ) { return $ this -> setType ( 'Date' , $ name , null , $ null , false , $ options ) ; } | Represents a date field . |
59,852 | public function foreign ( String $ keyName , Array $ options = [ ] , String $ onDelete = 'NO ACTION' , String $ onUpdate = 'NO ACTION' ) { $ columns = $ options [ 'columns' ] ; $ referenceTable = $ options [ 'references' ] ; $ refColumns = $ options [ 'refColumns' ] ; $ clauseList = [ 'CASCADE' , 'RESTRICT' , 'NO ACTIO... | Generates a foreign key constraint . |
59,853 | public function getDefinition ( $ separator = ',' ) { $ commands = self :: $ commands ; if ( sizeof ( $ commands ) > 0 ) { return implode ( $ separator , $ commands ) ; } return null ; } | Returns type sql definition . |
59,854 | protected function convertMultiFileArray ( array $ filesArr ) { $ files = array ( ) ; $ filesCount = count ( $ filesArr [ self :: VALUE_NAME ] ) ; for ( $ i = 0 ; $ i < $ filesCount ; ++ $ i ) { $ files [ ] = array ( self :: VALUE_NAME => $ filesArr [ self :: VALUE_NAME ] [ $ i ] , self :: VALUE_TYPE => $ filesArr [ se... | Restructures an input array of multiple files |
59,855 | protected function printLog ( $ sMessage ) { $ oDate = new \ DateTime ( ) ; echo $ oDate -> format ( 'H:i:s' ) . "\t{$sMessage}" . PHP_EOL ; return '(' . $ oDate -> format ( 'H:i:s' ) . ') ' . preg_replace ( '#(\[[0-9]+m)#' , '' , $ sMessage ) ; } | Print message to console |
59,856 | public static function createFromSapWeek ( $ sapWeek , $ timezone = null ) { if ( preg_match ( static :: $ sapWeekRegex , $ sapWeek , $ matches ) !== 1 ) { return false ; } $ week = sprintf ( '%sW%s' , $ matches [ 1 ] , $ matches [ 2 ] ) ; return new parent ( $ week , $ timezone ) ; } | Parse an SAP week string into a new DateTime object . |
59,857 | protected function getElementData ( ContainerInterface $ container , & $ data = [ ] ) { foreach ( $ container as $ element ) { if ( $ element instanceof InputInterface ) { $ data [ $ element -> getName ( ) ] = $ element -> getValue ( ) ; continue ; } if ( $ element instanceof ContainerInterface ) { $ this -> getElement... | Recursively collects all posted data |
59,858 | public function wasSubmitted ( ) { $ formMethod = strtoupper ( $ this -> getAttribute ( 'method' , 'post' ) ) ; $ formId = $ this -> getRequest ( ) -> getPost ( 'form-id' , false ) ; $ formId = $ formId ? $ formId : $ this -> getRequest ( ) -> getQuery ( 'form-id' , null ) ; $ submitted = $ this -> request -> getMethod... | Check if for was submitted or not |
59,859 | protected function updateValuesFromRequest ( ) { $ data = $ this -> getRequest ( ) -> isPost ( ) ? $ this -> getRequest ( ) -> getPost ( ) : $ this -> getRequest ( ) -> getQuery ( ) ; if ( isset ( $ _FILES ) ) { $ data = array_merge ( $ data , $ this -> request -> getUploadedFiles ( ) ) ; } $ this -> setValues ( $ data... | Assign form values from request |
59,860 | public function resolve ( ) { $ this -> zone = new $ this -> zoneClass ( ) ; $ this -> zone -> setZoneType ( $ this -> zoneType ) ; $ this -> zone -> setComponents ( $ this -> components -> buildRanking ( ) ) ; $ this -> assertEntityIsValid ( $ this -> zone , array ( 'Zone' , 'creation' ) ) ; $ this -> fireEvent ( Zone... | Zone creation method . |
59,861 | public function addRow ( array $ data = [ ] ) : int { $ this -> crudEnabled ( ) ; $ table_name = static :: $ table_name ; if ( 0 == count ( $ data ) ) { $ sql = "INSERT INTO {$table_name} DEFAULT VALUES" ; $ this -> dbc -> query ( $ sql ) ; } else { $ components = $ this -> dbc -> generateParameterizedComponents ( $ da... | Add a row to the table represented by this grid . If a table name id column or structure for the table is not defined above this function will not work . |
59,862 | public function deleteRow ( int $ id ) : void { $ this -> crudEnabled ( ) ; $ table_name = static :: $ table_name ; $ id_column = static :: $ id_column ; $ sql = "DELETE FROM {$table_name} WHERE {$id_column} = :key" ; $ this -> dbc -> query ( $ sql , [ 'params' => [ ':key' => $ id ] ] ) ; } | Delete the row specified by the passed identifier . If the necessary crud fields have not been identified in the child class this function will throw an exception . |
59,863 | public function updateRow ( $ id , array $ data ) : void { $ this -> crudEnabled ( ) ; $ components = $ this -> dbc -> generateParameterizedComponents ( $ data ) ; $ table_name = static :: $ table_name ; $ id_column = static :: $ id_column ; $ fields = $ components [ 'update' ] ; $ params = $ components [ 'params' ] ; ... | Updates an existing row based on the passed identifier . If the necessary crud fields have not been identified in the child class this function will throw an exception . |
59,864 | public function store ( $ key = '' , $ value = array ( ) , $ lock = true ) { if ( $ key == '' ) { $ this -> fault ( '[Error] Cannot store data without a key. Key is "' . $ key . '".' ) ; } if ( ! $ this -> has_key ( $ key ) ) { $ this -> create ( $ key , $ lock ) ; $ this -> store_data ( $ key , $ value ) ; } else { if... | Saves some data by key value . |
59,865 | static function forceLogin ( \ Db \ Connection $ db , $ user_id ) { User :: $ instance = User :: findUser ( $ db , $ user_id ) ; } | Login as the given user_id . |
59,866 | function delete ( \ Db \ Connection $ db ) { $ q = $ db -> prepare ( "DELETE FROM user_passwords WHERE user_id=?" ) ; $ q -> execute ( array ( $ this -> getId ( ) ) ) ; $ q = $ db -> prepare ( "DELETE FROM user_openid_identities WHERE user_id=?" ) ; $ q -> execute ( array ( $ this -> getId ( ) ) ) ; $ q = $ db -> prepa... | Delete the given user . Triggers a user_deleted event with the current user as an argument . |
59,867 | public function toString ( ) { $ content = "<VirtualHost {$this->address}:{$this->port}>" . PHP_EOL ; foreach ( $ this -> directives as $ directive ) { $ content .= $ directive -> toString ( ) . PHP_EOL ; } $ content .= PHP_EOL ; foreach ( $ this -> directories as $ directory ) { $ content .= $ directory -> toString ( ... | Converts vh to plain text |
59,868 | public function handleRequest ( Request $ request , Application $ app ) { if ( $ this -> isAutoRebuildMode ( $ app ) ) { $ this -> rebuildDatabase ( ) ; return ; } if ( $ this -> dbHasNotBeenBuilt ( ) ) { $ this -> rebuildDatabase ( ) ; return ; } if ( $ this -> isValidRebuildRequest ( $ request , $ app ) ) { $ this ->... | If the request includes an instruction to rebuild the db do that |
59,869 | protected function rebuildDatabase ( ) { $ this -> populator -> populate ( ) ; $ path = $ this -> buildIndicator -> getPathname ( ) ; $ content = 'Initial Build: ' . date ( 'Y-m-d H:i:s' ) ; $ this -> filesystem -> remove ( $ path ) ; $ this -> filesystem -> dumpFile ( $ path , $ content ) ; } | Builds the DB and creates a file indicating that the DB has been built at least once . |
59,870 | protected function renderError ( ElementInterface $ element ) { $ messages = $ element -> getMessages ( ) ; if ( empty ( $ messages ) ) { return null ; } $ errorPlugin = $ this -> getView ( ) -> plugin ( 'sxb_form_errors' ) ; return $ errorPlugin ( $ element ) ; } | Render errors . |
59,871 | private function getTips ( Description $ description ) { return array_map ( function ( \ stdClass $ tipDescription ) { return $ this -> tipFactory -> create ( new Description ( $ tipDescription ) ) ; } , $ description -> getOptionalProperty ( 'items' , [ ] ) ) ; } | Get the venue tips . |
59,872 | public static function arrayMap ( callable $ callback , array $ array ) { foreach ( $ array as $ key => $ value ) { $ array [ $ key ] = \ call_user_func ( $ callback , $ value , $ key ) ; } return $ array ; } | - array keys are available in callback - array keys have not been changed |
59,873 | private function expandConfigDirectories ( ) { $ newPaths = [ ] ; foreach ( $ this -> configDirectories as $ filePath ) { $ newPaths [ ] = __DIR__ . '/../../../../../' . $ filePath ; } $ this -> configDirectories = $ newPaths ; } | Ensures that config directories are relative paths |
59,874 | public function register ( $ alias , $ binding , $ shared = false ) { $ this -> registry [ $ alias ] = new Resolver ( new Builder ( $ binding ) , $ shared ) ; } | Register a binding with the registry |
59,875 | public function resolve ( $ alias , array $ parameters = array ( ) , $ force = false ) { if ( $ this -> registered ( $ alias ) ) { $ resolver = $ this -> registry [ $ alias ] ; return $ resolver -> execute ( $ parameters , $ force ) ; } throw new \ Exception ( 'No class found registered with that name: ' . $ alias ) ; ... | Execute the Resolver and return the requested binding instance |
59,876 | protected function updateAssignment ( ) { $ uri = str_replace ( '{assignment}' , $ this -> assignment , config ( 'forge-publish.update_assignment_uri' ) ) ; $ url = config ( 'forge-publish.url' ) . $ uri ; try { $ response = $ this -> http -> put ( $ url , [ 'form_params' => [ 'name' => $ this -> assignmentName , 'repo... | Update assignment . |
59,877 | public function form ( array $ options = [ ] ) { $ method = empty ( $ options [ 'method' ] ) ? $ options [ 'method' ] : '' ; if ( in_array ( strtolower ( $ method ) , [ 'get' , 'post' ] ) ) { $ real_method = $ method ; } else { $ real_method = 'POST' ; } $ options [ 'method' ] = $ real_method ; $ options [ 'action' ] =... | Generate the form . |
59,878 | public function add ( $ sHeader ) { foreach ( $ this -> headerList as $ sTmp ) { if ( $ sTmp == $ sHeader ) { throw new Exception ( "The '{$sHeader}' header has already been added." ) ; } } $ this -> headerList [ ] = $ sHeader ; return self :: $ instance ; } | It adds the header to the stack . |
59,879 | public function addByHttpCode ( $ nCode ) { $ sProtocol = isset ( $ _SERVER [ 'SERVER_PROTOCOL' ] ) ? $ _SERVER [ 'SERVER_PROTOCOL' ] : 'HTTP/1.1' ; $ sHeader = "{$sProtocol} {$nCode} " . self :: getHTTPExplanationByCode ( $ nCode ) ; return $ this -> add ( $ sHeader ) ; } | It adds the header to the stack by HTTP code . |
59,880 | public function run ( ) { $ this -> isRan = true ; foreach ( $ this -> headerList as $ sHeader ) { header ( $ sHeader ) ; } } | The main execution method . It sets all added headers into the page . |
59,881 | public function clearcache ( ) { if ( $ this -> view instanceof \ Sonic \ View \ Smarty ) { $ this -> view -> clearCompiledTemplate ( ) ; $ this -> view -> clearAllCache ( ) ; } new \ Sonic \ Message ( 'success' , 'Cache Cleared' ) ; $ this -> template = 'tools/index.tpl' ; } | Clear the view cache |
59,882 | public function highlight ( $ value , $ language ) { $ path = tempnam ( $ this -> tmp , 'pyg' ) ; if ( $ language === 'php' && substr ( $ value , 0 , 5 ) !== '<?php' ) { $ value = '<?php ' . PHP_EOL . $ value ; } $ this -> files -> dumpFile ( $ path , $ value ) ; $ value = $ this -> pygmentize ( $ path , $ language ) ;... | Highlight a portion of code with pygmentize |
59,883 | public function pygmentize ( $ path , $ language ) { $ process = new Process ( sprintf ( 'pygmentize -f html -l %s %s' , $ language , $ path ) ) ; $ process -> run ( ) ; if ( ! $ process -> isSuccessful ( ) ) { throw new RuntimeException ( $ process -> getErrorOutput ( ) ) ; } return trim ( $ process -> getOutput ( ) )... | Run pygmentize command on the given file |
59,884 | public function checkAuth ( ) { if ( isset ( $ _SESSION [ $ this -> _sessionVarName ] ) && $ _SESSION [ $ this -> _sessionVarName ] == 1 ) { return true ; } else { return false ; } } | Checks if a client is logged - in |
59,885 | public function assertIsNull ( $ value , $ message = 'Unexpected null value: %s' , $ exception = 'Asserts' ) { if ( is_null ( $ value ) ) { $ value = 'NULL' ; $ this -> throwException ( $ exception , $ message , $ value ) ; } } | Verifies that the specified condition is not null . The assertion fails if the condition is null . |
59,886 | public function row ( array $ attributes = array ( ) ) { $ row = new self ( ) ; if ( count ( $ attributes ) ) { $ row -> setAttributes ( $ attributes ) ; } return $ row ; } | Generates a new table row |
59,887 | public function add ( $ value , array $ attributes = null ) { $ cell = $ value ; if ( is_string ( $ value ) ) { $ cell = new Cell ( $ value , $ attributes ) ; } $ this -> _cells [ ] = $ cell ; return $ this ; } | Adds a cell to the row |
59,888 | public function isHeader ( $ isHeader = true ) { foreach ( $ this -> _cells as $ cell ) { $ cell -> isHeader ( $ isHeader ) ; } return $ this ; } | Set whether this row should be a table header or not |
59,889 | public function setState ( $ state = null ) { if ( null === $ state ) { $ this -> _state = $ state ; return $ this ; } if ( in_array ( $ state , array ( static :: STATE_SUCCESS , static :: STATE_ERROR , static :: STATE_INFO ) ) ) { $ this -> _state = $ state ; } return $ this ; } | Sets the row state |
59,890 | public function hasType ( $ nameOrType ) { $ name = $ nameOrType instanceof WidgetTypeInterface ? $ nameOrType -> getName ( ) : $ nameOrType ; return array_key_exists ( $ name , $ this -> types ) ; } | Returns whether the widget type is registered or not . |
59,891 | public function addType ( WidgetTypeInterface $ widget ) { if ( ! $ this -> hasType ( $ widget ) ) { $ this -> types [ $ widget -> getName ( ) ] = $ widget ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Widget type "%s" is already registered.' , $ widget -> getName ( ) ) ) ; } } | Adds the widget type . |
59,892 | public function getType ( $ name ) { if ( $ this -> hasType ( $ name ) ) { return $ this -> types [ $ name ] ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Widget type "%s" not found.' , $ name ) ) ; } } | Returns the widget type by name . |
59,893 | protected function parseResponse ( $ channel , $ content ) { $ headerSize = curl_getinfo ( $ channel , CURLINFO_HEADER_SIZE ) ; $ statusCode = curl_getinfo ( $ channel , CURLINFO_HTTP_CODE ) ; $ responseBody = substr ( $ content , $ headerSize ) ; $ responseHeaders = substr ( $ content , 0 , $ headerSize ) ; $ response... | Prepare response object |
59,894 | protected function _setContext ( $ context ) { $ this -> context = ( $ context !== null ) ? $ this -> _normalizeContainer ( $ context ) : null ; } | Sets the context for this instance . |
59,895 | public function toArray ( ) { $ hydrator = new ClassMethods ( ) ; $ vars = $ hydrator -> extract ( $ this ) ; foreach ( $ vars as $ key => & $ value ) { if ( $ value === null ) { unset ( $ vars [ $ key ] ) ; } elseif ( is_object ( $ value ) && ! $ value instanceof \ ArrayObject ) { if ( method_exists ( $ value , 'toArr... | Convert the model to an array . |
59,896 | protected function isRepeatRelational ( ) { $ is_repeat = false ; if ( array_count_values ( $ this -> getParentArray ( ) ) [ $ this -> prefix ] > 1 ) { $ is_repeat = true ; } return $ is_repeat ; } | Return true if relation is boucle infinie . |
59,897 | public function requireModel ( $ model , & $ data , $ prefix = null ) { $ class = null ; $ name = ( null !== $ prefix ) ? $ prefix : substr ( $ model , strlen ( explode ( '_' , $ model ) [ 0 ] ) + 7 ) ; foreach ( $ this -> array_prefix as $ k => $ ap ) { if ( strrpos ( $ ap , $ name ) === ( strlen ( $ ap ) - strlen ( $... | return Model if needed . |
59,898 | private function checkPearOrNoMatch ( $ classNameSpace , $ prefixLength , $ prefix ) { if ( ! $ classNameSpace ) { return false ; } if ( substr ( $ classNameSpace , 0 , $ prefixLength ) === $ prefix ) { return false ; } return true ; } | Check if the class is PEAR style or does not match at all . |
59,899 | public function pipe ( $ pipe , $ methodName = '' , ... $ params ) : self { if ( $ pipe instanceof Closure ) { $ this -> pipes [ ] = $ pipe ; return $ this ; } $ pipe = [ $ pipe , $ methodName , $ params , false ] ; $ this -> pipes [ ] = $ pipe ; return $ this ; } | Add stage for workflow . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.