idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
16,800
|
public function getResult ( QueryBuilder $ qb , $ locale = null , $ hydrationMode = AbstractQuery :: HYDRATE_OBJECT ) { return $ this -> getTranslatedQuery ( $ qb , $ locale ) -> getResult ( $ hydrationMode ) ; }
|
Returns translated results for given locale
|
16,801
|
public function getArrayResult ( QueryBuilder $ qb , $ locale = null ) { return $ this -> getTranslatedQuery ( $ qb , $ locale ) -> getArrayResult ( ) ; }
|
Returns translated array results for given locale
|
16,802
|
public function getSingleResult ( QueryBuilder $ qb , $ locale = null , $ hydrationMode = null ) { return $ this -> getTranslatedQuery ( $ qb , $ locale ) -> getSingleResult ( $ hydrationMode ) ; }
|
Returns translated single result for given locale
|
16,803
|
public function getScalarResult ( QueryBuilder $ qb , $ locale = null ) { return $ this -> getTranslatedQuery ( $ qb , $ locale ) -> getScalarResult ( ) ; }
|
Returns translated scalar result for given locale
|
16,804
|
public function getSingleScalarResult ( QueryBuilder $ qb , $ locale = null ) { return $ this -> getTranslatedQuery ( $ qb , $ locale ) -> getSingleScalarResult ( ) ; }
|
Returns translated single scalar result for given locale
|
16,805
|
protected function getTranslatedQuery ( QueryBuilder $ qb , $ locale = null ) { $ query = $ this -> setTranslationHints ( $ qb -> getQuery ( ) , $ locale ) ; return $ query ; }
|
Returns translated Doctrine query instance
|
16,806
|
public function assertPopulateData ( array $ data , array $ required ) : void { if ( count ( $ data ) < count ( $ required ) ) { throw new Exception ( sprintf ( 'Cannot populate %s, incorrect amount of properties given' , get_class ( $ this ) ) ) ; } foreach ( $ required as $ requiredKey ) { if ( ! isset ( $ data [ $ requiredKey ] ) ) { throw new Exception ( sprintf ( 'Cannot populate %s, missing %s' , get_class ( $ this ) , $ requiredKey ) ) ; } } }
|
Assert that the given data array contains all of the required keys
|
16,807
|
public function getLocaleById ( $ id ) { $ locale = $ this -> source -> where ( 'id' , $ id ) -> first ( ) ; return isset ( $ locale -> id ) ? $ locale -> locale : null ; }
|
Get locale by id .
|
16,808
|
private function buildDatasourceInstance ( $ sourceName , Logger $ logger ) { $ parser = new YAMLParser ( $ logger ) ; $ ymlFilePath = __SITE_PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'credentials.yml' ; $ parser -> setFilePath ( $ ymlFilePath ) ; $ dsConfig = $ parser -> loadConfig ( ) ; $ sourceName = trim ( $ sourceName , "<br>" ) ; $ datasourceClass = $ dsConfig [ 'database' ] [ $ sourceName ] [ 'class' ] ; $ datasource = new $ datasourceClass ( $ dsConfig [ 'database' ] [ $ sourceName ] [ 'credentials' ] ) ; $ datasource -> setLogger ( $ logger ) ; unset ( $ parser ) ; return $ datasource ; }
|
creates a datasource based on the credentials . yml configuration
|
16,809
|
public function denormalise ( array $ data , array $ options = [ ] ) { if ( empty ( $ data ) ) { return $ data ; } if ( ! isset ( $ options [ "entityClass" ] ) ) { throw new NormalisationException ( "Cannot denormalise data without knowing the main entity class" ) ; } if ( ! isset ( $ options [ "metadataProvider" ] ) ) { throw new NormalisationException ( "Cannot denormalise data without a metadata provider" ) ; } $ this -> metadataProvider = $ options [ "metadataProvider" ] ; $ metadata = $ this -> metadataProvider -> getEntityMetadata ( $ options [ "entityClass" ] ) ; $ prefixedFields = [ ] ; foreach ( $ data [ 0 ] as $ field => $ value ) { $ fieldParts = explode ( "__" , $ field ) ; if ( count ( $ fieldParts ) == 1 ) { array_unshift ( $ fieldParts , "" ) ; } $ prefix = $ fieldParts [ 0 ] ; if ( empty ( $ prefixedFields [ $ prefix ] ) ) { $ prefixedFields [ $ prefix ] = [ ] ; } $ prefixedFields [ $ prefix ] [ $ fieldParts [ 1 ] ] = $ field ; } if ( count ( $ prefixedFields ) == 1 ) { $ fields = array_pop ( $ prefixedFields ) ; $ primaryKey = $ metadata -> getPrimaryKey ( ) ; if ( isset ( $ fields [ $ primaryKey ] ) ) { $ this -> primaryKeyFields = [ $ fields [ $ primaryKey ] => true ] ; } return $ this -> denormaliseData ( $ data , $ fields ) ; } if ( ! isset ( $ options [ "entityMap" ] ) ) { throw new NormalisationException ( "Cannot denormalise data without an entity map" ) ; } $ entityMap = $ options [ "entityMap" ] ; $ collection = $ metadata -> getCollection ( ) ; if ( empty ( $ prefixedFields [ $ collection ] ) ) { throw new NormalisationException ( "The collection '$collection' was not found in the fields array for this record set: '" . implode ( "', '" , array_keys ( $ prefixedFields ) ) . "'" ) ; } $ this -> primaryKeyFields = [ ] ; $ this -> treedEntities = [ ] ; $ this -> childRowAliases = [ ] ; $ this -> createFieldTree ( $ prefixedFields , $ entityMap , $ collection , $ options [ "entityClass" ] ) ; reset ( $ data ) ; $ result = $ this -> denormaliseData ( $ data , $ prefixedFields [ $ collection ] , $ collection ) ; return $ result ; }
|
format DB data into standard format
|
16,810
|
public static function describeDOMElement ( $ other ) { if ( $ other instanceof DOMElement ) { $ tag = $ other -> tagName ; $ id = $ other -> getAttribute ( "id" ) ; $ id = $ id ? '#' . $ id : null ; $ classes = Converter :: parseClasses ( $ other -> getAttribute ( "class" ) ) ; $ classes = $ classes ? '.' . join ( '.' , $ classes ) : null ; return $ tag . $ id . $ classes ; } else { return '[unknown]' ; } }
|
Convert a dom element to a textual representation . Shows tag name id and classes
|
16,811
|
public function index ( ) { $ coreModules = $ this -> moduleManager -> getCoreModules ( ) ; $ thirdPartyModules = $ this -> moduleManager -> getThirdPartyModules ( ) ; return view ( 'modules::backend.modules.index' , compact ( 'coreModules' , 'thirdPartyModules' ) ) ; }
|
Display a list of all modules .
|
16,812
|
public function show ( Module $ module ) { $ module = $ this -> moduleManager -> get ( $ module ) ; $ changelog = $ this -> moduleManager -> changelogFor ( $ module ) ; return view ( 'modules::backend.modules.show' , compact ( 'module' , 'changelog' ) ) ; }
|
Display module info .
|
16,813
|
public function disable ( Module $ module ) { if ( $ this -> moduleManager -> isCoreModule ( $ module ) ) { return redirect ( ) -> route ( 'backend::modules.modules.show' , [ $ module -> getLowerName ( ) ] ) -> with ( 'error' , trans ( 'workshop::modules.module cannot be disabled' ) ) ; } $ module -> disable ( ) ; }
|
Disable the given module .
|
16,814
|
public static function exists ( $ module ) { if ( array_key_exists ( $ module , static :: $ modules ) ) { return static :: $ modules [ $ module ] ; } else { $ paths = \ Config :: get ( 'module_paths' , array ( ) ) ; foreach ( $ paths as $ path ) { if ( is_dir ( $ path . $ module ) ) { return $ path . $ module . DS ; } } } return false ; }
|
Checks if the given module exists .
|
16,815
|
public function getConfig ( $ file = null ) { $ file = ! empty ( $ file ) ? $ file : $ this -> fileCache ; if ( file_exists ( $ file ) ) { if ( ! is_readable ( $ file ) ) { throw new Exception \ RuntimeException ( sprintf ( '"%s" cannot read' , $ file ) ) ; } return require $ file ; } return false ; }
|
Get config from file cache
|
16,816
|
public function setConfig ( array $ config , $ file = null ) { $ file = ! empty ( $ file ) ? $ file : $ this -> fileCache ; if ( file_exists ( $ file ) ) { unlink ( $ file ) ; } ( new PhpArray ( ) ) -> setUseBracketArraySyntax ( true ) -> toFile ( $ file , $ config ) ; }
|
Set config to file
|
16,817
|
public static function get ( $ code ) { try { return static :: getByAlpha2 ( $ code ) ; } catch ( OutOfBoundsException $ e ) { try { return static :: getByAlpha3 ( $ code ) ; } catch ( OutOfBoundsException $ e ) { try { return static :: getByNumeric3 ( $ code ) ; } catch ( OutOfBoundsException $ e ) { throw new OutOfBoundsException ( "The code \"{$code}\" is not listed in ISO 4217" ) ; } } } }
|
Try all methods for a result .
|
16,818
|
public static function getByAlpha2 ( $ alpha2 ) { $ alpha2 = strtoupper ( $ alpha2 ) ; if ( ! isset ( static :: $ countries [ $ alpha2 ] ) ) { throw new OutOfBoundsException ( "The 2 character alpha code \"$alpha2\" is not listed in ISO 3166" ) ; } return new Country ( static :: $ countries [ $ alpha2 ] ) ; }
|
Find and return country by its alphabetic two - character identifier .
|
16,819
|
public static function getByAlpha3 ( $ alpha3 ) { $ alpha3 = strtoupper ( $ alpha3 ) ; if ( ! isset ( static :: $ alpha3Index [ $ alpha3 ] ) ) { throw new OutOfBoundsException ( "The 3 character alpha code \"$alpha3\" is not listed in ISO 3166" ) ; } return new Country ( static :: $ countries [ static :: $ alpha3Index [ $ alpha3 ] ] ) ; }
|
Find and return country by its alphabetic three - character identifier .
|
16,820
|
public static function getByNumeric3 ( $ numeric3 ) { $ numeric3 = strtoupper ( $ numeric3 ) ; if ( ! isset ( static :: $ numeric3Index [ $ numeric3 ] ) ) { throw new OutOfBoundsException ( "The 3 character numeric code \"$numeric3\" is not listed in ISO 3166" ) ; } return new Country ( static :: $ countries [ static :: $ numeric3Index [ $ numeric3 ] ] ) ; }
|
Find and return country by its numeric three - character identifier .
|
16,821
|
public static function all ( ) { $ countries = array_values ( static :: $ countries ) ; array_walk ( $ countries , function ( & $ value ) { $ value = new Country ( $ value ) ; } ) ; return $ countries ; }
|
Return all countries as a numerically - keyed array .
|
16,822
|
public function sessdb_table_exists ( ) { try { $ this -> db -> run_query ( "SELECT * FROM " . self :: tableName . " ORDER BY " . self :: tablePKey . " LIMIT 1" ) ; $ exists = true ; } catch ( exception $ e ) { $ this -> exception_handler ( __METHOD__ . ": exception while trying to detect table::: " . $ e -> getMessage ( ) ) ; $ exists = false ; } return ( $ exists ) ; }
|
Determines if the appropriate table exists in the database .
|
16,823
|
public function sessdb_read ( $ sid ) { $ retval = '' ; try { $ sql = "SELECT * FROM " . self :: tableName . " WHERE session_id=:sid" ; $ numRows = $ this -> db -> run_query ( $ sql , array ( 'sid' => $ sid ) ) ; if ( $ numRows == 1 ) { $ data = $ this -> db -> get_single_record ( ) ; $ retval = $ data [ 'session_data' ] ; } } catch ( exception $ e ) { $ this -> exception_handler ( __METHOD__ . ": failed to read::: " . $ e -> getMessage ( ) ) ; } return ( $ retval ) ; }
|
Read information about the session . If there is no data it MUST return an empty string instead of NULL .
|
16,824
|
public function set_plugin_data ( ) { if ( ! function_exists ( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php' ; } $ plugin_dir = plugin_basename ( dirname ( __FILE__ ) ) ; $ plugin_data = current ( get_plugins ( '/' . $ plugin_dir ) ) ; $ this -> plugin_data = apply_filters ( 'ctc_plugin_data' , $ plugin_data ) ; }
|
Set plugin data
|
16,825
|
public function load_textdomain ( ) { $ domain = 'churchthemes-framework' ; $ locale = apply_filters ( 'plugin_locale' , get_locale ( ) , $ domain ) ; $ external_mofile = WP_LANG_DIR . '/plugins/' . $ domain . '-' . $ locale . '.mo' ; if ( get_bloginfo ( 'version' ) <= 3.6 && file_exists ( $ external_mofile ) ) { load_textdomain ( $ domain , $ external_mofile ) ; } else { $ languages_dir = CTC_DIR . '/' . trailingslashit ( CTC_LANG_DIR ) ; load_plugin_textdomain ( $ domain , false , $ languages_dir ) ; } }
|
Load language file
|
16,826
|
protected function buildParameters ( $ className ) { $ metadata = $ this -> getModelManager ( ) -> getClassMetadata ( $ className ) ; $ managers = array ( ) ; foreach ( $ metadata -> getFieldMappings ( ) as $ model ) { $ managers [ $ model -> getManagerName ( ) ] = array ( 'namespace' => '\\' . $ model -> getName ( ) , 'methods' => array ( ) ) ; $ fields = $ model -> getFields ( ) ; if ( $ metadata -> getManagerIdentifier ( ) === $ model -> getManagerName ( ) ) { $ fields [ ] = $ metadata -> getFieldIdentifier ( ) ; } $ pattern = self :: patternDeclared ( $ fields ) ; $ refl = new \ ReflectionClass ( $ model -> getName ( ) ) ; foreach ( $ refl -> getMethods ( ) as $ method ) { if ( ! $ method -> isPublic ( ) || $ method -> isStatic ( ) || $ method -> isConstructor ( ) || $ method -> isDestructor ( ) || $ method -> isAbstract ( ) ) { continue ; } preg_match ( $ pattern , $ method -> getName ( ) , $ matches ) ; if ( empty ( $ matches ) ) { continue ; } $ arg = array ( 'comment' => $ method -> getDocComment ( ) , 'name' => $ method -> getName ( ) , 'type' => in_array ( $ matches [ 1 ] , array ( 'get' , 'is' , 'has' , 'all' , 'check' ) ) ? 'getter' : 'setter' , 'arguments' => Reflector :: parameters ( $ method -> getParameters ( ) ) , 'parameters' => $ method -> getParameters ( ) ) ; $ managers [ $ model -> getManagerName ( ) ] [ 'methods' ] [ ] = $ arg ; } } $ associations = new Bag ( ) ; foreach ( $ metadata -> getAssociationDefinitions ( ) as $ definition ) { if ( $ definition -> isMany ( ) ) { $ associations -> many [ $ definition -> getField ( ) ] = array ( 'fields' => $ definition -> getReferences ( ) , 'className' => $ definition -> getTargetMultiModel ( ) ) ; } else { $ associations -> one [ $ definition -> getField ( ) ] = array ( 'className' => $ definition -> getTargetMultiModel ( ) ) ; } } $ occ = strrpos ( $ metadata -> getName ( ) , '\\' ) ; return array ( 'model_namespace' => substr ( $ metadata -> getName ( ) , 0 , $ occ ) , 'model_name' => substr ( $ metadata -> getName ( ) , $ occ + 1 ) , 'managers' => $ managers , 'associations' => $ associations ) ; }
|
Build parameters with data recovered by the driver .
|
16,827
|
public function status ( $ status ) { if ( ! $ this -> statusIsNullable || $ status !== null ) { Checkers :: checkStatus ( $ status , null ) ; } $ this -> status = $ status ; return $ this ; }
|
Valid bootstrap status
|
16,828
|
public function importJournalSections ( $ oldJournalId , $ newJournalId ) { $ this -> consoleOutput -> writeln ( "Importing journal's sections..." ) ; $ sectionsSql = "SELECT * FROM sections WHERE journal_id = :id" ; $ sectionsStatement = $ this -> dbalConnection -> prepare ( $ sectionsSql ) ; $ sectionsStatement -> bindValue ( 'id' , $ oldJournalId ) ; $ sectionsStatement -> execute ( ) ; $ sections = $ sectionsStatement -> fetchAll ( ) ; try { $ this -> em -> beginTransaction ( ) ; $ createdSections = array ( ) ; $ createdSectionIds = array ( ) ; $ persistCounter = 0 ; foreach ( $ sections as $ section ) { $ createdSection = $ this -> importSection ( $ section [ 'section_id' ] , $ newJournalId ) ; $ createdSections [ $ section [ 'section_id' ] ] = $ createdSection ; $ persistCounter ++ ; if ( $ persistCounter % 10 == 0 || $ persistCounter == count ( $ sections ) ) { $ this -> consoleOutput -> writeln ( "Writing sections..." , true ) ; $ this -> em -> flush ( ) ; $ this -> em -> commit ( ) ; $ this -> em -> clear ( ) ; $ this -> em -> beginTransaction ( ) ; foreach ( $ createdSections as $ oldSectionId => $ entity ) { $ createdSectionIds [ $ oldSectionId ] = $ entity -> getId ( ) ; $ map = new ImportMap ( $ oldSectionId , $ entity -> getId ( ) , Section :: class ) ; $ this -> em -> persist ( $ map ) ; } $ this -> em -> flush ( ) ; $ createdSections = [ ] ; } } $ this -> em -> commit ( ) ; } catch ( Exception $ exception ) { $ this -> em -> rollback ( ) ; throw $ exception ; } return $ createdSectionIds ; }
|
Imports sections of the given journal .
|
16,829
|
public function importSection ( $ id , $ newJournalId ) { $ journal = $ this -> em -> getReference ( 'VipaJournalBundle:Journal' , $ newJournalId ) ; $ this -> consoleOutput -> writeln ( "Reading section #" . $ id . "... " , true ) ; $ sectionSql = "SELECT * FROM sections WHERE section_id = :id LIMIT 1" ; $ sectionStatement = $ this -> dbalConnection -> prepare ( $ sectionSql ) ; $ sectionStatement -> bindValue ( 'id' , $ id ) ; $ sectionStatement -> execute ( ) ; $ settingsSql = "SELECT locale, setting_name, setting_value FROM section_settings WHERE section_id = :id" ; $ settingsStatement = $ this -> dbalConnection -> prepare ( $ settingsSql ) ; $ settingsStatement -> bindValue ( 'id' , $ id ) ; $ settingsStatement -> execute ( ) ; $ pkpSection = $ sectionStatement -> fetch ( ) ; $ pkpSettings = $ settingsStatement -> fetchAll ( ) ; foreach ( $ pkpSettings as $ setting ) { $ locale = ! empty ( $ setting [ 'locale' ] ) ? $ setting [ 'locale' ] : 'en_US' ; $ name = $ setting [ 'setting_name' ] ; $ value = $ setting [ 'setting_value' ] ; $ this -> settings [ $ locale ] [ $ name ] = $ value ; } $ section = new Section ( ) ; $ section -> setJournal ( $ journal ) ; $ section -> setAllowIndex ( ! empty ( $ pkpSection [ 'meta_indexed' ] ) ? $ pkpSection [ 'meta_indexed' ] : 0 ) ; $ section -> setHideTitle ( ! empty ( $ pkpSection [ 'hide_title' ] ) ? $ pkpSection [ 'hide_title' ] : 0 ) ; $ section -> setSectionOrder ( ! empty ( $ pkpSection [ 'seq' ] ) ? intval ( $ pkpSection [ 'seq' ] ) : 0 ) ; foreach ( $ this -> settings as $ fieldLocale => $ fields ) { $ section -> setCurrentLocale ( mb_substr ( $ fieldLocale , 0 , 2 , 'UTF-8' ) ) ; $ section -> setTitle ( ! empty ( $ fields [ 'title' ] ) ? $ fields [ 'title' ] : '-' ) ; } $ this -> consoleOutput -> writeln ( "Writing section #" . $ id . "... " , true ) ; $ this -> em -> persist ( $ section ) ; return $ section ; }
|
Imports the given section
|
16,830
|
protected function newLogEntry ( $ channel , $ level , $ message , array $ context = [ ] ) { if ( is_null ( $ this -> entry_proto ) ) { return new LogEntry ( $ channel , $ level , $ message , $ context ) ; } else { $ entry = clone $ this -> entry_proto ; return $ entry -> setChannel ( $ channel ) -> setLevel ( $ level ) -> setMessage ( $ message ) -> setContext ( $ context ) -> setTimestamp ( ) ; } }
|
Create a log entry
|
16,831
|
public function getDefaultConfiguration ( ) { $ query = $ this -> createQueryBuilder ( 'c' ) ; $ query -> where ( 'c.isDefault=:isDefault' ) -> orderBy ( 'c.updatedAt' , 'DESC' ) -> setMaxResults ( 1 ) -> setParameter ( ':isDefault' , true ) ; return $ query -> getQuery ( ) -> getResult ( ) ; }
|
Get Default Configuration
|
16,832
|
private function getFrameArgsOutput ( Frame $ frame , $ line ) { if ( $ this -> addTraceFunctionArgsToOutput ( ) === false || $ this -> addTraceFunctionArgsToOutput ( ) < $ line ) { return '' ; } ob_start ( ) ; var_dump ( $ frame -> getArgs ( ) ) ; if ( ob_get_length ( ) > $ this -> getTraceFunctionArgsOutputLimit ( ) ) { ob_clean ( ) ; return sprintf ( "\n%sArguments dump length greater than %d Bytes. Discarded." , self :: VAR_DUMP_PREFIX , $ this -> getTraceFunctionArgsOutputLimit ( ) ) ; } return sprintf ( "\n%s" , preg_replace ( '/^/m' , self :: VAR_DUMP_PREFIX , ob_get_clean ( ) ) ) ; }
|
Get the frame args var_dump .
|
16,833
|
public function getConnectionByToken ( Token $ token ) { $ application = $ this -> oauthApp -> getApplication ( self :: RESOURCE_OWNER ) ; $ connection = $ this -> connect ( $ application -> getKey ( ) , $ application -> getSecret ( ) , $ token -> getAccessToken ( ) , $ token -> getTokenSecret ( ) ) ; return new LinkedInClientService ( $ connection ) ; }
|
Return a connection based on the suplied Token
|
16,834
|
protected function normalizeDateTime ( $ value ) { try { if ( is_int ( $ value ) ) { $ value = new DateTime ( "@$value" ) ; } elseif ( ! $ value instanceof DateTime ) { $ value = new DateTime ( $ value ) ; } } catch ( \ Exception $ e ) { throw new InvalidArgumentException ( 'Invalid date string provided' , $ e -> getCode ( ) , $ e ) ; } return $ value ; }
|
Normalize the provided value to a DateTime object
|
16,835
|
public static function create ( $ expected , $ actual , $ paramNo = null , $ code = null , $ previous = null ) { $ msgMsk = 'Expected %1$s. Got %2$s' ; if ( $ paramNo !== null ) { $ msgMsk = 'Param #%3$s ' . lcfirst ( $ msgMsk ) ; } if ( $ code !== null ) { $ msgMsk = '[%4$s] ' . $ msgMsk ; } $ class = get_called_class ( ) ; return new $ class ( sprintf ( $ msgMsk , $ expected , Debug :: summarise ( $ actual ) , $ paramNo , $ code ) , is_int ( $ code ) ? $ code : null , $ previous ) ; }
|
Invalid Argument exception factory
|
16,836
|
public static function token ( String $ uri = NULL , String $ type = 'post' ) { Security :: CSRFToken ( $ uri , $ type ) ; }
|
Cross Site Request Forgery
|
16,837
|
private function performCurlSession ( $ payload ) { $ perCurlConnection = curl_init ( ) ; curl_setopt ( $ perCurlConnection , CURLOPT_URL , $ this -> url ) ; curl_setopt ( $ perCurlConnection , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ perCurlConnection , CURLOPT_TIMEOUT , 10 ) ; curl_setopt ( $ perCurlConnection , CURLOPT_POSTFIELDS , $ payload ) ; $ result = curl_exec ( $ perCurlConnection ) ; return $ result ; }
|
Perform the curl session .
|
16,838
|
private static function checkValidator ( $ validator ) { if ( ! array_key_exists ( $ validator , self :: $ validators ) ) { return self :: checkClass ( $ validator ) ; } return self :: $ validators [ $ validator ] ; }
|
Check if the provided validator is a known alias or a valid validator interface class
|
16,839
|
private static function checkClass ( $ validator ) { if ( ! class_exists ( $ validator ) ) { throw new InvalidArgumentException ( "Class {$validator} does not exists." ) ; } if ( ! is_subclass_of ( $ validator , ValidatorInterface :: class ) ) { throw new Exception \ UnknownValidatorClassException ( "The validator '{$validator}' is not defined or does not " . "implements the Slick\\Validator\\ValidatorInterface interface" ) ; } return $ validator ; }
|
Check if is a valid validator class
|
16,840
|
public function transformRaw ( $ comment ) { $ comment = preg_replace ( '/[\/\*]/' , '' , $ comment ) ; $ chunks = array_map ( 'trim' , explode ( PHP_EOL , $ comment ) ) ; return implode ( PHP_EOL , array_filter ( $ chunks ) ) ; }
|
Prettify a raw comment .
|
16,841
|
public function id ( ) : string { $ name = $ this -> name ( ) ; $ name = preg_replace ( "@\[\]$@" , '' , $ name ) ; if ( $ name ) { return $ name . '-' . $ this -> value ; } return $ name ; }
|
Returns the ID of the element .
|
16,842
|
public function isRequired ( ) : Testable { $ this -> attributes [ 'required' ] = true ; return $ this -> addTest ( 'required' , function ( $ value ) { return $ this -> checked ( ) ; } ) ; }
|
Mark the field as required .
|
16,843
|
public function inGroup ( bool $ status = null ) : bool { if ( ! is_null ( $ status ) ) { $ this -> inGroup = $ status ; } return $ this -> inGroup ; }
|
Get or set whether this element is part of a group .
|
16,844
|
public function registerModulePath ( $ moduleName , $ path , $ addPrefix = true ) { $ normalized = static :: normalizePath ( $ path ) . PHP_DS ; if ( $ addPrefix ) { $ normalized .= static :: DEFAULT_PREFIX . PHP_DS ; } $ this -> modulesMap [ static :: normalizeModule ( $ moduleName ) ] = $ normalized ; return $ this ; }
|
Registers module path .
|
16,845
|
public function registerTemplatePath ( $ templateName , $ path ) { $ this -> templatesMap [ ( string ) $ templateName ] = ( string ) $ path ; return $ this ; }
|
Register the template path .
|
16,846
|
protected function resolveModule ( $ template , $ module ) { $ fullName = $ module . '::' . $ template ; if ( isset ( $ this -> templatesMap [ $ fullName ] ) ) { $ file = $ this -> normalizePath ( $ this -> templatesMap [ $ fullName ] ) ; if ( ! file_exists ( $ file ) ) { throw new RuntimeException ( sprintf ( 'The file "%s" of template "%s" not exists.' , $ file , $ template ) ) ; } return $ file ; } return $ this -> findFile ( $ module , $ template ) ; }
|
Resolves the specified module .
|
16,847
|
protected function findFile ( $ module , $ template ) { if ( ! isset ( $ this -> modulesMap [ $ module ] ) ) { return false ; } $ tpl = str_replace ( '/' , PHP_DS , $ template ) ; $ found = glob ( $ this -> modulesMap [ $ module ] . $ tpl . '.*' ) ; if ( ! $ found ) { return false ; } $ file = $ found [ 0 ] ; $ this -> templatesMap [ $ module . '::' . $ template ] = $ file ; return $ file ; }
|
Finds file .
|
16,848
|
public static function normalizeModule ( $ module ) { $ module = ( string ) $ module ; if ( isset ( static :: $ moduleNames [ $ module ] ) ) { return static :: $ moduleNames [ $ module ] ; } $ normalized = trim ( str_replace ( '\\' , '/' , $ module ) , '/' ) ; $ result = strtolower ( preg_replace ( '/([a-zA-Z])(?=[A-Z])/' , '$1-' , $ normalized ) ) ; static :: $ moduleNames [ $ module ] = $ result ; return $ result ; }
|
Normalizes module name .
|
16,849
|
protected static function normalizePath ( $ path ) { $ normalized = str_replace ( [ '\\' , '/' ] , PHP_DS , ( string ) $ path ) ; return rtrim ( $ normalized , PHP_DS ) ; }
|
Normalizes path .
|
16,850
|
public function filter ( $ value ) { if ( preg_match ( '/^-?\d+$/' , $ value ) === 1 ) { if ( $ value < 0 ) { throw new \ DomainException ( 'Invalid value' ) ; } return $ value ; } if ( $ this -> getConfig ( 'allowSqlSpecials' ) === true ) { $ temp = strtolower ( $ value ) ; if ( $ temp === 'now()' || $ temp === 'current_timestamp' ) { return time ( ) ; } } $ time = strtotime ( $ value ) ; if ( $ time === false ) { throw new \ DomainException ( 'Invalid value' ) ; } return $ time ; }
|
Convert a string to a timestamp .
|
16,851
|
private function filterArray ( array $ data , array $ options ) { $ this -> sanitized = true ; return filter_var_array ( $ data , $ options , true ) ; }
|
Filters an Array recursively
|
16,852
|
public function word ( $ data , $ default = '' , $ options = [ ] ) { $ sentence = $ this -> string ( $ data , $ default , $ options , false ) ; return ( string ) strstr ( $ sentence , ' ' , true ) ; }
|
Returns the first word a sanitised string Strip tags optionally strip or encode special characters .
|
16,853
|
public static function setInstance ( $ args ) { $ name = array_shift ( $ args ) ; $ name = self :: getAccessor ( $ name ) ; $ reflect = new \ ReflectionClass ( $ name ) ; return $ reflect -> newInstanceArgs ( $ args ) ; }
|
Set Instance .
|
16,854
|
public function createBlockAction ( Request $ request , $ type ) { $ entity = new Block ( ) ; $ entity -> setType ( $ type ) ; $ form = $ this -> createBlockCreateForm ( $ entity ) ; $ form -> handleRequest ( $ request ) ; $ availableLangs = $ this -> container -> getParameter ( 'flowcode_page.available_languages' ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ page = $ entity -> getPage ( ) ; foreach ( $ availableLangs as $ key => $ value ) { $ entityLang = new Block ( ) ; $ entityLang -> setName ( $ entity -> getName ( ) ) ; $ entityLang -> setLang ( $ key ) ; $ entityLang -> setContent ( $ entity -> getContent ( ) ) ; $ entityLang -> setPage ( $ entity -> getPage ( ) ) ; $ entityLang -> setType ( $ type ) ; $ em -> persist ( $ entityLang ) ; } $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_page_show' , array ( 'id' => $ page -> getId ( ) ) ) ) ; } return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ; }
|
Creates a new Block entity .
|
16,855
|
public function editBlockAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'AmulenPageBundle:Block' ) -> find ( $ id ) ; $ availableEntityLangs = $ em -> getRepository ( 'AmulenPageBundle:Block' ) -> findBy ( array ( 'page' => $ entity -> getPage ( ) , 'name' => $ entity -> getName ( ) ) ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Block entity.' ) ; } $ editForm = $ this -> createBlockEditForm ( $ entity ) ; $ deleteForm = $ this -> createBlockDeleteForm ( $ id ) ; return array ( 'entity' => $ entity , 'availableEntityLangs' => $ availableEntityLangs , 'edit_form' => $ editForm -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , ) ; }
|
Displays a form to edit an existing Block entity .
|
16,856
|
public static function returnUrl ( ) { if ( self :: $ returnUrl === null ) { $ url = [ '/' . ltrim ( Yii :: $ app -> requestedRoute , '/' ) ] ; foreach ( Yii :: $ app -> request -> queryParams as $ key => $ value ) { $ url [ $ key ] = $ value ; } self :: $ returnUrl = Url :: to ( $ url ) ; } return self :: $ returnUrl ; }
|
returnURL param value . Used for links from grids and etc . where we should return back to specified URL
|
16,857
|
public function setDefault ( $ default ) : Value { if ( isset ( $ default ) && ! $ this -> mode -> is ( Value :: OPTIONAL ) ) { throw new \ InvalidArgumentException ( 'Cannot set a default value for non-optional values.' ) ; } $ this -> default = $ default ; return $ this ; }
|
Sets the default value for the underlying Parameter .
|
16,858
|
protected function registerContainerAliases ( ) { $ aliases = [ 'app' => [ 'Illuminate\Container\Container' , 'Illuminate\Contracts\Container\Container' ] , 'config' => [ 'Illuminate\Config\Repository' , 'Illuminate\Contracts\Config\Repository' ] , 'log' => [ 'Psr\Log\LoggerInterface' ] , ] ; foreach ( $ aliases as $ key => $ aliases ) { foreach ( $ aliases as $ alias ) { $ this -> alias ( $ key , $ alias ) ; } } }
|
Register the core container aliases .
|
16,859
|
protected function registerParameterBinder ( ) { $ this -> app -> singleton ( RouteBinderRegister :: class , function ( Container $ container ) { return new RouteBinderRegister ( $ container , $ container -> make ( 'router' ) ) ; } ) ; }
|
Register route parameter binder
|
16,860
|
public function name ( ) { if ( empty ( $ this -> data -> names ) ) return null ; if ( isset ( $ this -> data -> names -> { $ this -> default_locale } ) ) return $ this -> data -> names -> { $ this -> default_locale } ; if ( isset ( $ this -> data -> names -> en ) ) return $ this -> data -> names -> en ; return $ this -> data -> names [ 0 ] ; }
|
Return name in default locale
|
16,861
|
public function addExtraAppearance ( $ appearance , $ before = FALSE ) { if ( $ before ) { array_unshift ( $ this -> extra_appearances , $ appearance ) ; } else { array_push ( $ this -> extra_appearances , $ appearance ) ; } }
|
Adds an optional appearance tag that will be used for all render calls .
|
16,862
|
private function loadViews ( ) { if ( $ this -> views ) { return ; } $ cache = $ this -> getLoops ( ) -> getService ( "cache" ) ; $ key = "Loops-Renderer-" . implode ( "-" , $ this -> view_dir ) ; if ( $ cache -> contains ( $ key ) ) { $ this -> views = $ cache -> fetch ( $ key ) ; } else { foreach ( $ this -> view_dir as $ view_dir ) { $ this -> scanViewDir ( $ view_dir ) ; } $ cache -> save ( $ key , $ this -> views ) ; } }
|
Helper that scans the view dirs and stores the inforation in the cache
|
16,863
|
public function load ( $ slug , $ branch = 'master' ) { $ this -> data = array ( ) ; $ this -> httpClient -> setBaseUrl ( $ this -> helper -> getRawFileUrl ( $ slug , $ branch , '' ) ) ; $ this -> data = $ this -> getResponse ( 'composer.json' ) ; }
|
Load Composer data by reading composer . json file
|
16,864
|
public function getAttributes ( $ key = null ) { if ( ! ( $ key ) ) { return $ this -> attributes ; } return $ this -> attributes -> get ( $ key ) ; }
|
Get the attributes .
|
16,865
|
public function process ( ) { $ this -> data = array_values ( $ this -> data ) ; if ( isset ( $ this -> data [ 0 ] ) ) { $ data = $ this -> data ; } else { $ data = [ $ this -> data ] ; } foreach ( $ data as $ key => $ value ) { $ model = $ this -> fill ( $ key , collect ( $ value ) ) ; $ this -> collection -> push ( $ model ) ; } return $ this -> collection ; }
|
Process the raw data and return a collection filled with populated models .
|
16,866
|
public function execute ( $ params = array ( ) , $ request = array ( ) ) { $ this -> getQueryBuilder ( ) -> where ( $ params ) ; $ query = '' ; if ( $ this -> entity instanceof AbstractI18nEntity ) { $ query = $ this -> getQueryBuilder ( ) -> getQuery ( $ this -> entity , QueryBuilder :: GET_ITEM_QUERY , QueryBuilder :: PARENT_AND_CHILD ) ; } else { $ query = $ this -> getQueryBuilder ( ) -> getQuery ( $ this -> entity , QueryBuilder :: GET_ITEM_QUERY ) ; } $ firstResult = $ this -> query ( $ query ) ; $ entityName = get_class ( $ this -> entity ) ; if ( is_array ( $ firstResult ) && count ( $ firstResult ) > 0 ) { $ this -> loadI18nValues ( $ firstResult , $ params ) ; $ this -> loadChildTableParams ( $ firstResult , $ params ) ; $ this -> loadOneToOneJoinTables ( $ firstResult ) ; $ this -> loadOneToManyJoinTables ( $ firstResult , $ params ) ; } return array ( $ entityName => is_array ( $ firstResult ) ? current ( $ firstResult ) : array ( ) ) ; }
|
retrieves a single row from the database
|
16,867
|
private function loadI18nValues ( & $ firstResult , $ params ) { if ( ! $ this -> entity instanceof AbstractI18nEntity ) { return ; } $ filter = array ( $ this -> entity -> getI18nIdentifier ( ) => $ firstResult [ 0 ] [ 'id' ] ) ; $ localesKey = 'locales' ; if ( is_array ( $ params ) && array_key_exists ( 'locale' , $ params ) ) { $ filter [ 'locale' ] = $ params [ 'locale' ] ; $ localesKey = $ params [ 'locale' ] ; } $ this -> getQueryBuilder ( ) -> where ( $ filter ) ; $ query = $ this -> getQueryBuilder ( ) -> getQuery ( $ this -> entity , QueryBuilder :: GET_ALL_ITEMS_QUERY , QueryBuilder :: CHILD_ONLY ) ; $ i18nResult = $ this -> query ( $ query ) ; if ( $ localesKey == 'locales' ) { $ firstResult [ 0 ] [ 'locales' ] = $ this -> getLocaleKeys ( $ i18nResult , $ this -> getI18nValuesForPadding ( ) ) ; } else { $ firstResult [ 0 ] [ 'locales' ] [ $ localesKey ] = $ i18nResult ; } }
|
load child rows from I18n specific to requested entity
|
16,868
|
public function prepareResult ( $ success , $ message , $ code , $ data , $ errors ) { $ this -> success = $ success ; $ this -> code = $ code ; $ this -> message = $ message ; if ( is_null ( $ this -> data ) ) { $ this -> data = array ( ) ; } else { if ( ! is_array ( $ this -> data ) ) { $ old = $ this -> data ; $ this -> data = array ( ) ; array_push ( $ this -> data , $ old ) ; } } if ( ! is_null ( $ data ) ) { if ( is_array ( $ data ) ) { $ this -> data = array_merge ( $ this -> data , $ data ) ; } else { array_push ( $ this -> data , $ data ) ; } } if ( is_object ( $ this -> errors ) ) { $ this -> errors = Objects :: attrToArray ( $ this -> errors ) ; } if ( is_string ( $ this -> errors ) || is_numeric ( $ this -> errors ) ) { $ err = $ this -> errors ; $ this -> errors = array ( ) ; $ this -> errors [ 0 ] = $ err ; } $ this -> errors = ! is_null ( $ errors ) ? array_merge ( $ this -> errors , $ errors ) : $ this -> errors ; }
|
Prepare an response
|
16,869
|
public function prepareSuccess ( $ message , $ data = [ ] , $ code = 200 ) { $ this -> prepareResult ( true , $ message , $ code , $ data , null ) ; }
|
Produces a failed response
|
16,870
|
public function prepareError ( $ message , $ errors = [ ] , $ code = 404 ) { $ this -> prepareResult ( false , $ message , $ code , null , $ errors ) ; }
|
Produces a successful response
|
16,871
|
public function message ( $ message = null ) { if ( is_null ( $ message ) ) { return $ this -> message ; } $ this -> message = $ message ; }
|
Get or Set message attribute
|
16,872
|
public function errors ( $ errors = null ) { if ( is_null ( $ errors ) ) { return $ this -> errors ; } $ this -> errors = $ errors ; }
|
Get or Set errors attribute
|
16,873
|
public static function fromXml ( \ DOMElement $ xml ) { $ static = new static ( ) ; $ static -> libraryItemMetadata = LibraryItemMetadata :: fromXml ( $ xml ) ; $ expenseId = $ xml -> getElementsByTagName ( 'id' ) ; $ static -> expenseId = StringLiteral :: fromXml ( $ expenseId ) ; $ date = $ xml -> getElementsByTagName ( 'date' ) ; $ static -> date = DateTime :: fromXml ( $ date ) ; $ amount = $ xml -> getElementsByTagName ( 'amount' ) ; $ static -> amount = FloatLiteral :: fromXml ( $ amount ) ; $ stringLiterals = array ( 'title' => $ xml -> getElementsByTagName ( 'title' ) , 'description' => $ xml -> getElementsByTagName ( 'description' ) , 'type' => $ xml -> getElementsByTagName ( 'type' ) , ) ; foreach ( $ stringLiterals as $ propertyName => $ xmlTag ) { $ static -> $ propertyName = StringLiteral :: fromXml ( $ xmlTag ) ; } return $ static ; }
|
Builds a Expense object from XML .
|
16,874
|
public static function add ( $ message = 'No message' , $ logCode = self :: LEVEL_INFO ) { if ( ! self :: $ _fileHandler ) { self :: _openLogFile ( ) ; } if ( ! empty ( $ _SERVER [ 'REMOTE_ADDR' ] ) ) { $ userIP = $ _SERVER [ 'REMOTE_ADDR' ] ; } else { $ userIP = '0.0.0.0' ; } $ time = date ( 'j/M/Y H:i:s' ) ; $ scriptName = pathinfo ( $ _SERVER [ 'PHP_SELF' ] , PATHINFO_BASENAME ) ; $ fwrite = fwrite ( self :: $ _fileHandler , "$userIP [$time][$logCode] ($scriptName) ) ; if ( $ fwrite === false ) { return false ; } else { return true ; } }
|
Write message to the log file
|
16,875
|
private static function _crateLogsFolder ( ) { if ( ! file_exists ( self :: LOGS_FOLDER_PATH ) ) { mkdir ( self :: LOGS_FOLDER_PATH , 0755 , true ) ; $ htaccessHandler = fopen ( self :: LOGS_FOLDER_PATH . '.htaccess' , 'w' ) ; fwrite ( $ htaccessHandler , 'deny from all' ) ; fclose ( $ htaccessHandler ) ; } }
|
Create LogsFolder if not exist This method will create a . htaccess to deny access to logfiles
|
16,876
|
public static function encode ( String $ str ) : String { return str_replace ( array_keys ( self :: $ phpTagChars ) , array_values ( self :: $ phpTagChars ) , $ str ) ; }
|
Encode PHP Tag
|
16,877
|
public static function decode ( String $ str ) : String { return str_replace ( array_values ( self :: $ phpTagChars ) , array_keys ( self :: $ phpTagChars ) , $ str ) ; }
|
Decode PHP Tag
|
16,878
|
public function getHtmlOrText ( ) { if ( $ template = $ this -> getTemplate ( ) ) { if ( ! isset ( $ this -> isHTML ) ) $ this -> setIsHTML ( true ) ; return $ template -> parse ( ) ; } else if ( $ body = $ this -> getBody ( ) ) { $ this -> setIsHTML ( true ) ; return $ body ; } else if ( $ text = $ this -> getText ( ) ) { $ this -> setIsHTML ( false ) ; return $ text ; } $ this -> setIsHTML ( false ) ; return 'No body set.' ; }
|
Return the html body or the text string and fill in the isHTML property
|
16,879
|
public function get ( $ name = null ) { if ( $ name !== null ) { return ( isset ( $ this -> addl [ $ name ] ) ) ? $ this -> addl [ $ name ] : null ; } else { return $ this -> addl ; } }
|
Get a value from the additional value set If the name value is given it tries to locate the value returns null if not found If no name is given returns all values
|
16,880
|
public function getMessage ( $ name = null ) { if ( $ name === null ) { return $ this -> message ; } return str_replace ( ':name' , $ name , $ this -> message ) ; }
|
Get the value of the message for the check
|
16,881
|
public function toArray ( $ flag = self :: EXTR_DATA ) { switch ( $ flag ) { case self :: EXTR_BOTH : return $ this -> items ; case self :: EXTR_PRIORITY : return array_map ( function ( $ item ) { return $ item [ 'priority' ] ; } , $ this -> items ) ; case self :: EXTR_DATA : default : return array_map ( function ( $ item ) { return $ item [ 'data' ] ; } , $ this -> items ) ; } }
|
Serialize to an array
|
16,882
|
public function compile ( ) { $ this -> rrmdir ( $ this -> config [ 'dir' ] [ 'site' ] ) ; $ this -> compilePosts ( ) ; $ this -> compilePages ( ) ; $ this -> compileCategories ( ) ; $ this -> compileAssets ( ) ; $ this -> compilePaginations ( ) ; $ this -> compileAuthors ( ) ; }
|
Main function to compile
|
16,883
|
public function compileCategories ( ) { foreach ( $ this -> site -> getCategories ( ) as $ category ) { $ template = $ this -> twig -> loadTemplate ( 'category.html.tpl' ) ; $ content = $ template -> render ( array ( 'site' => $ this -> site , 'category' => $ category ) ) ; $ this -> createFile ( $ content , $ category ) ; } }
|
Compile Site Categories
|
16,884
|
public function compileAuthors ( ) { foreach ( $ this -> site -> getAuthors ( ) as $ author ) { $ template = $ this -> twig -> loadTemplate ( 'author.html.tpl' ) ; $ content = $ template -> render ( array ( 'site' => $ this -> site , 'author' => $ author ) ) ; $ this -> createFile ( $ content , $ author ) ; } }
|
Compile authors page
|
16,885
|
static function Configshow ( PHP_ParserGenerator_Config $ cfp ) { $ fp = fopen ( 'php://output' , 'w' ) ; while ( $ cfp ) { if ( $ cfp -> dot == $ cfp -> rp -> nrhs ) { $ buf = sprintf ( '(%d)' , $ cfp -> rp -> index ) ; fprintf ( $ fp , ' %5s ' , $ buf ) ; } else { fwrite ( $ fp , ' ' ) ; } $ cfp -> ConfigPrint ( $ fp ) ; fwrite ( $ fp , "\n" ) ; if ( 0 ) { } $ cfp = $ cfp -> next ; } fwrite ( $ fp , "\n" ) ; fclose ( $ fp ) ; }
|
Display the current configuration for the . out file
|
16,886
|
static function Configlist_init ( ) { self :: $ current = 0 ; self :: $ currentend = & self :: $ current ; self :: $ basis = 0 ; self :: $ basisend = & self :: $ basis ; self :: $ x4a = array ( ) ; }
|
Initialize the configuration list builder for a new state .
|
16,887
|
static function Configtable_reset ( $ f ) { self :: $ current = 0 ; self :: $ currentend = & self :: $ current ; self :: $ basis = 0 ; self :: $ basisend = & self :: $ basis ; self :: Configtable_clear ( 0 ) ; }
|
Remove all data from the table .
|
16,888
|
static function Configtable_clear ( $ f ) { if ( ! count ( self :: $ x4a ) ) { return ; } if ( $ f ) { for ( $ i = 0 ; $ i < count ( self :: $ x4a ) ; $ i ++ ) { call_user_func ( $ f , self :: $ x4a [ $ i ] -> data ) ; } } self :: $ x4a = array ( ) ; }
|
Remove all data from the associative array representation of configurations .
|
16,889
|
static function Configlist_add ( $ rp , $ dot ) { $ model = new PHP_ParserGenerator_Config ; $ model -> rp = $ rp ; $ model -> dot = $ dot ; $ cfp = self :: Configtable_find ( $ model ) ; if ( $ cfp === 0 ) { $ cfp = self :: newconfig ( ) ; $ cfp -> rp = $ rp ; $ cfp -> dot = $ dot ; $ cfp -> fws = array ( ) ; $ cfp -> stp = 0 ; $ cfp -> fplp = $ cfp -> bplp = 0 ; $ cfp -> next = 0 ; $ cfp -> bp = 0 ; self :: $ currentend = $ cfp ; self :: $ currentend = & $ cfp -> next ; self :: Configtable_insert ( $ cfp ) ; } return $ cfp ; }
|
Add another configuration to the configuration list for this parser state .
|
16,890
|
static function Configlist_closure ( PHP_ParserGenerator_Data $ lemp ) { for ( $ cfp = self :: $ current ; $ cfp ; $ cfp = $ cfp -> next ) { $ rp = $ cfp -> rp ; $ dot = $ cfp -> dot ; if ( $ dot >= $ rp -> nrhs ) { continue ; } $ sp = $ rp -> rhs [ $ dot ] ; if ( $ sp -> type == PHP_ParserGenerator_Symbol :: NONTERMINAL ) { if ( $ sp -> rule === 0 && $ sp !== $ lemp -> errsym ) { PHP_ParserGenerator :: ErrorMsg ( $ lemp -> filename , $ rp -> line , "Nonterminal \"%s\" has no rules." , $ sp -> name ) ; $ lemp -> errorcnt ++ ; } for ( $ newrp = $ sp -> rule ; $ newrp ; $ newrp = $ newrp -> nextlhs ) { $ newcfp = self :: Configlist_add ( $ newrp , 0 ) ; for ( $ i = $ dot + 1 ; $ i < $ rp -> nrhs ; $ i ++ ) { $ xsp = $ rp -> rhs [ $ i ] ; if ( $ xsp -> type == PHP_ParserGenerator_Symbol :: TERMINAL ) { $ newcfp -> fws [ $ xsp -> index ] = 1 ; break ; } elseif ( $ xsp -> type == PHP_ParserGenerator_Symbol :: MULTITERMINAL ) { for ( $ k = 0 ; $ k < $ xsp -> nsubsym ; $ k ++ ) { $ newcfp -> fws [ $ xsp -> subsym [ $ k ] -> index ] = 1 ; } break ; } else { $ a = array_diff_key ( $ xsp -> firstset , $ newcfp -> fws ) ; $ newcfp -> fws += $ a ; if ( $ xsp -> lambda === false ) { break ; } } } if ( $ i == $ rp -> nrhs ) { PHP_ParserGenerator_PropagationLink :: Plink_add ( $ cfp -> fplp , $ newcfp ) ; } } } } }
|
Compute the closure of the configuration list .
|
16,891
|
static function Configlist_return ( ) { $ old = self :: $ current ; self :: $ current = 0 ; self :: $ currentend = & self :: $ current ; return $ old ; }
|
Return a pointer to the head of the configuration list and reset the list
|
16,892
|
static function Configlist_basis ( ) { $ old = self :: $ basis ; self :: $ basis = 0 ; self :: $ basisend = & self :: $ basis ; return $ old ; }
|
Return a pointer to the head of the basis list and reset the list
|
16,893
|
static function Configlist_eat ( $ cfp ) { for ( ; $ cfp ; $ cfp = $ nextcfp ) { $ nextcfp = $ cfp -> next ; if ( $ cfp -> fplp != 0 ) { throw new Exception ( 'fplp of configuration non-zero?' ) ; } if ( $ cfp -> bplp != 0 ) { throw new Exception ( 'bplp of configuration non-zero?' ) ; } if ( $ cfp -> fws ) { $ cfp -> fws = array ( ) ; } } }
|
Free all elements of the given configuration list
|
16,894
|
static function Configcmp ( $ a , $ b ) { $ x = $ a -> rp -> index - $ b -> rp -> index ; if ( ! $ x ) { $ x = $ a -> dot - $ b -> dot ; } return $ x ; }
|
Compare two configurations for sorting purposes .
|
16,895
|
function ConfigPrint ( $ fp ) { $ rp = $ this -> rp ; fprintf ( $ fp , "%s ::=" , $ rp -> lhs -> name ) ; for ( $ i = 0 ; $ i <= $ rp -> nrhs ; $ i ++ ) { if ( $ i === $ this -> dot ) { fwrite ( $ fp , ' *' ) ; } if ( $ i === $ rp -> nrhs ) { break ; } $ sp = $ rp -> rhs [ $ i ] ; fprintf ( $ fp , ' %s' , $ sp -> name ) ; if ( $ sp -> type == PHP_ParserGenerator_Symbol :: MULTITERMINAL ) { for ( $ j = 1 ; $ j < $ sp -> nsubsym ; $ j ++ ) { fprintf ( $ fp , '|%s' , $ sp -> subsym [ $ j ] -> name ) ; } } } }
|
Print out information on this configuration .
|
16,896
|
public static function tryingToProduceFor ( MapsProperty $ mapping , Throwable $ exception ) : Throwable { return new self ( sprintf ( 'Proxy production for in the `%s` property failed: %s' , $ mapping -> name ( ) , $ exception -> getMessage ( ) ) , 0 , $ exception ) ; }
|
Notifies the client code when an item could not be hydrated .
|
16,897
|
public function validate ( ) { if ( empty ( $ this -> _validators ) ) { $ this -> _valid = true ; return true ; } $ valid = false ; $ newValue = null ; foreach ( $ this -> _validators as $ validator ) { try { $ newGeneratedValue = $ validator -> valideteValue ( $ this -> getVal ( ) ) ; if ( ! $ valid ) $ newValue = $ newGeneratedValue ; $ valid = true ; } catch ( \ OWeb \ types \ UserException $ ex ) { $ valid = $ valid || false ; $ this -> _errMessages [ ] = $ ex -> getMessage ( ) ; $ this -> _errDesriptions [ ] = $ ex -> getUserDescription ( ) ; } } if ( $ valid ) $ this -> _trueVal = $ newValue ; else $ this -> _trueVal = null ; $ this -> _valid = $ valid ; return $ valid ; }
|
Will start the validation procees .
|
16,898
|
public function firstOrMake ( $ filter = [ ] , $ additionalData = [ ] , $ write = true ) { if ( ! ( $ record = $ this -> owner -> get ( ) -> filter ( $ filter ) -> first ( ) ) ) { $ record = $ this -> owner -> create ( array_merge ( $ filter , $ additionalData ) ) ; if ( $ write ) { $ record -> write ( ) ; $ record -> isNew = true ; } } return $ record ; }
|
Find a record using a filter or create it if it doesn t exist
|
16,899
|
public function firstOrCreate ( $ filter = [ ] , $ additionalData = [ ] , $ write = true ) { return $ this -> owner -> firstOrMake ( $ filter , $ additionalData , $ write ) ; }
|
Alias of - > firstOrMake
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.