fixed instance creation callchain

master
Theunis J. Botha 2021-09-22 08:31:29 +02:00
parent 2deca7016f
commit 0c5701aa1c
138 changed files with 13727 additions and 1092 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
API_URL=http://api.r3js.local

5
composer.json Normal file
View File

@ -0,0 +1,5 @@
{
"require": {
"vlucas/phpdotenv": "^5.3"
}
}

471
composer.lock generated Normal file
View File

@ -0,0 +1,471 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bf847504a73df8dd6d6da7ea3afbd8b0",
"packages": [
{
"name": "graham-campbell/result-type",
"version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/GrahamCampbell/Result-Type.git",
"reference": "84afea85c6841deeea872f36249a206e878a5de0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/84afea85c6841deeea872f36249a206e878a5de0",
"reference": "84afea85c6841deeea872f36249a206e878a5de0",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"phpoption/phpoption": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8"
},
"type": "library",
"autoload": {
"psr-4": {
"GrahamCampbell\\ResultType\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk"
}
],
"description": "An Implementation Of The Result Type",
"keywords": [
"Graham Campbell",
"GrahamCampbell",
"Result Type",
"Result-Type",
"result"
],
"support": {
"issues": "https://github.com/GrahamCampbell/Result-Type/issues",
"source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.2"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type",
"type": "tidelift"
}
],
"time": "2021-08-28T21:34:50+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.8.0",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/php-option.git",
"reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/5455cb38aed4523f99977c4a12ef19da4bfe2a28",
"reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^6.5.14 || ^7.0.20 || ^8.5.19 || ^9.5.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"autoload": {
"psr-4": {
"PhpOption\\": "src/PhpOption/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com"
},
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk"
}
],
"description": "Option Type for PHP",
"keywords": [
"language",
"option",
"php",
"type"
],
"support": {
"issues": "https://github.com/schmittjoh/php-option/issues",
"source": "https://github.com/schmittjoh/php-option/tree/1.8.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption",
"type": "tidelift"
}
],
"time": "2021-08-28T21:27:29+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-02-19T12:13:01+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.23.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-05-27T12:26:48+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.23.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be",
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-07-28T13:41:28+00:00"
},
{
"name": "vlucas/phpdotenv",
"version": "v5.3.0",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "b3eac5c7ac896e52deab4a99068e3f4ab12d9e56"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/b3eac5c7ac896e52deab4a99068e3f4ab12d9e56",
"reference": "b3eac5c7ac896e52deab4a99068e3f4ab12d9e56",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"graham-campbell/result-type": "^1.0.1",
"php": "^7.1.3 || ^8.0",
"phpoption/phpoption": "^1.7.4",
"symfony/polyfill-ctype": "^1.17",
"symfony/polyfill-mbstring": "^1.17",
"symfony/polyfill-php80": "^1.17"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"ext-filter": "*",
"phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5.1"
},
"suggest": {
"ext-filter": "Required to use the boolean validator."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Dotenv\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Graham Campbell",
"email": "graham@alt-three.com",
"homepage": "https://gjcampbell.co.uk/"
},
{
"name": "Vance Lucas",
"email": "vance@vancelucas.com",
"homepage": "https://vancelucas.com/"
}
],
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
"keywords": [
"dotenv",
"env",
"environment"
],
"support": {
"issues": "https://github.com/vlucas/phpdotenv/issues",
"source": "https://github.com/vlucas/phpdotenv/tree/v5.3.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
"type": "tidelift"
}
],
"time": "2021-01-20T15:23:13+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.0.0"
}

6
dist/index.html vendored
View File

@ -4,6 +4,12 @@
<title>Getting Started</title>
</head>
<body>
<style>
body {
background-color: #0f0f0f;
color:#00bb00;
}
</style>
<div id="log">
</div>
<script>

1334
dist/r3.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "r3",
"version" : "2.0.790",
"version" : "2.0.851",
"description": "",
"private": true,
"dependencies": {

59
r3.php
View File

@ -1,11 +1,18 @@
#!/usr/bin/php
<?php
include "vendor/autoload.php";
$dotenv = Dotenv\Dotenv::createImmutable($_SERVER['PWD']);
$dotenv->load();
include "utils.php";
include "graph.php";
global $files;
$baseExtends = 'base';
function getTokens($types)
{
@ -449,6 +456,8 @@ function generateConstructors($file, $command)
{
// echo $file;
global $baseExtends;
$constructor = null;
$token = 'GENERATED_CONSTRUCTOR';
@ -458,6 +467,7 @@ function generateConstructors($file, $command)
if (preg_match('/\bsystem_extends\b/', $command)) {
$constructor = file_get_contents('src/templates/system_extends_constructor.template');
$baseExtends = 'extends';
}
if (preg_match('/\bruntime_base\b/', $command)) {
@ -466,6 +476,7 @@ function generateConstructors($file, $command)
if (preg_match('/\bruntime_extends\b/', $command)) {
$constructor = file_get_contents('src/templates/runtime_extends_constructor.template');
$baseExtends = 'extends';
}
if (preg_match('/\bcomponent_base\b/', $command)) {
@ -474,6 +485,7 @@ function generateConstructors($file, $command)
if (preg_match('/\bcomponent_extends\b/', $command)) {
$constructor = file_get_contents('src/templates/component_extends_constructor.template');
$baseExtends = 'extends';
}
if (preg_match('/\bentity_base\b/', $command)) {
@ -482,6 +494,7 @@ function generateConstructors($file, $command)
if (preg_match('/\bentity_extends\b/', $command)) {
$constructor = file_get_contents('src/templates/entity_extends_constructor.template');
$baseExtends = 'extends';
}
if (preg_match('/\bbase\b/', $command)) {
@ -490,6 +503,7 @@ function generateConstructors($file, $command)
if (preg_match('/\bextends\b/', $command)) {
$constructor = file_get_contents('src/templates/extends_constructor.template');
$baseExtends = 'extends';
}
if (!$constructor) {
@ -933,6 +947,8 @@ function getMethodDetails($item)
*/
function doMethodUpdate($template, $tokens, $token)
{
global $baseExtends;
$store = getTokenStore($token, $tokens);
if (sizeof($store) <= 0) {
@ -980,9 +996,46 @@ function doMethodUpdate($template, $tokens, $token)
if (file_exists($potentialTemplate)) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*FUNCTION_TEMPLATE/m', $functionTemplate, $updated);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE\b/m', $functionTemplate, $updated);
} else {
$updated = preg_replace('/^.*?FUNCTION_TEMPLATE.*\n/m', '', $updated);
if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') {
$potentialTemplate = strtolower('src/templates/' . $baseExtends . '_' . $methodTokenName . '.template');
} else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') {
$potentialTemplate = strtolower('src/templates/static_' . $baseExtends . '_' . $methodTokenName . '.template');
}
if (file_exists($potentialTemplate)) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE\b/m', $functionTemplate, $updated);
} else {
$updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE\b.*\n/m', '', $updated);
}
}
if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') {
$potentialTemplate = strtolower('src/templates/' . $methodTokenName . '_after.template');
} else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') {
$potentialTemplate = strtolower('src/templates/static_' . $methodTokenName . '_after.template');
}
if (file_exists($potentialTemplate)) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE_AFTER\b/m', $functionTemplate, $updated);
} else {
if ($token === 'CUSTOM_METHODS' || $token === 'TEMPLATE_METHODS') {
$potentialTemplate = strtolower('src/templates/' . $baseExtends . '_' . $methodTokenName . '_after.template');
} else if ($token === 'CUSTOM_STATIC_METHODS' || $token === 'TEMPLATE_STATIC_METHODS') {
$potentialTemplate = strtolower('src/templates/static_' . $baseExtends . '_' . $methodTokenName . '_after.template');
}
if (file_exists($potentialTemplate)) {
$functionTemplate = file_get_contents($potentialTemplate);
$updated = preg_replace('/^\s*\bFUNCTION_TEMPLATE_AFTER\b/m', $functionTemplate, $updated);
} else {
$updated = preg_replace('/^.*?\bFUNCTION_TEMPLATE_AFTER\b.*\n/m', '', $updated);
}
}
$updated = str_replace('METHOD_ARGS', $args, $updated);
@ -1574,6 +1627,8 @@ function generateR3Dist($nodes)
$contents = preg_replace('/\n\n\n+/sm', "\n\n", $contents);
$contents = str_replace('__API_URL__', $_ENV['API_URL'], $contents);
file_put_contents($r3jsFile, $contents);
}

View File

@ -47,10 +47,11 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -96,9 +96,7 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
Inherited Methods:
- initialize()
In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
Event.DOM_COMPONENT_INITIALIZED
<no inherited methods>
Inherited Static Methods:
@ -111,7 +109,7 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
- type (Default value 'canvas')
- width (Default value 500 - The initial width of the canvas (You can override it with CSS))
- height (Default value 500 - The initial height of the canvas (You can override it with CSS))
- style (Default value 'border:1px solid #000000;')
- style (Default value 'border:1px solid #00bb00;')
Static Properties:
@ -128,15 +126,17 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
type='canvas'
width=500 - The initial width of the canvas (You can override it with CSS)
height=500 - The initial height of the canvas (You can override it with CSS)
style='border:1px solid #000000;'
style='border:1px solid #00bb00;'
CUSTOM_OPTIONS_END
TEMPLATE_STATIC_OPTIONS_START
@ -152,8 +152,9 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -161,6 +162,7 @@ const ComponentDOM = require('.././r3-component-d-o-m.js');
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END
@ -185,8 +187,8 @@ class ComponentCanvas extends ComponentDOM {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -195,14 +197,14 @@ class ComponentCanvas extends ComponentDOM {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* parent - The parent R3.Object of this component
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -210,8 +212,22 @@ class ComponentCanvas extends ComponentDOM {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
/**
* type - No comment
@ -235,7 +251,7 @@ class ComponentCanvas extends ComponentDOM {
* style - No comment
*/
if (typeof options.style === 'undefined') {
options.style = 'border:1px solid #000000;';
options.style = 'border:1px solid #00bb00;';
}
//GENERATED_OPTIONS_INIT_END
@ -260,6 +276,29 @@ class ComponentCanvas extends ComponentDOM {
//GENERATED_TEMPLATE_METHODS_START
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
* updateInstance()
* - Updates this object by copying the values of the current object into it's instance object.
@ -316,6 +355,20 @@ class ComponentCanvas extends ComponentDOM {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -324,6 +377,9 @@ class ComponentCanvas extends ComponentDOM {
//CUSTOM_UPDATE_INSTANCE_METHOD_START
//CUSTOM_UPDATE_INSTANCE_METHOD_END
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -382,6 +438,20 @@ class ComponentCanvas extends ComponentDOM {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
@ -391,6 +461,9 @@ class ComponentCanvas extends ComponentDOM {
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -47,10 +47,11 @@ const Component = require('.././r3-component.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const Component = require('.././r3-component.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -96,9 +96,7 @@ const Component = require('.././r3-component.js');
Methods:
- initialize()
In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
Event.DOM_COMPONENT_INITIALIZED
<no methods>
Static Methods:
@ -107,8 +105,10 @@ const Component = require('.././r3-component.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -128,20 +128,21 @@ const Component = require('.././r3-component.js');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END
CUSTOM_METHODS_START
initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an Event.DOM_COMPONENT_INITIALIZED
CUSTOM_METHODS_END
TEMPLATE_STATIC_METHODS_START
@ -161,8 +162,8 @@ class ComponentDOM extends Component {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -171,14 +172,14 @@ class ComponentDOM extends Component {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* parent - The parent R3.Object of this component
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -186,8 +187,22 @@ class ComponentDOM extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -218,6 +233,30 @@ class ComponentDOM extends Component {
//GENERATED_TEMPLATE_METHODS_START
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this);
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
* updateInstance()
* - Updates this object by copying the values of the current object into it's instance object.
@ -246,6 +285,20 @@ class ComponentDOM extends Component {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -254,6 +307,9 @@ class ComponentDOM extends Component {
//CUSTOM_UPDATE_INSTANCE_METHOD_START
//CUSTOM_UPDATE_INSTANCE_METHOD_END
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -284,6 +340,20 @@ class ComponentDOM extends Component {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
@ -293,46 +363,13 @@ class ComponentDOM extends Component {
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END
//GENERATED_METHODS_START
/**
* initialize()
* - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
* Event.DOM_COMPONENT_INITIALIZED
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
try {
super.initialize();
} catch (err) {
if (!(err instanceof TypeError)) {
//Another unexpected error occurred - and we are not inside a base class
throw err;
}
delete this.callDepth;
this.initialized = true;
//CUSTOM_BEFORE_CREATE_INSTANCE_START
Event.Emit(Event.DOM_COMPONENT_INITIALIZED, this);
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
}
//GENERATED_METHODS_END
//GENERATED_TEMPLATE_STATIC_METHODS_START

View File

@ -47,10 +47,11 @@ const Component = require('.././r3-component.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const Component = require('.././r3-component.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -95,9 +95,7 @@ const Component = require('.././r3-component.js');
Methods:
- initialize()
In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
Event.GRAPHICS_COMPONENT_INITIALIZED
<no methods>
Static Methods:
@ -106,8 +104,10 @@ const Component = require('.././r3-component.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -126,20 +126,21 @@ const Component = require('.././r3-component.js');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END
CUSTOM_METHODS_START
initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an Event.GRAPHICS_COMPONENT_INITIALIZED
CUSTOM_METHODS_END
TEMPLATE_STATIC_METHODS_START
@ -159,8 +160,8 @@ class ComponentGraphics extends Component {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -169,14 +170,14 @@ class ComponentGraphics extends Component {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* parent - The parent R3.Object of this component
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -184,8 +185,22 @@ class ComponentGraphics extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -210,6 +225,30 @@ class ComponentGraphics extends Component {
//GENERATED_TEMPLATE_METHODS_START
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this);
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
* updateInstance()
* - Updates this object by copying the values of the current object into it's instance object.
@ -224,6 +263,20 @@ class ComponentGraphics extends Component {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -232,6 +285,9 @@ class ComponentGraphics extends Component {
//CUSTOM_UPDATE_INSTANCE_METHOD_START
//CUSTOM_UPDATE_INSTANCE_METHOD_END
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -248,6 +304,20 @@ class ComponentGraphics extends Component {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
@ -257,46 +327,13 @@ class ComponentGraphics extends Component {
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END
//GENERATED_METHODS_START
/**
* initialize()
* - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
* Event.GRAPHICS_COMPONENT_INITIALIZED
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
try {
super.initialize();
} catch (err) {
if (!(err instanceof TypeError)) {
//Another unexpected error occurred - and we are not inside a base class
throw err;
}
delete this.callDepth;
this.initialized = true;
//CUSTOM_BEFORE_CREATE_INSTANCE_START
Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this);
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
}
//GENERATED_METHODS_END
//GENERATED_TEMPLATE_STATIC_METHODS_START

View File

@ -47,10 +47,11 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -95,9 +95,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Methods:
- initialize()
In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
Event.GRAPHICS_COMPONENT_INITIALIZED
<no inherited methods>
Inherited Static Methods:
@ -131,8 +129,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Methods:
- initialize()
Also raises Event.IMAGE_INITIALIZED
<no methods>
Static Methods:
@ -141,8 +138,10 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -172,8 +171,9 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
@ -184,12 +184,12 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END
CUSTOM_METHODS_START
initialize() - Also raises Event.IMAGE_INITIALIZED
CUSTOM_METHODS_END
TEMPLATE_STATIC_METHODS_START
@ -209,8 +209,8 @@ class ComponentImage extends ComponentGraphics {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -219,14 +219,14 @@ class ComponentImage extends ComponentGraphics {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* parent - The parent R3.Object of this component
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -234,8 +234,22 @@ class ComponentImage extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
/**
* src - The src attribute of this image, defaults to a 15% opaque 1x1 green pixel
@ -352,6 +366,30 @@ class ComponentImage extends ComponentGraphics {
//GENERATED_TEMPLATE_METHODS_START
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this);
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
* updateInstance()
* - Updates this object by copying the values of the current object into it's instance object.
@ -478,6 +516,20 @@ class ComponentImage extends ComponentGraphics {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -486,6 +538,9 @@ class ComponentImage extends ComponentGraphics {
//CUSTOM_UPDATE_INSTANCE_METHOD_START
//CUSTOM_UPDATE_INSTANCE_METHOD_END
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -614,6 +669,20 @@ class ComponentImage extends ComponentGraphics {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
@ -623,46 +692,13 @@ class ComponentImage extends ComponentGraphics {
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END
//GENERATED_METHODS_START
/**
* initialize()
* - Also raises Event.IMAGE_INITIALIZED
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
try {
super.initialize();
} catch (err) {
if (!(err instanceof TypeError)) {
//Another unexpected error occurred - and we are not inside a base class
throw err;
}
delete this.callDepth;
this.initialized = true;
//CUSTOM_BEFORE_CREATE_INSTANCE_START
Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this);
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
Event.Emit(Event.IMAGE_INSTANCE_CREATED, this);
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
}
//GENERATED_METHODS_END
//GENERATED_TEMPLATE_STATIC_METHODS_START

View File

@ -47,10 +47,11 @@ const Component = require('.././r3-component.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const Component = require('.././r3-component.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -95,9 +95,7 @@ const Component = require('.././r3-component.js');
Methods:
- initialize()
In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
Event.INPUT_COMPONENT_INITIALIZED
<no methods>
Static Methods:
@ -106,8 +104,10 @@ const Component = require('.././r3-component.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -126,20 +126,21 @@ const Component = require('.././r3-component.js');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END
CUSTOM_METHODS_START
initialize() - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an Event.INPUT_COMPONENT_INITIALIZED
CUSTOM_METHODS_END
TEMPLATE_STATIC_METHODS_START
@ -159,8 +160,8 @@ class ComponentInput extends Component {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -169,14 +170,14 @@ class ComponentInput extends Component {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* parent - The parent R3.Object of this component
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -184,8 +185,22 @@ class ComponentInput extends Component {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -210,6 +225,30 @@ class ComponentInput extends Component {
//GENERATED_TEMPLATE_METHODS_START
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this);
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
* updateInstance()
* - Updates this object by copying the values of the current object into it's instance object.
@ -224,6 +263,20 @@ class ComponentInput extends Component {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -232,6 +285,9 @@ class ComponentInput extends Component {
//CUSTOM_UPDATE_INSTANCE_METHOD_START
//CUSTOM_UPDATE_INSTANCE_METHOD_END
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -248,6 +304,20 @@ class ComponentInput extends Component {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
@ -257,46 +327,13 @@ class ComponentInput extends Component {
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END
//GENERATED_METHODS_START
/**
* initialize()
* - In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
* Event.INPUT_COMPONENT_INITIALIZED
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
try {
super.initialize();
} catch (err) {
if (!(err instanceof TypeError)) {
//Another unexpected error occurred - and we are not inside a base class
throw err;
}
delete this.callDepth;
this.initialized = true;
//CUSTOM_BEFORE_CREATE_INSTANCE_START
Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this);
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
}
//GENERATED_METHODS_END
//GENERATED_TEMPLATE_STATIC_METHODS_START

View File

@ -47,10 +47,11 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -95,9 +95,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Methods:
- initialize()
In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
Event.GRAPHICS_COMPONENT_INITIALIZED
<no inherited methods>
Inherited Static Methods:
@ -124,8 +122,10 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -144,14 +144,16 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END
@ -176,8 +178,8 @@ class ComponentMaterial extends ComponentGraphics {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -186,14 +188,14 @@ class ComponentMaterial extends ComponentGraphics {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* parent - The parent R3.Object of this component
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -201,8 +203,22 @@ class ComponentMaterial extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -227,6 +243,29 @@ class ComponentMaterial extends ComponentGraphics {
//GENERATED_TEMPLATE_METHODS_START
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
* updateInstance()
* - Updates this object by copying the values of the current object into it's instance object.
@ -241,6 +280,20 @@ class ComponentMaterial extends ComponentGraphics {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -249,6 +302,9 @@ class ComponentMaterial extends ComponentGraphics {
//CUSTOM_UPDATE_INSTANCE_METHOD_START
//CUSTOM_UPDATE_INSTANCE_METHOD_END
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -265,6 +321,20 @@ class ComponentMaterial extends ComponentGraphics {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
@ -274,6 +344,9 @@ class ComponentMaterial extends ComponentGraphics {
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -47,10 +47,11 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -95,9 +95,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Methods:
- initialize()
In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
Event.GRAPHICS_COMPONENT_INITIALIZED
<no inherited methods>
Inherited Static Methods:
@ -124,8 +122,10 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -144,14 +144,16 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END
@ -176,8 +178,8 @@ class ComponentMesh extends ComponentGraphics {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -186,14 +188,14 @@ class ComponentMesh extends ComponentGraphics {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* parent - The parent R3.Object of this component
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -201,8 +203,22 @@ class ComponentMesh extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -227,6 +243,29 @@ class ComponentMesh extends ComponentGraphics {
//GENERATED_TEMPLATE_METHODS_START
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
* updateInstance()
* - Updates this object by copying the values of the current object into it's instance object.
@ -241,6 +280,20 @@ class ComponentMesh extends ComponentGraphics {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -249,6 +302,9 @@ class ComponentMesh extends ComponentGraphics {
//CUSTOM_UPDATE_INSTANCE_METHOD_START
//CUSTOM_UPDATE_INSTANCE_METHOD_END
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -265,6 +321,20 @@ class ComponentMesh extends ComponentGraphics {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
@ -274,6 +344,9 @@ class ComponentMesh extends ComponentGraphics {
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -47,10 +47,11 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -95,9 +95,7 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
Inherited Methods:
- initialize()
In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
Event.GRAPHICS_COMPONENT_INITIALIZED
<no inherited methods>
Inherited Static Methods:
@ -124,8 +122,10 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -144,14 +144,16 @@ const ComponentGraphics = require('.././r3-component-graphics.js');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END
@ -176,8 +178,8 @@ class ComponentTexture extends ComponentGraphics {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -186,14 +188,14 @@ class ComponentTexture extends ComponentGraphics {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* parent - The parent R3.Object of this component
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -201,8 +203,22 @@ class ComponentTexture extends ComponentGraphics {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -227,6 +243,29 @@ class ComponentTexture extends ComponentGraphics {
//GENERATED_TEMPLATE_METHODS_START
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
* updateInstance()
* - Updates this object by copying the values of the current object into it's instance object.
@ -241,6 +280,20 @@ class ComponentTexture extends ComponentGraphics {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -249,6 +302,9 @@ class ComponentTexture extends ComponentGraphics {
//CUSTOM_UPDATE_INSTANCE_METHOD_START
//CUSTOM_UPDATE_INSTANCE_METHOD_END
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -265,6 +321,20 @@ class ComponentTexture extends ComponentGraphics {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
@ -274,6 +344,9 @@ class ComponentTexture extends ComponentGraphics {
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -47,10 +47,11 @@ const ComponentInput = require('.././r3-component-input.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const ComponentInput = require('.././r3-component-input.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -95,9 +95,7 @@ const ComponentInput = require('.././r3-component-input.js');
Inherited Methods:
- initialize()
In addition to firing an Event.OBJECT_INITIALIZED and Event.COMPONENT_INITIALIZED, it also fires an
Event.INPUT_COMPONENT_INITIALIZED
<no inherited methods>
Inherited Static Methods:
@ -124,8 +122,10 @@ const ComponentInput = require('.././r3-component-input.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -144,14 +144,16 @@ const ComponentInput = require('.././r3-component-input.js');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END
@ -176,8 +178,8 @@ class ComponentTouch extends ComponentInput {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -186,14 +188,14 @@ class ComponentTouch extends ComponentInput {
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* parent - The parent R3.Object of this component
* initialized - A boolean which indicates whether or not this component has initialized
*/
if (typeof options.parent === 'undefined') {
options.parent = null;
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
/**
* instance - Holds the current instance of this object as determined (built) by the runtime object.
@ -201,8 +203,22 @@ class ComponentTouch extends ComponentInput {
if (typeof options.instance === 'undefined') {
options.instance = null;
}
/**
* maxDepth - Indicates the maximum call depth of this component
*/
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = options.callDepth;
}
/**
* initializeDepth - The amount of times this component passed through initialize() functions
*/
if (typeof options.initializeDepth === 'undefined') {
options.initializeDepth = 0;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END
@ -227,6 +243,29 @@ class ComponentTouch extends ComponentInput {
//GENERATED_TEMPLATE_METHODS_START
/**
* initialize()
* - Notifies all systems listening that this component initialized.
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
* updateInstance()
* - Updates this object by copying the values of the current object into it's instance object.
@ -241,6 +280,20 @@ class ComponentTouch extends ComponentInput {
//GENERATED_UPDATE_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START
if (property === 'maxDepth') {
this.instance.maxDepth = this.maxDepth;
this.emit(
Event.UPDATE_INSTANCE_PROPERTY,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_INSTANCE_AFTER, this);
@ -249,6 +302,9 @@ class ComponentTouch extends ComponentInput {
//CUSTOM_UPDATE_INSTANCE_METHOD_START
//CUSTOM_UPDATE_INSTANCE_METHOD_END
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -265,6 +321,20 @@ class ComponentTouch extends ComponentInput {
//GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START
if (property === 'maxDepth' || property === 'all') {
this.maxDepth = this.instance.maxDepth;
this.emit(
Event.UPDATE_PROPERTY_FROM_INSTANCE,
{
component : this,
property : 'maxDepth',
instanceProperty : 'maxDepth'
}
);
if (property !== 'all') {
return;
}
}
//GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END
this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this);
@ -274,6 +344,9 @@ class ComponentTouch extends ComponentInput {
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START
//CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START
//GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -47,10 +47,11 @@ const R3Object = require('.././r3-r3-object.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const R3Object = require('.././r3-r3-object.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -86,7 +86,6 @@ const R3Object = require('.././r3-r3-object.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
register=true
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -122,8 +121,10 @@ class Component extends R3Object {
//GENERATED_CONSTRUCTOR_START
constructor(options) {
if (typeof options === 'undefined') {
options = {};
super(options);
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -132,17 +133,9 @@ class Component extends R3Object {
options.callDepth++;
}
super(options);
this.emit(Event.COMPONENT_CREATED, this);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
/**
* register - No comment
*/
if (typeof options.register === 'undefined') {
options.register = true;
}
//GENERATED_TEMPLATE_OPTIONS_INIT_END
//GENERATED_OPTIONS_INIT_START
@ -153,6 +146,8 @@ class Component extends R3Object {
Object.assign(this, options);
this.emit(Event.COMPONENT_CREATED, this);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
@ -176,32 +171,21 @@ class Component extends R3Object {
initialize() {
//GENERATED_INITIALIZE_METHOD_START
try {
super.initialize();
} catch (err) {
if (!(err instanceof TypeError)) {
//Another unexpected error occurred - and we are not inside a base class
throw err;
}
delete this.callDepth;
this.initialized = true;
//CUSTOM_BEFORE_CREATE_INSTANCE_START
Event.Emit(Event.COMPONENT_INITIALIZED, this);
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
this.initialized = true;
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
Event.Emit(Event.COMPONENT_INITIALIZED, this);
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
/**
@ -240,6 +224,9 @@ class Component extends R3Object {
//CUSTOM_CREATE_INSTANCE_METHOD_START
//CUSTOM_CREATE_INSTANCE_METHOD_END
//GENERATED_CREATE_INSTANCE_METHOD_AFTER_START
//GENERATED_CREATE_INSTANCE_METHOD_AFTER_END
}
/**
@ -264,6 +251,9 @@ class Component extends R3Object {
//CUSTOM_DISPOSE_METHOD_START
//CUSTOM_DISPOSE_METHOD_END
//GENERATED_DISPOSE_METHOD_AFTER_START
//GENERATED_DISPOSE_METHOD_AFTER_END
}
/**
@ -280,6 +270,9 @@ class Component extends R3Object {
//CUSTOM_DISPOSE_INSTANCE_METHOD_START
//CUSTOM_DISPOSE_INSTANCE_METHOD_END
//GENERATED_DISPOSE_INSTANCE_METHOD_AFTER_START
//GENERATED_DISPOSE_INSTANCE_METHOD_AFTER_END
}
/**
@ -302,6 +295,9 @@ class Component extends R3Object {
//CUSTOM_SET_RUNTIME_METHOD_START
//CUSTOM_SET_RUNTIME_METHOD_END
//GENERATED_SET_RUNTIME_METHOD_AFTER_START
//GENERATED_SET_RUNTIME_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -47,10 +47,11 @@ const Entity = require('.././r3-entity.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const Entity = require('.././r3-entity.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:

View File

@ -47,10 +47,11 @@ const R3Object = require('.././r3-r3-object.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const R3Object = require('.././r3-r3-object.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -165,26 +165,7 @@ class Entity extends R3Object {
initialize() {
//GENERATED_INITIALIZE_METHOD_START
try {
super.initialize();
} catch (err) {
if (!(err instanceof TypeError)) {
//Another unexpected error occurred - and we are not inside a base class
throw err;
}
delete this.callDepth;
this.initialized = true;
//CUSTOM_BEFORE_CREATE_INSTANCE_START
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
this.initialized = true;
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
@ -192,6 +173,14 @@ class Entity extends R3Object {
Event.Emit(Event.ENTITY_INITIALIZED, this);
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -98,6 +98,9 @@ class Event {
);
//CUSTOM_ASYNC_METHOD_END
//GENERATED_ASYNC_METHOD_AFTER_START
//GENERATED_ASYNC_METHOD_AFTER_END
}
/**
@ -127,6 +130,9 @@ class Event {
);
//CUSTOM_EMIT_METHOD_END
//GENERATED_EMIT_METHOD_AFTER_START
//GENERATED_EMIT_METHOD_AFTER_END
}
/**
@ -147,6 +153,9 @@ class Event {
return Event.Subscribe(eventId, callback.bind(this));
//CUSTOM_SUBSCRIBE_METHOD_END
//GENERATED_SUBSCRIBE_METHOD_AFTER_START
//GENERATED_SUBSCRIBE_METHOD_AFTER_END
}
//GENERATED_METHODS_END
@ -336,89 +345,91 @@ class Event {
//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START
//GENERATED_EVENTS_START
Event.COMPONENT_CREATED = 0x1;
Event.COMPONENT_INITIALIZED = 0x2;
Event.CREATE_INSTANCE_BEFORE = 0x3;
Event.DISPOSE_INSTANCE = 0x4;
Event.DISPOSE_OBJECT = 0x5;
Event.DOM_COMPONENT_INITIALIZED = 0x6;
Event.ENTITY_CREATED = 0x7;
Event.ENTITY_INITIALIZED = 0x8;
Event.GET_RUNTIME = 0x9;
Event.GET_WINDOW_SIZE = 0xa;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xb;
Event.IMAGE_COMPONENT_INITIALIZED = 0xc;
Event.IMAGE_INITIALIZED = 0xd;
Event.IMAGE_INSTANCE_CREATED = 0xe;
Event.INPUT_COMPONENT_INITIALIZED = 0xf;
Event.INSTANCE_CREATED = 0x10;
Event.INSTANCE_DISPOSED = 0x11;
Event.KEYBOARD_DOWN = 0x12;
Event.KEYBOARD_UP = 0x13;
Event.MOUSE_DOWN = 0x14;
Event.MOUSE_MOVE = 0x15;
Event.MOUSE_UP = 0x16;
Event.MOUSE_WHEEL = 0x17;
Event.OBJECT_CREATED = 0x18;
Event.OBJECT_INITIALIZED = 0x19;
Event.PAUSE = 0x1a;
Event.PROJECT_INITIALIZED = 0x1b;
Event.RESTART = 0x1c;
Event.START = 0x1d;
Event.TOUCH_CANCEL = 0x1e;
Event.TOUCH_END = 0x1f;
Event.TOUCH_MOVE = 0x20;
Event.TOUCH_START = 0x21;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x22;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x23;
Event.UPDATE_INSTANCE_AFTER = 0x24;
Event.UPDATE_INSTANCE_BEFORE = 0x25;
Event.UPDATE_INSTANCE_PROPERTY = 0x26;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x27;
Event.MAX_EVENTS = 0x28;
Event.BLACKLISTED_COMPONENT_INSTANCE_REQUEST = 0x1;
Event.COMPONENT_CREATED = 0x2;
Event.COMPONENT_INITIALIZED = 0x3;
Event.CREATE_INSTANCE_BEFORE = 0x4;
Event.DISPOSE_INSTANCE = 0x5;
Event.DISPOSE_OBJECT = 0x6;
Event.DOM_COMPONENT_INITIALIZED = 0x7;
Event.ENTITY_CREATED = 0x8;
Event.ENTITY_INITIALIZED = 0x9;
Event.GET_API_URL = 0xa;
Event.GET_RUNTIME = 0xb;
Event.GET_WINDOW_SIZE = 0xc;
Event.GRAPHICS_COMPONENT_INITIALIZED = 0xd;
Event.IMAGE_COMPONENT_INITIALIZED = 0xe;
Event.IMAGE_INSTANCE_CREATED = 0xf;
Event.INPUT_COMPONENT_INITIALIZED = 0x10;
Event.INSTANCE_CREATED = 0x11;
Event.INSTANCE_DISPOSED = 0x12;
Event.KEYBOARD_DOWN = 0x13;
Event.KEYBOARD_UP = 0x14;
Event.MOUSE_DOWN = 0x15;
Event.MOUSE_MOVE = 0x16;
Event.MOUSE_UP = 0x17;
Event.MOUSE_WHEEL = 0x18;
Event.OBJECT_CREATED = 0x19;
Event.OBJECT_INITIALIZED = 0x1a;
Event.PAUSE = 0x1b;
Event.PROJECT_INITIALIZED = 0x1c;
Event.RESTART = 0x1d;
Event.START = 0x1e;
Event.TOUCH_CANCEL = 0x1f;
Event.TOUCH_END = 0x20;
Event.TOUCH_MOVE = 0x21;
Event.TOUCH_START = 0x22;
Event.UPDATE_FROM_INSTANCE_AFTER = 0x23;
Event.UPDATE_FROM_INSTANCE_BEFORE = 0x24;
Event.UPDATE_INSTANCE_AFTER = 0x25;
Event.UPDATE_INSTANCE_BEFORE = 0x26;
Event.UPDATE_INSTANCE_PROPERTY = 0x27;
Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x28;
Event.MAX_EVENTS = 0x29;
Event.GetEventName = function(eventId) {
switch(eventId) {
case 0x1 : return 'component_created';
case 0x2 : return 'component_initialized';
case 0x3 : return 'create_instance_before';
case 0x4 : return 'dispose_instance';
case 0x5 : return 'dispose_object';
case 0x6 : return 'dom_component_initialized';
case 0x7 : return 'entity_created';
case 0x8 : return 'entity_initialized';
case 0x9 : return 'get_runtime';
case 0xa : return 'get_window_size';
case 0xb : return 'graphics_component_initialized';
case 0xc : return 'image_component_initialized';
case 0xd : return 'image_initialized';
case 0xe : return 'image_instance_created';
case 0xf : return 'input_component_initialized';
case 0x10 : return 'instance_created';
case 0x11 : return 'instance_disposed';
case 0x12 : return 'keyboard_down';
case 0x13 : return 'keyboard_up';
case 0x14 : return 'mouse_down';
case 0x15 : return 'mouse_move';
case 0x16 : return 'mouse_up';
case 0x17 : return 'mouse_wheel';
case 0x18 : return 'object_created';
case 0x19 : return 'object_initialized';
case 0x1a : return 'pause';
case 0x1b : return 'project_initialized';
case 0x1c : return 'restart';
case 0x1d : return 'start';
case 0x1e : return 'touch_cancel';
case 0x1f : return 'touch_end';
case 0x20 : return 'touch_move';
case 0x21 : return 'touch_start';
case 0x22 : return 'update_from_instance_after';
case 0x23 : return 'update_from_instance_before';
case 0x24 : return 'update_instance_after';
case 0x25 : return 'update_instance_before';
case 0x26 : return 'update_instance_property';
case 0x27 : return 'update_property_from_instance';
case 0x1 : return 'blacklisted_component_instance_request';
case 0x2 : return 'component_created';
case 0x3 : return 'component_initialized';
case 0x4 : return 'create_instance_before';
case 0x5 : return 'dispose_instance';
case 0x6 : return 'dispose_object';
case 0x7 : return 'dom_component_initialized';
case 0x8 : return 'entity_created';
case 0x9 : return 'entity_initialized';
case 0xa : return 'get_api_url';
case 0xb : return 'get_runtime';
case 0xc : return 'get_window_size';
case 0xd : return 'graphics_component_initialized';
case 0xe : return 'image_component_initialized';
case 0xf : return 'image_instance_created';
case 0x10 : return 'input_component_initialized';
case 0x11 : return 'instance_created';
case 0x12 : return 'instance_disposed';
case 0x13 : return 'keyboard_down';
case 0x14 : return 'keyboard_up';
case 0x15 : return 'mouse_down';
case 0x16 : return 'mouse_move';
case 0x17 : return 'mouse_up';
case 0x18 : return 'mouse_wheel';
case 0x19 : return 'object_created';
case 0x1a : return 'object_initialized';
case 0x1b : return 'pause';
case 0x1c : return 'project_initialized';
case 0x1d : return 'restart';
case 0x1e : return 'start';
case 0x1f : return 'touch_cancel';
case 0x20 : return 'touch_end';
case 0x21 : return 'touch_move';
case 0x22 : return 'touch_start';
case 0x23 : return 'update_from_instance_after';
case 0x24 : return 'update_from_instance_before';
case 0x25 : return 'update_instance_after';
case 0x26 : return 'update_instance_before';
case 0x27 : return 'update_instance_property';
case 0x28 : return 'update_property_from_instance';
default :
throw new Error('Event type not defined : ' + eventId);
}

View File

@ -47,10 +47,11 @@ const R3Object = require('./r3-r3-object.js');
Inherited Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Inherited Static Properties:
@ -58,8 +59,7 @@ const R3Object = require('./r3-r3-object.js');
Inherited Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no inherited methods>
Inherited Static Methods:
@ -78,7 +78,7 @@ const R3Object = require('./r3-r3-object.js');
Methods:
- initialize()
Overrides for R3.Event.R3Object.initialize()
Should raises an event(s) which indicates that this object initialized
Static Methods:
@ -118,20 +118,6 @@ class Project extends R3Object {
//GENERATED_CONSTRUCTOR_START
constructor(options) {
if (typeof options === 'undefined') {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
if (typeof options.callDepth === 'undefined') {
options.callDepth = 0;
} else {
options.callDepth++;
}
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
@ -148,12 +134,6 @@ class Project extends R3Object {
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
if (options.callDepth === 0) {
this.initialize();
} else {
options.callDepth--;
}
//CUSTOM_AFTER_INIT_START
//CUSTOM_AFTER_INIT_END
}
@ -171,26 +151,7 @@ class Project extends R3Object {
initialize() {
//GENERATED_INITIALIZE_METHOD_START
try {
super.initialize();
} catch (err) {
if (!(err instanceof TypeError)) {
//Another unexpected error occurred - and we are not inside a base class
throw err;
}
delete this.callDepth;
this.initialized = true;
//CUSTOM_BEFORE_CREATE_INSTANCE_START
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
super.initialize();
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
@ -198,6 +159,14 @@ class Project extends R3Object {
Event.Emit(Event.PROJECT_INITIALIZED, this);
//CUSTOM_INITIALIZE_METHOD_END
//GENERATED_INITIALIZE_METHOD_AFTER_START
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}
//GENERATED_INITIALIZE_METHOD_AFTER_END
}
//GENERATED_METHODS_END

View File

@ -46,10 +46,11 @@ const Event = require('./r3-event.js');
Properties:
- id (Default value Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely
- id (Default value Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely
identifies it everywhere (client and server side))
- name (Default value 'Object ' + options.id - Each Object has a name)
- register (Default value true)
- parent (Default value null - All objects could have a parent)
- children (Default value [] - All objects could have some children)
Static Properties:
@ -57,8 +58,7 @@ const Event = require('./r3-event.js');
Methods:
- initialize()
Should raises an event(s) which indicates that this object initialized
<no methods>
Static Methods:
@ -70,9 +70,10 @@ const Event = require('./r3-event.js');
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
id=Utils.RandomId(10) - Each Object receives an 10 digit random ID which uniquely identifies it everywhere (client and server side)
id=Utils.RandomId(15) - Each Object receives an 15 digit random ID which uniquely identifies it everywhere (client and server side)
name='Object ' + options.id - Each Object has a name
register=true
parent=null - All objects could have a parent
children=[] - All objects could have some children
CUSTOM_OPTIONS_END
TEMPLATE_STATIC_OPTIONS_START
@ -85,7 +86,6 @@ const Event = require('./r3-event.js');
TEMPLATE_METHODS_END
CUSTOM_METHODS_START
initialize() - Should raises an event(s) which indicates that this object initialized
CUSTOM_METHODS_END
TEMPLATE_STATIC_METHODS_START
@ -101,20 +101,6 @@ class R3Object extends Event {
//GENERATED_CONSTRUCTOR_START
constructor(options) {
if (typeof options === 'undefined') {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
if (typeof options.callDepth === 'undefined') {
options.callDepth = 0;
} else {
options.callDepth++;
}
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
@ -122,11 +108,11 @@ class R3Object extends Event {
//GENERATED_OPTIONS_INIT_START
/**
* id - Each Object receives an 10 digit random ID which uniquely identifies it everywhere (client and
* id - Each Object receives an 15 digit random ID which uniquely identifies it everywhere (client and
* server side)
*/
if (typeof options.id === 'undefined') {
options.id = Utils.RandomId(10);
options.id = Utils.RandomId(15);
}
/**
* name - Each Object has a name
@ -135,10 +121,16 @@ class R3Object extends Event {
options.name = 'Object ' + options.id;
}
/**
* register - No comment
* parent - All objects could have a parent
*/
if (typeof options.register === 'undefined') {
options.register = true;
if (typeof options.parent === 'undefined') {
options.parent = null;
}
/**
* children - All objects could have some children
*/
if (typeof options.children === 'undefined') {
options.children = [];
}
//GENERATED_OPTIONS_INIT_END
@ -151,12 +143,6 @@ class R3Object extends Event {
this.emit(Event.OBJECT_CREATED, this);
//CUSTOM_BEFORE_INIT_END
if (options.callDepth === 0) {
this.initialize();
} else {
options.callDepth--;
}
//CUSTOM_AFTER_INIT_START
//CUSTOM_AFTER_INIT_END
}
@ -166,41 +152,6 @@ class R3Object extends Event {
//GENERATED_TEMPLATE_METHODS_END
//GENERATED_METHODS_START
/**
* initialize()
* - Should raises an event(s) which indicates that this object initialized
*/
initialize() {
//GENERATED_INITIALIZE_METHOD_START
try {
super.initialize();
} catch (err) {
if (!(err instanceof TypeError)) {
//Another unexpected error occurred - and we are not inside a base class
throw err;
}
delete this.callDepth;
this.initialized = true;
//CUSTOM_BEFORE_CREATE_INSTANCE_START
Event.Emit(Event.OBJECT_INITIALIZED, this);
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}
//GENERATED_INITIALIZE_METHOD_END
//CUSTOM_INITIALIZE_METHOD_START
//CUSTOM_INITIALIZE_METHOD_END
}
//GENERATED_METHODS_END
//GENERATED_TEMPLATE_STATIC_METHODS_START

View File

@ -1,6 +1,6 @@
class R3 {
static version = '2.0.790';
static compileDate = '2021 Sep 19 - 21:43:21 pm';
static version = '2.0.851';
static compileDate = '2021 Sep 21 - 14:45:57 pm';
}
//GENERATED_IMPORTS_START

View File

@ -127,6 +127,9 @@ class RuntimeBullet extends RuntimePhysics {
//CUSTOM_BUILD_INSTANCE_METHOD_START
//CUSTOM_BUILD_INSTANCE_METHOD_END
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_START
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -127,6 +127,9 @@ class RuntimeCodeMirror extends RuntimeCoder {
//CUSTOM_BUILD_INSTANCE_METHOD_START
//CUSTOM_BUILD_INSTANCE_METHOD_END
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_START
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -127,6 +127,9 @@ class RuntimeControlKit extends RuntimeGUI {
//CUSTOM_BUILD_INSTANCE_METHOD_START
//CUSTOM_BUILD_INSTANCE_METHOD_END
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_START
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -134,6 +134,9 @@ class RuntimeDocument extends RuntimeDOM {
}
//CUSTOM_BUILD_INSTANCE_METHOD_END
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_START
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -127,6 +127,9 @@ class RuntimeNodeJSImage extends RuntimeImage {
//CUSTOM_BUILD_INSTANCE_METHOD_START
//CUSTOM_BUILD_INSTANCE_METHOD_END
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_START
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -127,6 +127,9 @@ class RuntimeStats extends RuntimeStatistics {
//CUSTOM_BUILD_INSTANCE_METHOD_START
//CUSTOM_BUILD_INSTANCE_METHOD_END
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_START
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -127,6 +127,9 @@ class RuntimeThree extends RuntimeGraphics {
//CUSTOM_BUILD_INSTANCE_METHOD_START
//CUSTOM_BUILD_INSTANCE_METHOD_END
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_START
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -133,6 +133,9 @@ class RuntimeWebImage extends RuntimeImage {
}
//CUSTOM_BUILD_INSTANCE_METHOD_END
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_START
//GENERATED_BUILD_INSTANCE_METHOD_AFTER_END
}
//GENERATED_TEMPLATE_METHODS_END

View File

@ -66,7 +66,7 @@ const System = require('.././r3-system.js');
CUSTOM_STATIC_EVENT_LISTENERS_START
Event.OBJECT_CREATED
Event.OBJECT_INITIALIZED
Event.COMPONENT_INITIALIZED
Event.INSTANCE_CREATED
Event.CREATE_INSTANCE_BEFORE - @returns boolean delayInstance which indicates whether or not instance creation is delayed (handled) by another system. (i.e. where instance creation order is of importance)
CUSTOM_STATIC_EVENT_LISTENERS_END
@ -137,9 +137,9 @@ class SystemLinking extends System {
SystemLinking.OnObjectCreated
);
SystemLinking.Subscriptions['OBJECT_INITIALIZED'] = Event.Subscribe(
Event.OBJECT_INITIALIZED,
SystemLinking.OnObjectInitialized
SystemLinking.Subscriptions['COMPONENT_INITIALIZED'] = Event.Subscribe(
Event.COMPONENT_INITIALIZED,
SystemLinking.OnComponentInitialized
);
SystemLinking.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe(
@ -181,8 +181,8 @@ class SystemLinking extends System {
SystemLinking.Subscriptions['OBJECT_CREATED'].remove();
delete SystemLinking.Subscriptions['OBJECT_CREATED'];
SystemLinking.Subscriptions['OBJECT_INITIALIZED'].remove();
delete SystemLinking.Subscriptions['OBJECT_INITIALIZED'];
SystemLinking.Subscriptions['COMPONENT_INITIALIZED'].remove();
delete SystemLinking.Subscriptions['COMPONENT_INITIALIZED'];
SystemLinking.Subscriptions['INSTANCE_CREATED'].remove();
delete SystemLinking.Subscriptions['INSTANCE_CREATED'];
@ -233,19 +233,19 @@ class SystemLinking extends System {
}
/**
* OnObjectInitialized()
* - Listens to events of type Event.OBJECT_INITIALIZED and executes this function.
* OnComponentInitialized()
* - Listens to events of type Event.COMPONENT_INITIALIZED and executes this function.
* @param object (The event data passed as argument - typically an R3Object)
* @return
*/
static OnObjectInitialized(object) {
static OnComponentInitialized(object) {
//GENERATED_STATIC_ON_OBJECT_INITIALIZED_METHOD_START
//GENERATED_STATIC_ON_OBJECT_INITIALIZED_METHOD_END
//GENERATED_STATIC_ON_COMPONENT_INITIALIZED_METHOD_START
//GENERATED_STATIC_ON_COMPONENT_INITIALIZED_METHOD_END
//CUSTOM_STATIC_ON_OBJECT_INITIALIZED_METHOD_START
console.log('object initialized');
//CUSTOM_STATIC_ON_OBJECT_INITIALIZED_METHOD_END
//CUSTOM_STATIC_ON_COMPONENT_INITIALIZED_METHOD_START
console.log('component initialized');
//CUSTOM_STATIC_ON_COMPONENT_INITIALIZED_METHOD_END
}
@ -281,7 +281,27 @@ class SystemLinking extends System {
//CUSTOM_STATIC_ON_CREATE_INSTANCE_BEFORE_METHOD_START
for (let i = 0; i < SystemLinking.BlacklistedComponents.length; i++) {
if (object instanceof SystemLinking.BlacklistedComponents) {
return true;
/**
* If an object is 'Blacklisted' - we need to fire an event
* to notify other systems that this component requests
* to have its instance created.
*
* Should no system respond to this event we should continue
* to create the instance
*/
let delayInstance = false;
Event.Emit(
Event.BLACKLISTED_COMPONENT_INSTANCE_REQUEST,
object,
function(response) {
delayInstance = response;
}
);
return delayInstance;
}
}

View File

@ -80,6 +80,7 @@ const System = require('.././r3-system.js');
CUSTOM_STATIC_EVENT_LISTENERS_START
Event.GET_RUNTIME
Event.PROJECT_INITIALIZED
Event.GET_API_URL
CUSTOM_STATIC_EVENT_LISTENERS_END
TEMPLATE_METHODS_START
@ -153,6 +154,11 @@ class SystemRuntime extends System {
SystemRuntime.OnProjectInitialized
);
SystemRuntime.Subscriptions['GET_API_URL'] = Event.Subscribe(
Event.GET_API_URL,
SystemRuntime.OnGetApiUrl
);
//GENERATED_STATIC_EVENT_LISTENERS_START_END
//CUSTOM_BEFORE_STATIC_SYSTEM_START_START
@ -185,6 +191,9 @@ class SystemRuntime extends System {
SystemRuntime.Subscriptions['PROJECT_INITIALIZED'].remove();
delete SystemRuntime.Subscriptions['PROJECT_INITIALIZED'];
SystemRuntime.Subscriptions['GET_API_URL'].remove();
delete SystemRuntime.Subscriptions['GET_API_URL'];
//GENERATED_STATIC_EVENT_LISTENERS_STOP_END
//CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START
@ -223,7 +232,6 @@ class SystemRuntime extends System {
//CUSTOM_STATIC_ON_GET_RUNTIME_METHOD_START
if (object instanceof R3.Component.DOM) {
if (SystemRuntime.CurrentProject === null) {
return new R3.Runtime.DOM.Document();
} else {
@ -232,7 +240,6 @@ class SystemRuntime extends System {
}
if (object instanceof R3.Image) {
if (SystemRuntime.CurrentProject === null) {
return new R3.Runtime.Image.WebImage();
} else {
@ -259,6 +266,38 @@ class SystemRuntime extends System {
SystemRuntime.CurrentProject = object;
//CUSTOM_STATIC_ON_PROJECT_INITIALIZED_METHOD_END
}
/**
* OnGetApiUrl()
* - Listens to events of type Event.GET_API_URL and executes this function.
* @param object (The event data passed as argument - typically an R3Object)
* @return
*/
static OnGetApiUrl(object) {
//GENERATED_STATIC_ON_GET_API_URL_METHOD_START
//GENERATED_STATIC_ON_GET_API_URL_METHOD_END
//CUSTOM_STATIC_ON_GET_API_URL_METHOD_START
if (SystemRuntime.CurrentProject === null) {
/**
* Check if we are running server side or client side
*/
if (process && process.env) {
const {API_URL} = process.env;
if (typeof API_URL === 'undefined') {
throw new Error('No API_URL defined for this process');
}
return API_URL;
} else {
return '__API_URL__';
}
}
//CUSTOM_STATIC_ON_GET_API_URL_METHOD_END
}
//GENERATED_STATIC_EVENT_LISTENER_METHODS_END

View File

@ -198,6 +198,13 @@ class SystemStorage extends System {
//GENERATED_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_END
//CUSTOM_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_START
Event.Emit(
Event.GET_API_URL,
null,
function(apiUrl) {
console.log('about to download image at: ' + apiUrl + object.external_path);
}
);
//CUSTOM_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD_END
}

View File

@ -0,0 +1 @@
this.initialized = true;

View File

@ -9,7 +9,6 @@ const R3Object = require('.././r3-r3-object.js');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
register=true
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START

View File

@ -1,7 +1,9 @@
constructor(options) {
if (typeof options === 'undefined') {
options = {};
super(options);
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -10,9 +12,7 @@
options.callDepth++;
}
super(options);
this.emit(Event.COMPONENT_CREATED, this);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END
@ -25,6 +25,8 @@
Object.assign(this, options);
this.emit(Event.COMPONENT_CREATED, this);
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END

View File

@ -9,8 +9,10 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
GENERATED_INHERITED_END
TEMPLATE_OPTIONS_START
parent=null - The parent R3.Object of this component
initialized=false - A boolean which indicates whether or not this component has initialized
instance=null - Holds the current instance of this object as determined (built) by the runtime object.
maxDepth=options.callDepth - Indicates the maximum call depth of this component
initializeDepth=0 - The amount of times this component passed through initialize() functions
TEMPLATE_OPTIONS_END
CUSTOM_OPTIONS_START
@ -29,14 +31,16 @@ const EXTEND_CLASS = require('INCLUDE_PATH/EXTEND_CLASS_FILE_NAME');
CUSTOM_INSTANCE_OPTIONS_MAPPING_END
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START
parent
instance
initializeDepth
initialized
TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START
CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END
TEMPLATE_METHODS_START
initialize() - Notifies all systems listening that this component initialized.
updateInstance(property) - Updates this object by copying the values of the current object into it's instance object.
updateFromInstance(property) - Updates this object by copying the values of its instance into the current object.
TEMPLATE_METHODS_END

View File

@ -4,8 +4,8 @@
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
if (typeof options.maxDepth === 'undefined') {
options.maxDepth = 0;
}
if (typeof options.callDepth === 'undefined') {
@ -14,11 +14,13 @@
options.callDepth++;
}
super(options);
options.maxDepth = options.callDepth;
//GENERATED_TEMPLATE_OPTIONS_INIT_START
//GENERATED_TEMPLATE_OPTIONS_INIT_END
super(options);
//GENERATED_OPTIONS_INIT_START
//GENERATED_OPTIONS_INIT_END

View File

@ -1,19 +1,5 @@
constructor(options) {
if (typeof options === 'undefined') {
options = {};
}
if (typeof options.initialized === 'undefined') {
options.initialized = false;
}
if (typeof options.callDepth === 'undefined') {
options.callDepth = 0;
} else {
options.callDepth++;
}
super(options);
//GENERATED_TEMPLATE_OPTIONS_INIT_START
@ -30,12 +16,6 @@
//CUSTOM_BEFORE_INIT_START
//CUSTOM_BEFORE_INIT_END
if (options.callDepth === 0) {
this.initialize();
} else {
options.callDepth--;
}
//CUSTOM_AFTER_INIT_START
//CUSTOM_AFTER_INIT_END
}

View File

@ -0,0 +1 @@
super.initialize();

View File

@ -12,4 +12,8 @@
//CUSTOM_METHOD_NAME_UPPERCASE_METHOD_START
//CUSTOM_METHOD_NAME_UPPERCASE_METHOD_END
//GENERATED_METHOD_NAME_UPPERCASE_METHOD_AFTER_START
FUNCTION_TEMPLATE_AFTER
//GENERATED_METHOD_NAME_UPPERCASE_METHOD_AFTER_END
}

View File

@ -1,20 +0,0 @@
try {
super.initialize();
} catch (err) {
if (!(err instanceof TypeError)) {
//Another unexpected error occurred - and we are not inside a base class
throw err;
}
delete this.callDepth;
this.initialized = true;
//CUSTOM_BEFORE_CREATE_INSTANCE_START
//CUSTOM_BEFORE_CREATE_INSTANCE_END
this.createInstance();
//CUSTOM_AFTER_CREATE_INSTANCE_START
//CUSTOM_AFTER_CREATE_INSTANCE_END
}

View File

@ -0,0 +1,5 @@
if (this.initializeDepth === this.maxDepth) {
this.createInstance();
} else {
this.initializeDepth++;
}

View File

@ -1,11 +1,17 @@
GENERATED_ASYNC_METHOD
GENERATED_ASYNC_METHOD_AFTER
GENERATED_BUILD_INSTANCE_METHOD
GENERATED_BUILD_INSTANCE_METHOD_AFTER
GENERATED_CONSTRUCTOR
GENERATED_CREATE_INSTANCE_METHOD
GENERATED_CREATE_INSTANCE_METHOD_AFTER
GENERATED_DEFINES
GENERATED_DISPOSE_INSTANCE_METHOD
GENERATED_DISPOSE_INSTANCE_METHOD_AFTER
GENERATED_DISPOSE_METHOD
GENERATED_DISPOSE_METHOD_AFTER
GENERATED_EMIT_METHOD
GENERATED_EMIT_METHOD_AFTER
GENERATED_EVENT_LISTENER_METHODS
GENERATED_EVENT_LISTENERS_START
GENERATED_EVENT_LISTENERS_STOP
@ -15,11 +21,14 @@ GENERATED_IMPORTS
GENERATED_INDEX_BODY
GENERATED_INHERITED
GENERATED_INITIALIZE_METHOD
GENERATED_INITIALIZE_METHOD_AFTER
GENERATED_METHOD_NAME_UPPERCASE_METHOD
GENERATED_METHOD_NAME_UPPERCASE_METHOD_AFTER
GENERATED_METHODS
GENERATED_OPTIONS_INIT
GENERATED_OUT_OF_CLASS_IMPLEMENTATION
GENERATED_SET_RUNTIME_METHOD
GENERATED_SET_RUNTIME_METHOD_AFTER
GENERATED_STATIC_ASYNC_METHOD
GENERATED_STATIC_EMIT_METHOD
GENERATED_STATIC_EVENT_LISTENER_METHODS
@ -29,8 +38,9 @@ GENERATED_STATIC_METHOD_NAME_UPPERCASE_METHOD
GENERATED_STATIC_METHODS
GENERATED_STATIC_ON_CREATE_INSTANCE_BEFORE_METHOD
GENERATED_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD
GENERATED_STATIC_ON_GET_API_URL_METHOD
GENERATED_STATIC_ON_GET_RUNTIME_METHOD
GENERATED_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD
GENERATED_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD
GENERATED_STATIC_ON_INSTANCE_CREATED_METHOD
GENERATED_STATIC_ON_KEYBOARD_DOWN_METHOD
GENERATED_STATIC_ON_KEYBOARD_UP_METHOD
@ -50,6 +60,7 @@ GENERATED_STATIC_START_METHOD
GENERATED_STATIC_STOP_METHOD
GENERATED_STATIC_SUBSCRIBE_METHOD
GENERATED_SUBSCRIBE_METHOD
GENERATED_SUBSCRIBE_METHOD_AFTER
GENERATED_TEMPLATE_METHODS
GENERATED_TEMPLATE_OPTIONS_INIT
GENERATED_TEMPLATE_STATIC_METHODS
@ -57,13 +68,13 @@ GENERATED_TEMPLATE_STATIC_OPTIONS_INIT
GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS
GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS
GENERATED_UPDATE_FROM_INSTANCE_METHOD
GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER
GENERATED_UPDATE_FROM_INSTANCE_OPTIONS
GENERATED_UPDATE_INSTANCE_METHOD
GENERATED_UPDATE_INSTANCE_METHOD_AFTER
GENERATED_UPDATE_INSTANCE_OPTIONS
CUSTOM_AFTER_CREATE_INSTANCE
CUSTOM_AFTER_INIT
CUSTOM_ASYNC_METHOD
CUSTOM_BEFORE_CREATE_INSTANCE
CUSTOM_BEFORE_INIT
CUSTOM_BEFORE_STATIC_SYSTEM_START
CUSTOM_BEFORE_STATIC_SYSTEM_STOP
@ -93,8 +104,9 @@ CUSTOM_STATIC_METHOD_NAME_UPPERCASE_METHOD
CUSTOM_STATIC_METHODS
CUSTOM_STATIC_ON_CREATE_INSTANCE_BEFORE_METHOD
CUSTOM_STATIC_ON_DOM_COMPONENT_INITIALIZED_METHOD
CUSTOM_STATIC_ON_GET_API_URL_METHOD
CUSTOM_STATIC_ON_GET_RUNTIME_METHOD
CUSTOM_STATIC_ON_IMAGE_COMPONENT_INITIALIZED_METHOD
CUSTOM_STATIC_ON_IMAGE_INSTANCE_CREATED_METHOD
CUSTOM_STATIC_ON_INSTANCE_CREATED_METHOD
CUSTOM_STATIC_ON_KEYBOARD_DOWN_METHOD
CUSTOM_STATIC_ON_KEYBOARD_UP_METHOD

7
vendor/autoload.php vendored Normal file
View File

@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitcc0f3adf54fee6a3f4e312c272266d68::getLoader();

445
vendor/composer/ClassLoader.php vendored Normal file
View File

@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

263
vendor/composer/InstalledVersions.php vendored Normal file
View File

@ -0,0 +1,263 @@
<?php
namespace Composer;
use Composer\Semver\VersionParser;
class InstalledVersions
{
private static $installed = array (
'root' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '2deca7016fd7bea505c1cfb55c56f6f233495cf6',
'name' => '__root__',
),
'versions' =>
array (
'__root__' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '2deca7016fd7bea505c1cfb55c56f6f233495cf6',
),
'graham-campbell/result-type' =>
array (
'pretty_version' => 'v1.0.2',
'version' => '1.0.2.0',
'aliases' =>
array (
),
'reference' => '84afea85c6841deeea872f36249a206e878a5de0',
),
'phpoption/phpoption' =>
array (
'pretty_version' => '1.8.0',
'version' => '1.8.0.0',
'aliases' =>
array (
),
'reference' => '5455cb38aed4523f99977c4a12ef19da4bfe2a28',
),
'symfony/polyfill-ctype' =>
array (
'pretty_version' => 'v1.23.0',
'version' => '1.23.0.0',
'aliases' =>
array (
),
'reference' => '46cd95797e9df938fdd2b03693b5fca5e64b01ce',
),
'symfony/polyfill-mbstring' =>
array (
'pretty_version' => 'v1.23.1',
'version' => '1.23.1.0',
'aliases' =>
array (
),
'reference' => '9174a3d80210dca8daa7f31fec659150bbeabfc6',
),
'symfony/polyfill-php80' =>
array (
'pretty_version' => 'v1.23.1',
'version' => '1.23.1.0',
'aliases' =>
array (
),
'reference' => '1100343ed1a92e3a38f9ae122fc0eb21602547be',
),
'vlucas/phpdotenv' =>
array (
'pretty_version' => 'v5.3.0',
'version' => '5.3.0.0',
'aliases' =>
array (
),
'reference' => 'b3eac5c7ac896e52deab4a99068e3f4ab12d9e56',
),
),
);
public static function getInstalledPackages()
{
return array_keys(self::$installed['versions']);
}
public static function isInstalled($packageName)
{
return isset(self::$installed['versions'][$packageName]);
}
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
public static function getVersionRanges($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
$ranges = array();
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
public static function getVersion($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
if (!isset(self::$installed['versions'][$packageName]['version'])) {
return null;
}
return self::$installed['versions'][$packageName]['version'];
}
public static function getPrettyVersion($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return self::$installed['versions'][$packageName]['pretty_version'];
}
public static function getReference($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
return null;
}
return self::$installed['versions'][$packageName]['reference'];
}
public static function getRootPackage()
{
return self::$installed['root'];
}
public static function getRawData()
{
return self::$installed;
}
public static function reload($data)
{
self::$installed = $data;
}
}

21
vendor/composer/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

14
vendor/composer/autoload_classmap.php vendored Normal file
View File

@ -0,0 +1,14 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
);

12
vendor/composer/autoload_files.php vendored Normal file
View File

@ -0,0 +1,12 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
);

View File

@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

15
vendor/composer/autoload_psr4.php vendored Normal file
View File

@ -0,0 +1,15 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'),
'GrahamCampbell\\ResultType\\' => array($vendorDir . '/graham-campbell/result-type/src'),
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
);

75
vendor/composer/autoload_real.php vendored Normal file
View File

@ -0,0 +1,75 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitcc0f3adf54fee6a3f4e312c272266d68
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInitcc0f3adf54fee6a3f4e312c272266d68', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitcc0f3adf54fee6a3f4e312c272266d68', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitcc0f3adf54fee6a3f4e312c272266d68::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitcc0f3adf54fee6a3f4e312c272266d68::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirecc0f3adf54fee6a3f4e312c272266d68($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequirecc0f3adf54fee6a3f4e312c272266d68($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

80
vendor/composer/autoload_static.php vendored Normal file
View File

@ -0,0 +1,80 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitcc0f3adf54fee6a3f4e312c272266d68
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
);
public static $prefixLengthsPsr4 = array (
'S' =>
array (
'Symfony\\Polyfill\\Php80\\' => 23,
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Polyfill\\Ctype\\' => 23,
),
'P' =>
array (
'PhpOption\\' => 10,
),
'G' =>
array (
'GrahamCampbell\\ResultType\\' => 26,
),
'D' =>
array (
'Dotenv\\' => 7,
),
);
public static $prefixDirsPsr4 = array (
'Symfony\\Polyfill\\Php80\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Polyfill\\Ctype\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
),
'PhpOption\\' =>
array (
0 => __DIR__ . '/..' . '/phpoption/phpoption/src/PhpOption',
),
'GrahamCampbell\\ResultType\\' =>
array (
0 => __DIR__ . '/..' . '/graham-campbell/result-type/src',
),
'Dotenv\\' =>
array (
0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src',
),
);
public static $classMap = array (
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitcc0f3adf54fee6a3f4e312c272266d68::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcc0f3adf54fee6a3f4e312c272266d68::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcc0f3adf54fee6a3f4e312c272266d68::$classMap;
}, null, ClassLoader::class);
}
}

476
vendor/composer/installed.json vendored Normal file
View File

@ -0,0 +1,476 @@
{
"packages": [
{
"name": "graham-campbell/result-type",
"version": "v1.0.2",
"version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/GrahamCampbell/Result-Type.git",
"reference": "84afea85c6841deeea872f36249a206e878a5de0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/84afea85c6841deeea872f36249a206e878a5de0",
"reference": "84afea85c6841deeea872f36249a206e878a5de0",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"phpoption/phpoption": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8"
},
"time": "2021-08-28T21:34:50+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"GrahamCampbell\\ResultType\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk"
}
],
"description": "An Implementation Of The Result Type",
"keywords": [
"Graham Campbell",
"GrahamCampbell",
"Result Type",
"Result-Type",
"result"
],
"support": {
"issues": "https://github.com/GrahamCampbell/Result-Type/issues",
"source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.2"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type",
"type": "tidelift"
}
],
"install-path": "../graham-campbell/result-type"
},
{
"name": "phpoption/phpoption",
"version": "1.8.0",
"version_normalized": "1.8.0.0",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/php-option.git",
"reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/5455cb38aed4523f99977c4a12ef19da4bfe2a28",
"reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^6.5.14 || ^7.0.20 || ^8.5.19 || ^9.5.8"
},
"time": "2021-08-28T21:27:29+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"PhpOption\\": "src/PhpOption/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com"
},
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk"
}
],
"description": "Option Type for PHP",
"keywords": [
"language",
"option",
"php",
"type"
],
"support": {
"issues": "https://github.com/schmittjoh/php-option/issues",
"source": "https://github.com/schmittjoh/php-option/tree/1.8.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption",
"type": "tidelift"
}
],
"install-path": "../phpoption/phpoption"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.23.0",
"version_normalized": "1.23.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"suggest": {
"ext-ctype": "For best performance"
},
"time": "2021-02-19T12:13:01+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/polyfill-ctype"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.23.1",
"version_normalized": "1.23.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6",
"reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"time": "2021-05-27T12:26:48+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/polyfill-mbstring"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.23.1",
"version_normalized": "1.23.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be",
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"time": "2021-07-28T13:41:28+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/polyfill-php80"
},
{
"name": "vlucas/phpdotenv",
"version": "v5.3.0",
"version_normalized": "5.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "b3eac5c7ac896e52deab4a99068e3f4ab12d9e56"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/b3eac5c7ac896e52deab4a99068e3f4ab12d9e56",
"reference": "b3eac5c7ac896e52deab4a99068e3f4ab12d9e56",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"graham-campbell/result-type": "^1.0.1",
"php": "^7.1.3 || ^8.0",
"phpoption/phpoption": "^1.7.4",
"symfony/polyfill-ctype": "^1.17",
"symfony/polyfill-mbstring": "^1.17",
"symfony/polyfill-php80": "^1.17"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"ext-filter": "*",
"phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5.1"
},
"suggest": {
"ext-filter": "Required to use the boolean validator."
},
"time": "2021-01-20T15:23:13+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Dotenv\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Graham Campbell",
"email": "graham@alt-three.com",
"homepage": "https://gjcampbell.co.uk/"
},
{
"name": "Vance Lucas",
"email": "vance@vancelucas.com",
"homepage": "https://vancelucas.com/"
}
],
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
"keywords": [
"dotenv",
"env",
"environment"
],
"support": {
"issues": "https://github.com/vlucas/phpdotenv/issues",
"source": "https://github.com/vlucas/phpdotenv/tree/v5.3.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
"type": "tidelift"
}
],
"install-path": "../vlucas/phpdotenv"
}
],
"dev": true,
"dev-package-names": []
}

78
vendor/composer/installed.php vendored Normal file
View File

@ -0,0 +1,78 @@
<?php return array (
'root' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '2deca7016fd7bea505c1cfb55c56f6f233495cf6',
'name' => '__root__',
),
'versions' =>
array (
'__root__' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '2deca7016fd7bea505c1cfb55c56f6f233495cf6',
),
'graham-campbell/result-type' =>
array (
'pretty_version' => 'v1.0.2',
'version' => '1.0.2.0',
'aliases' =>
array (
),
'reference' => '84afea85c6841deeea872f36249a206e878a5de0',
),
'phpoption/phpoption' =>
array (
'pretty_version' => '1.8.0',
'version' => '1.8.0.0',
'aliases' =>
array (
),
'reference' => '5455cb38aed4523f99977c4a12ef19da4bfe2a28',
),
'symfony/polyfill-ctype' =>
array (
'pretty_version' => 'v1.23.0',
'version' => '1.23.0.0',
'aliases' =>
array (
),
'reference' => '46cd95797e9df938fdd2b03693b5fca5e64b01ce',
),
'symfony/polyfill-mbstring' =>
array (
'pretty_version' => 'v1.23.1',
'version' => '1.23.1.0',
'aliases' =>
array (
),
'reference' => '9174a3d80210dca8daa7f31fec659150bbeabfc6',
),
'symfony/polyfill-php80' =>
array (
'pretty_version' => 'v1.23.1',
'version' => '1.23.1.0',
'aliases' =>
array (
),
'reference' => '1100343ed1a92e3a38f9ae122fc0eb21602547be',
),
'vlucas/phpdotenv' =>
array (
'pretty_version' => 'v5.3.0',
'version' => '5.3.0.0',
'aliases' =>
array (
),
'reference' => 'b3eac5c7ac896e52deab4a99068e3f4ab12d9e56',
),
),
);

26
vendor/composer/platform_check.php vendored Normal file
View File

@ -0,0 +1,26 @@
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 70103)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.3". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2020 Graham Campbell <graham@alt-three.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,32 @@
{
"name": "graham-campbell/result-type",
"description": "An Implementation Of The Result Type",
"keywords": ["result", "result-type", "Result", "Result Type", "Result-Type", "Graham Campbell", "GrahamCampbell"],
"license": "MIT",
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk"
}
],
"require": {
"php": "^7.0 || ^8.0",
"phpoption/phpoption": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8"
},
"autoload": {
"psr-4": {
"GrahamCampbell\\ResultType\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"GrahamCampbell\\Tests\\ResultType\\": "tests/"
}
},
"config": {
"preferred-install": "dist"
}
}

View File

@ -0,0 +1,120 @@
<?php
declare(strict_types=1);
/*
* This file is part of Result Type.
*
* (c) Graham Campbell <graham@alt-three.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\ResultType;
use PhpOption\None;
use PhpOption\Some;
/**
* @template T
* @template E
* @extends \GrahamCampbell\ResultType\Result<T,E>
*/
final class Error extends Result
{
/**
* @var E
*/
private $value;
/**
* Internal constructor for an error value.
*
* @param E $value
*
* @return void
*/
private function __construct($value)
{
$this->value = $value;
}
/**
* Create a new error value.
*
* @template F
*
* @param F $value
*
* @return \GrahamCampbell\ResultType\Result<T,F>
*/
public static function create($value)
{
return new self($value);
}
/**
* Get the success option value.
*
* @return \PhpOption\Option<T>
*/
public function success()
{
return None::create();
}
/**
* Map over the success value.
*
* @template S
*
* @param callable(T):S $f
*
* @return \GrahamCampbell\ResultType\Result<S,E>
*/
public function map(callable $f)
{
return self::create($this->value);
}
/**
* Flat map over the success value.
*
* @template S
* @template F
*
* @param callable(T):\GrahamCampbell\ResultType\Result<S,F> $f
*
* @return \GrahamCampbell\ResultType\Result<S,F>
*/
public function flatMap(callable $f)
{
/** @var \GrahamCampbell\ResultType\Result<S,F> */
return self::create($this->value);
}
/**
* Get the error option value.
*
* @return \PhpOption\Option<E>
*/
public function error()
{
return Some::create($this->value);
}
/**
* Map over the error value.
*
* @template F
*
* @param callable(E):F $f
*
* @return \GrahamCampbell\ResultType\Result<T,F>
*/
public function mapError(callable $f)
{
return self::create($f($this->value));
}
}

View File

@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
/*
* This file is part of Result Type.
*
* (c) Graham Campbell <graham@alt-three.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\ResultType;
/**
* @template T
* @template E
*/
abstract class Result
{
/**
* Get the success option value.
*
* @return \PhpOption\Option<T>
*/
abstract public function success();
/**
* Map over the success value.
*
* @template S
*
* @param callable(T):S $f
*
* @return \GrahamCampbell\ResultType\Result<S,E>
*/
abstract public function map(callable $f);
/**
* Flat map over the success value.
*
* @template S
* @template F
*
* @param callable(T):\GrahamCampbell\ResultType\Result<S,F> $f
*
* @return \GrahamCampbell\ResultType\Result<S,F>
*/
abstract public function flatMap(callable $f);
/**
* Get the error option value.
*
* @return \PhpOption\Option<E>
*/
abstract public function error();
/**
* Map over the error value.
*
* @template F
*
* @param callable(E):F $f
*
* @return \GrahamCampbell\ResultType\Result<T,F>
*/
abstract public function mapError(callable $f);
}

View File

@ -0,0 +1,119 @@
<?php
declare(strict_types=1);
/*
* This file is part of Result Type.
*
* (c) Graham Campbell <graham@alt-three.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\ResultType;
use PhpOption\None;
use PhpOption\Some;
/**
* @template T
* @template E
* @extends \GrahamCampbell\ResultType\Result<T,E>
*/
final class Success extends Result
{
/**
* @var T
*/
private $value;
/**
* Internal constructor for a success value.
*
* @param T $value
*
* @return void
*/
private function __construct($value)
{
$this->value = $value;
}
/**
* Create a new error value.
*
* @template S
*
* @param S $value
*
* @return \GrahamCampbell\ResultType\Result<S,E>
*/
public static function create($value)
{
return new self($value);
}
/**
* Get the success option value.
*
* @return \PhpOption\Option<T>
*/
public function success()
{
return Some::create($this->value);
}
/**
* Map over the success value.
*
* @template S
*
* @param callable(T):S $f
*
* @return \GrahamCampbell\ResultType\Result<S,E>
*/
public function map(callable $f)
{
return self::create($f($this->value));
}
/**
* Flat map over the success value.
*
* @template S
* @template F
*
* @param callable(T):\GrahamCampbell\ResultType\Result<S,F> $f
*
* @return \GrahamCampbell\ResultType\Result<S,F>
*/
public function flatMap(callable $f)
{
return $f($this->value);
}
/**
* Get the error option value.
*
* @return \PhpOption\Option<E>
*/
public function error()
{
return None::create();
}
/**
* Map over the error value.
*
* @template F
*
* @param callable(E):F $f
*
* @return \GrahamCampbell\ResultType\Result<T,F>
*/
public function mapError(callable $f)
{
return self::create($this->value);
}
}

201
vendor/phpoption/phpoption/LICENSE vendored Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

23
vendor/phpoption/phpoption/Makefile vendored Normal file
View File

@ -0,0 +1,23 @@
install:
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base update
@docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:7.4-base bin all update
phpunit:
@rm -f bootstrap/cache/*.php && docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:7.4-cli
phpstan-analyze-src:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze src -c phpstan.src.neon.dist
phpstan-analyze-tests:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:7.4-cli analyze tests -c phpstan.tests.neon.dist
psalm-analyze:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli
psalm-show-info:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm .phar--rm registry.gitlab.com/grahamcampbell/php:7.4-cli --show-info=true
test: phpunit phpstan-analyze-src phpstan-analyze-tests psalm-analyze
clean:
@rm -rf .phpunit.result.cache composer.lock vendor vendor-bin/*/composer.lock vendor-bin/*/vendor

View File

@ -0,0 +1,43 @@
{
"name": "phpoption/phpoption",
"description": "Option Type for PHP",
"keywords": ["php", "option", "language", "type"],
"license": "Apache-2.0",
"authors": [
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com"
},
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk"
}
],
"require": {
"php": "^7.0 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^6.5.14 || ^7.0.20 || ^8.5.19 || ^9.5.8"
},
"autoload": {
"psr-4": {
"PhpOption\\": "src/PhpOption/"
}
},
"autoload-dev": {
"psr-4": {
"PhpOption\\Tests\\": "tests/PhpOption/Tests/"
}
},
"config": {
"preferred-install": "dist"
},
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

View File

@ -0,0 +1,170 @@
<?php
/*
* Copyright 2012 Johannes M. Schmitt <schmittjoh@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace PhpOption;
/**
* @template T
*
* @extends Option<T>
*/
final class LazyOption extends Option
{
/** @var callable(mixed...):(Option<T>) */
private $callback;
/** @var array<int, mixed> */
private $arguments;
/** @var Option<T>|null */
private $option;
/**
* @template S
* @param callable(mixed...):(Option<S>) $callback
* @param array<int, mixed> $arguments
*
* @return LazyOption<S>
*/
public static function create($callback, array $arguments = []): self
{
return new self($callback, $arguments);
}
/**
* @param callable(mixed...):(Option<T>) $callback
* @param array<int, mixed> $arguments
*/
public function __construct($callback, array $arguments = [])
{
if (!is_callable($callback)) {
throw new \InvalidArgumentException('Invalid callback given');
}
$this->callback = $callback;
$this->arguments = $arguments;
}
public function isDefined(): bool
{
return $this->option()->isDefined();
}
public function isEmpty(): bool
{
return $this->option()->isEmpty();
}
public function get()
{
return $this->option()->get();
}
public function getOrElse($default)
{
return $this->option()->getOrElse($default);
}
public function getOrCall($callable)
{
return $this->option()->getOrCall($callable);
}
public function getOrThrow(\Exception $ex)
{
return $this->option()->getOrThrow($ex);
}
public function orElse(Option $else)
{
return $this->option()->orElse($else);
}
public function ifDefined($callable)
{
$this->option()->forAll($callable);
}
public function forAll($callable)
{
return $this->option()->forAll($callable);
}
public function map($callable)
{
return $this->option()->map($callable);
}
public function flatMap($callable)
{
return $this->option()->flatMap($callable);
}
public function filter($callable)
{
return $this->option()->filter($callable);
}
public function filterNot($callable)
{
return $this->option()->filterNot($callable);
}
public function select($value)
{
return $this->option()->select($value);
}
public function reject($value)
{
return $this->option()->reject($value);
}
public function getIterator()
{
return $this->option()->getIterator();
}
public function foldLeft($initialValue, $callable)
{
return $this->option()->foldLeft($initialValue, $callable);
}
public function foldRight($initialValue, $callable)
{
return $this->option()->foldRight($initialValue, $callable);
}
/**
* @return Option<T>
*/
private function option(): Option
{
if (null === $this->option) {
/** @var mixed */
$option = call_user_func_array($this->callback, $this->arguments);
if ($option instanceof Option) {
$this->option = $option;
} else {
throw new \RuntimeException(sprintf('Expected instance of %s', Option::class));
}
}
return $this->option;
}
}

View File

@ -0,0 +1,136 @@
<?php
/*
* Copyright 2012 Johannes M. Schmitt <schmittjoh@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace PhpOption;
use EmptyIterator;
/**
* @extends Option<mixed>
*/
final class None extends Option
{
/** @var None|null */
private static $instance;
/**
* @return None
*/
public static function create(): self
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
public function get()
{
throw new \RuntimeException('None has no value.');
}
public function getOrCall($callable)
{
return $callable();
}
public function getOrElse($default)
{
return $default;
}
public function getOrThrow(\Exception $ex)
{
throw $ex;
}
public function isEmpty(): bool
{
return true;
}
public function isDefined(): bool
{
return false;
}
public function orElse(Option $else)
{
return $else;
}
public function ifDefined($callable)
{
// Just do nothing in that case.
}
public function forAll($callable)
{
return $this;
}
public function map($callable)
{
return $this;
}
public function flatMap($callable)
{
return $this;
}
public function filter($callable)
{
return $this;
}
public function filterNot($callable)
{
return $this;
}
public function select($value)
{
return $this;
}
public function reject($value)
{
return $this;
}
public function getIterator(): EmptyIterator
{
return new EmptyIterator();
}
public function foldLeft($initialValue, $callable)
{
return $initialValue;
}
public function foldRight($initialValue, $callable)
{
return $initialValue;
}
private function __construct()
{
}
}

View File

@ -0,0 +1,434 @@
<?php
/*
* Copyright 2012 Johannes M. Schmitt <schmittjoh@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace PhpOption;
use ArrayAccess;
use IteratorAggregate;
/**
* @template T
*
* @implements IteratorAggregate<T>
*/
abstract class Option implements IteratorAggregate
{
/**
* Creates an option given a return value.
*
* This is intended for consuming existing APIs and allows you to easily
* convert them to an option. By default, we treat ``null`` as the None
* case, and everything else as Some.
*
* @template S
*
* @param S $value The actual return value.
* @param S $noneValue The value which should be considered "None"; null by
* default.
*
* @return Option<S>
*/
public static function fromValue($value, $noneValue = null)
{
if ($value === $noneValue) {
return None::create();
}
return new Some($value);
}
/**
* Creates an option from an array's value.
*
* If the key does not exist in the array, the array is not actually an
* array, or the array's value at the given key is null, None is returned.
* Otherwise, Some is returned wrapping the value at the given key.
*
* @template S
*
* @param array<string|int,S>|ArrayAccess<string|int,S>|null $array A potential array or \ArrayAccess value.
* @param string $key The key to check.
*
* @return Option<S>
*/
public static function fromArraysValue($array, $key)
{
if (!(is_array($array) || $array instanceof ArrayAccess) || !isset($array[$key])) {
return None::create();
}
return new Some($array[$key]);
}
/**
* Creates a lazy-option with the given callback.
*
* This is also a helper constructor for lazy-consuming existing APIs where
* the return value is not yet an option. By default, we treat ``null`` as
* None case, and everything else as Some.
*
* @template S
*
* @param callable $callback The callback to evaluate.
* @param array $arguments The arguments for the callback.
* @param S $noneValue The value which should be considered "None";
* null by default.
*
* @return LazyOption<S>
*/
public static function fromReturn($callback, array $arguments = [], $noneValue = null)
{
return new LazyOption(static function () use ($callback, $arguments, $noneValue) {
/** @var mixed */
$return = call_user_func_array($callback, $arguments);
if ($return === $noneValue) {
return None::create();
}
return new Some($return);
});
}
/**
* Option factory, which creates new option based on passed value.
*
* If value is already an option, it simply returns. If value is callable,
* LazyOption with passed callback created and returned. If Option
* returned from callback, it returns directly. On other case value passed
* to Option::fromValue() method.
*
* @template S
*
* @param Option<S>|callable|S $value
* @param S $noneValue Used when $value is mixed or
* callable, for None-check.
*
* @return Option<S>|LazyOption<S>
*/
public static function ensure($value, $noneValue = null)
{
if ($value instanceof self) {
return $value;
} elseif (is_callable($value)) {
return new LazyOption(static function () use ($value, $noneValue) {
/** @var mixed */
$return = $value();
if ($return instanceof self) {
return $return;
} else {
return self::fromValue($return, $noneValue);
}
});
} else {
return self::fromValue($value, $noneValue);
}
}
/**
* Lift a function so that it accepts Option as parameters.
*
* We return a new closure that wraps the original callback. If any of the
* parameters passed to the lifted function is empty, the function will
* return a value of None. Otherwise, we will pass all parameters to the
* original callback and return the value inside a new Option, unless an
* Option is returned from the function, in which case, we use that.
*
* @template S
*
* @param callable $callback
* @param mixed $noneValue
*
* @return callable
*/
public static function lift($callback, $noneValue = null)
{
return static function () use ($callback, $noneValue) {
/** @var array<int, mixed> */
$args = func_get_args();
$reduced_args = array_reduce(
$args,
/** @param bool $status */
static function ($status, self $o) {
return $o->isEmpty() ? true : $status;
},
false
);
// if at least one parameter is empty, return None
if ($reduced_args) {
return None::create();
}
$args = array_map(
/** @return T */
static function (self $o) {
// it is safe to do so because the fold above checked
// that all arguments are of type Some
/** @var T */
return $o->get();
},
$args
);
return self::ensure(call_user_func_array($callback, $args), $noneValue);
};
}
/**
* Returns the value if available, or throws an exception otherwise.
*
* @throws \RuntimeException If value is not available.
*
* @return T
*/
abstract public function get();
/**
* Returns the value if available, or the default value if not.
*
* @template S
*
* @param S $default
*
* @return T|S
*/
abstract public function getOrElse($default);
/**
* Returns the value if available, or the results of the callable.
*
* This is preferable over ``getOrElse`` if the computation of the default
* value is expensive.
*
* @template S
*
* @param callable():S $callable
*
* @return T|S
*/
abstract public function getOrCall($callable);
/**
* Returns the value if available, or throws the passed exception.
*
* @param \Exception $ex
*
* @return T
*/
abstract public function getOrThrow(\Exception $ex);
/**
* Returns true if no value is available, false otherwise.
*
* @return bool
*/
abstract public function isEmpty();
/**
* Returns true if a value is available, false otherwise.
*
* @return bool
*/
abstract public function isDefined();
/**
* Returns this option if non-empty, or the passed option otherwise.
*
* This can be used to try multiple alternatives, and is especially useful
* with lazy evaluating options:
*
* ```php
* $repo->findSomething()
* ->orElse(new LazyOption(array($repo, 'findSomethingElse')))
* ->orElse(new LazyOption(array($repo, 'createSomething')));
* ```
*
* @param Option<T> $else
*
* @return Option<T>
*/
abstract public function orElse(self $else);
/**
* This is similar to map() below except that the return value has no meaning;
* the passed callable is simply executed if the option is non-empty, and
* ignored if the option is empty.
*
* In all cases, the return value of the callable is discarded.
*
* ```php
* $comment->getMaybeFile()->ifDefined(function($file) {
* // Do something with $file here.
* });
* ```
*
* If you're looking for something like ``ifEmpty``, you can use ``getOrCall``
* and ``getOrElse`` in these cases.
*
* @deprecated Use forAll() instead.
*
* @param callable(T):mixed $callable
*
* @return void
*/
abstract public function ifDefined($callable);
/**
* This is similar to map() except that the return value of the callable has no meaning.
*
* The passed callable is simply executed if the option is non-empty, and ignored if the
* option is empty. This method is preferred for callables with side-effects, while map()
* is intended for callables without side-effects.
*
* @param callable(T):mixed $callable
*
* @return Option<T>
*/
abstract public function forAll($callable);
/**
* Applies the callable to the value of the option if it is non-empty,
* and returns the return value of the callable wrapped in Some().
*
* If the option is empty, then the callable is not applied.
*
* ```php
* (new Some("foo"))->map('strtoupper')->get(); // "FOO"
* ```
*
* @template S
*
* @param callable(T):S $callable
*
* @return Option<S>
*/
abstract public function map($callable);
/**
* Applies the callable to the value of the option if it is non-empty, and
* returns the return value of the callable directly.
*
* In contrast to ``map``, the return value of the callable is expected to
* be an Option itself; it is not automatically wrapped in Some().
*
* @template S
*
* @param callable(T):Option<S> $callable must return an Option
*
* @return Option<S>
*/
abstract public function flatMap($callable);
/**
* If the option is empty, it is returned immediately without applying the callable.
*
* If the option is non-empty, the callable is applied, and if it returns true,
* the option itself is returned; otherwise, None is returned.
*
* @param callable(T):bool $callable
*
* @return Option<T>
*/
abstract public function filter($callable);
/**
* If the option is empty, it is returned immediately without applying the callable.
*
* If the option is non-empty, the callable is applied, and if it returns false,
* the option itself is returned; otherwise, None is returned.
*
* @param callable(T):bool $callable
*
* @return Option<T>
*/
abstract public function filterNot($callable);
/**
* If the option is empty, it is returned immediately.
*
* If the option is non-empty, and its value does not equal the passed value
* (via a shallow comparison ===), then None is returned. Otherwise, the
* Option is returned.
*
* In other words, this will filter all but the passed value.
*
* @param T $value
*
* @return Option<T>
*/
abstract public function select($value);
/**
* If the option is empty, it is returned immediately.
*
* If the option is non-empty, and its value does equal the passed value (via
* a shallow comparison ===), then None is returned; otherwise, the Option is
* returned.
*
* In other words, this will let all values through except the passed value.
*
* @param T $value
*
* @return Option<T>
*/
abstract public function reject($value);
/**
* Binary operator for the initial value and the option's value.
*
* If empty, the initial value is returned. If non-empty, the callable
* receives the initial value and the option's value as arguments.
*
* ```php
*
* $some = new Some(5);
* $none = None::create();
* $result = $some->foldLeft(1, function($a, $b) { return $a + $b; }); // int(6)
* $result = $none->foldLeft(1, function($a, $b) { return $a + $b; }); // int(1)
*
* // This can be used instead of something like the following:
* $option = Option::fromValue($integerOrNull);
* $result = 1;
* if ( ! $option->isEmpty()) {
* $result += $option->get();
* }
* ```
*
* @template S
*
* @param S $initialValue
* @param callable(S, T):S $callable
*
* @return S
*/
abstract public function foldLeft($initialValue, $callable);
/**
* foldLeft() but with reversed arguments for the callable.
*
* @template S
*
* @param S $initialValue
* @param callable(T, S):S $callable
*
* @return S
*/
abstract public function foldRight($initialValue, $callable);
}

View File

@ -0,0 +1,166 @@
<?php
/*
* Copyright 2012 Johannes M. Schmitt <schmittjoh@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace PhpOption;
use ArrayIterator;
/**
* @template T
*
* @extends Option<T>
*/
final class Some extends Option
{
/** @var T */
private $value;
/**
* @param T $value
*/
public function __construct($value)
{
$this->value = $value;
}
/**
* @template U
*
* @param U $value
*
* @return Some<U>
*/
public static function create($value): self
{
return new self($value);
}
public function isDefined(): bool
{
return true;
}
public function isEmpty(): bool
{
return false;
}
public function get()
{
return $this->value;
}
public function getOrElse($default)
{
return $this->value;
}
public function getOrCall($callable)
{
return $this->value;
}
public function getOrThrow(\Exception $ex)
{
return $this->value;
}
public function orElse(Option $else)
{
return $this;
}
public function ifDefined($callable)
{
$this->forAll($callable);
}
public function forAll($callable)
{
$callable($this->value);
return $this;
}
public function map($callable)
{
return new self($callable($this->value));
}
public function flatMap($callable)
{
/** @var mixed */
$rs = $callable($this->value);
if (!$rs instanceof Option) {
throw new \RuntimeException('Callables passed to flatMap() must return an Option. Maybe you should use map() instead?');
}
return $rs;
}
public function filter($callable)
{
if (true === $callable($this->value)) {
return $this;
}
return None::create();
}
public function filterNot($callable)
{
if (false === $callable($this->value)) {
return $this;
}
return None::create();
}
public function select($value)
{
if ($this->value === $value) {
return $this;
}
return None::create();
}
public function reject($value)
{
if ($this->value === $value) {
return None::create();
}
return $this;
}
public function getIterator(): ArrayIterator
{
return new ArrayIterator([$this->value]);
}
public function foldLeft($initialValue, $callable)
{
return $callable($initialValue, $this->value);
}
public function foldRight($initialValue, $callable)
{
return $callable($this->value, $initialValue);
}
}

227
vendor/symfony/polyfill-ctype/Ctype.php vendored Normal file
View File

@ -0,0 +1,227 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Polyfill\Ctype;
/**
* Ctype implementation through regex.
*
* @internal
*
* @author Gert de Pagter <BackEndTea@gmail.com>
*/
final class Ctype
{
/**
* Returns TRUE if every character in text is either a letter or a digit, FALSE otherwise.
*
* @see https://php.net/ctype-alnum
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_alnum($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
}
/**
* Returns TRUE if every character in text is a letter, FALSE otherwise.
*
* @see https://php.net/ctype-alpha
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_alpha($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
}
/**
* Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise.
*
* @see https://php.net/ctype-cntrl
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_cntrl($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
}
/**
* Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise.
*
* @see https://php.net/ctype-digit
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_digit($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
}
/**
* Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise.
*
* @see https://php.net/ctype-graph
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_graph($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
}
/**
* Returns TRUE if every character in text is a lowercase letter.
*
* @see https://php.net/ctype-lower
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_lower($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
}
/**
* Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all.
*
* @see https://php.net/ctype-print
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_print($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
}
/**
* Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise.
*
* @see https://php.net/ctype-punct
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_punct($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
}
/**
* Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters.
*
* @see https://php.net/ctype-space
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_space($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
}
/**
* Returns TRUE if every character in text is an uppercase letter.
*
* @see https://php.net/ctype-upper
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_upper($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
}
/**
* Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise.
*
* @see https://php.net/ctype-xdigit
*
* @param string|int $text
*
* @return bool
*/
public static function ctype_xdigit($text)
{
$text = self::convert_int_to_char_for_ctype($text);
return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
}
/**
* Converts integers to their char versions according to normal ctype behaviour, if needed.
*
* If an integer between -128 and 255 inclusive is provided,
* it is interpreted as the ASCII value of a single character
* (negative values have 256 added in order to allow characters in the Extended ASCII range).
* Any other integer is interpreted as a string containing the decimal digits of the integer.
*
* @param string|int $int
*
* @return mixed
*/
private static function convert_int_to_char_for_ctype($int)
{
if (!\is_int($int)) {
return $int;
}
if ($int < -128 || $int > 255) {
return (string) $int;
}
if ($int < 0) {
$int += 256;
}
return \chr($int);
}
}

19
vendor/symfony/polyfill-ctype/LICENSE vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2018-2019 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

12
vendor/symfony/polyfill-ctype/README.md vendored Normal file
View File

@ -0,0 +1,12 @@
Symfony Polyfill / Ctype
========================
This component provides `ctype_*` functions to users who run php versions without the ctype extension.
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
License
=======
This library is released under the [MIT license](LICENSE).

View File

@ -0,0 +1,50 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Ctype as p;
if (\PHP_VERSION_ID >= 80000) {
return require __DIR__.'/bootstrap80.php';
}
if (!function_exists('ctype_alnum')) {
function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
}
if (!function_exists('ctype_alpha')) {
function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
}
if (!function_exists('ctype_cntrl')) {
function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
}
if (!function_exists('ctype_digit')) {
function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
}
if (!function_exists('ctype_graph')) {
function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
}
if (!function_exists('ctype_lower')) {
function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
}
if (!function_exists('ctype_print')) {
function ctype_print($text) { return p\Ctype::ctype_print($text); }
}
if (!function_exists('ctype_punct')) {
function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
}
if (!function_exists('ctype_space')) {
function ctype_space($text) { return p\Ctype::ctype_space($text); }
}
if (!function_exists('ctype_upper')) {
function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
}
if (!function_exists('ctype_xdigit')) {
function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
}

View File

@ -0,0 +1,46 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Ctype as p;
if (!function_exists('ctype_alnum')) {
function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); }
}
if (!function_exists('ctype_alpha')) {
function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); }
}
if (!function_exists('ctype_cntrl')) {
function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); }
}
if (!function_exists('ctype_digit')) {
function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); }
}
if (!function_exists('ctype_graph')) {
function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); }
}
if (!function_exists('ctype_lower')) {
function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); }
}
if (!function_exists('ctype_print')) {
function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); }
}
if (!function_exists('ctype_punct')) {
function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); }
}
if (!function_exists('ctype_space')) {
function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); }
}
if (!function_exists('ctype_upper')) {
function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); }
}
if (!function_exists('ctype_xdigit')) {
function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); }
}

View File

@ -0,0 +1,38 @@
{
"name": "symfony/polyfill-ctype",
"type": "library",
"description": "Symfony polyfill for ctype functions",
"keywords": ["polyfill", "compatibility", "portable", "ctype"],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"require": {
"php": ">=7.1"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Ctype\\": "" },
"files": [ "bootstrap.php" ]
},
"suggest": {
"ext-ctype": "For best performance"
},
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
}
}

View File

@ -0,0 +1,19 @@
Copyright (c) 2015-2019 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,870 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Polyfill\Mbstring;
/**
* Partial mbstring implementation in PHP, iconv based, UTF-8 centric.
*
* Implemented:
* - mb_chr - Returns a specific character from its Unicode code point
* - mb_convert_encoding - Convert character encoding
* - mb_convert_variables - Convert character code in variable(s)
* - mb_decode_mimeheader - Decode string in MIME header field
* - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED
* - mb_decode_numericentity - Decode HTML numeric string reference to character
* - mb_encode_numericentity - Encode character to HTML numeric string reference
* - mb_convert_case - Perform case folding on a string
* - mb_detect_encoding - Detect character encoding
* - mb_get_info - Get internal settings of mbstring
* - mb_http_input - Detect HTTP input character encoding
* - mb_http_output - Set/Get HTTP output character encoding
* - mb_internal_encoding - Set/Get internal character encoding
* - mb_list_encodings - Returns an array of all supported encodings
* - mb_ord - Returns the Unicode code point of a character
* - mb_output_handler - Callback function converts character encoding in output buffer
* - mb_scrub - Replaces ill-formed byte sequences with substitute characters
* - mb_strlen - Get string length
* - mb_strpos - Find position of first occurrence of string in a string
* - mb_strrpos - Find position of last occurrence of a string in a string
* - mb_str_split - Convert a string to an array
* - mb_strtolower - Make a string lowercase
* - mb_strtoupper - Make a string uppercase
* - mb_substitute_character - Set/Get substitution character
* - mb_substr - Get part of string
* - mb_stripos - Finds position of first occurrence of a string within another, case insensitive
* - mb_stristr - Finds first occurrence of a string within another, case insensitive
* - mb_strrchr - Finds the last occurrence of a character in a string within another
* - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive
* - mb_strripos - Finds position of last occurrence of a string within another, case insensitive
* - mb_strstr - Finds first occurrence of a string within another
* - mb_strwidth - Return width of string
* - mb_substr_count - Count the number of substring occurrences
*
* Not implemented:
* - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more)
* - mb_ereg_* - Regular expression with multibyte support
* - mb_parse_str - Parse GET/POST/COOKIE data and set global variable
* - mb_preferred_mime_name - Get MIME charset string
* - mb_regex_encoding - Returns current encoding for multibyte regex as string
* - mb_regex_set_options - Set/Get the default options for mbregex functions
* - mb_send_mail - Send encoded mail
* - mb_split - Split multibyte string using regular expression
* - mb_strcut - Get part of string
* - mb_strimwidth - Get truncated string with specified width
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class Mbstring
{
public const MB_CASE_FOLD = \PHP_INT_MAX;
private const CASE_FOLD = [
['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'],
];
private static $encodingList = ['ASCII', 'UTF-8'];
private static $language = 'neutral';
private static $internalEncoding = 'UTF-8';
public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
{
if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
$fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
} else {
$fromEncoding = self::getEncoding($fromEncoding);
}
$toEncoding = self::getEncoding($toEncoding);
if ('BASE64' === $fromEncoding) {
$s = base64_decode($s);
$fromEncoding = $toEncoding;
}
if ('BASE64' === $toEncoding) {
return base64_encode($s);
}
if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
$fromEncoding = 'Windows-1252';
}
if ('UTF-8' !== $fromEncoding) {
$s = \iconv($fromEncoding, 'UTF-8//IGNORE', $s);
}
return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s);
}
if ('HTML-ENTITIES' === $fromEncoding) {
$s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8');
$fromEncoding = 'UTF-8';
}
return \iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
}
public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars)
{
$ok = true;
array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
$ok = false;
}
});
return $ok ? $fromEncoding : false;
}
public static function mb_decode_mimeheader($s)
{
return \iconv_mime_decode($s, 2, self::$internalEncoding);
}
public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
{
trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING);
}
public static function mb_decode_numericentity($s, $convmap, $encoding = null)
{
if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
return null;
}
if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
return false;
}
if (null !== $encoding && !is_scalar($encoding)) {
trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
return ''; // Instead of null (cf. mb_encode_numericentity).
}
$s = (string) $s;
if ('' === $s) {
return '';
}
$encoding = self::getEncoding($encoding);
if ('UTF-8' === $encoding) {
$encoding = null;
if (!preg_match('//u', $s)) {
$s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
}
} else {
$s = \iconv($encoding, 'UTF-8//IGNORE', $s);
}
$cnt = floor(\count($convmap) / 4) * 4;
for ($i = 0; $i < $cnt; $i += 4) {
// collector_decode_htmlnumericentity ignores $convmap[$i + 3]
$convmap[$i] += $convmap[$i + 2];
$convmap[$i + 1] += $convmap[$i + 2];
}
$s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
$c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
for ($i = 0; $i < $cnt; $i += 4) {
if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
return self::mb_chr($c - $convmap[$i + 2]);
}
}
return $m[0];
}, $s);
if (null === $encoding) {
return $s;
}
return \iconv('UTF-8', $encoding.'//IGNORE', $s);
}
public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
{
if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
return null;
}
if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
return false;
}
if (null !== $encoding && !is_scalar($encoding)) {
trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
return null; // Instead of '' (cf. mb_decode_numericentity).
}
if (null !== $is_hex && !is_scalar($is_hex)) {
trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING);
return null;
}
$s = (string) $s;
if ('' === $s) {
return '';
}
$encoding = self::getEncoding($encoding);
if ('UTF-8' === $encoding) {
$encoding = null;
if (!preg_match('//u', $s)) {
$s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
}
} else {
$s = \iconv($encoding, 'UTF-8//IGNORE', $s);
}
static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
$cnt = floor(\count($convmap) / 4) * 4;
$i = 0;
$len = \strlen($s);
$result = '';
while ($i < $len) {
$ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
$uchr = substr($s, $i, $ulen);
$i += $ulen;
$c = self::mb_ord($uchr);
for ($j = 0; $j < $cnt; $j += 4) {
if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
$cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
$result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
continue 2;
}
}
$result .= $uchr;
}
if (null === $encoding) {
return $result;
}
return \iconv('UTF-8', $encoding.'//IGNORE', $result);
}
public static function mb_convert_case($s, $mode, $encoding = null)
{
$s = (string) $s;
if ('' === $s) {
return '';
}
$encoding = self::getEncoding($encoding);
if ('UTF-8' === $encoding) {
$encoding = null;
if (!preg_match('//u', $s)) {
$s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
}
} else {
$s = \iconv($encoding, 'UTF-8//IGNORE', $s);
}
if (\MB_CASE_TITLE == $mode) {
static $titleRegexp = null;
if (null === $titleRegexp) {
$titleRegexp = self::getData('titleCaseRegexp');
}
$s = preg_replace_callback($titleRegexp, [__CLASS__, 'title_case'], $s);
} else {
if (\MB_CASE_UPPER == $mode) {
static $upper = null;
if (null === $upper) {
$upper = self::getData('upperCase');
}
$map = $upper;
} else {
if (self::MB_CASE_FOLD === $mode) {
$s = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $s);
}
static $lower = null;
if (null === $lower) {
$lower = self::getData('lowerCase');
}
$map = $lower;
}
static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
$i = 0;
$len = \strlen($s);
while ($i < $len) {
$ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
$uchr = substr($s, $i, $ulen);
$i += $ulen;
if (isset($map[$uchr])) {
$uchr = $map[$uchr];
$nlen = \strlen($uchr);
if ($nlen == $ulen) {
$nlen = $i;
do {
$s[--$nlen] = $uchr[--$ulen];
} while ($ulen);
} else {
$s = substr_replace($s, $uchr, $i - $ulen, $ulen);
$len += $nlen - $ulen;
$i += $nlen - $ulen;
}
}
}
}
if (null === $encoding) {
return $s;
}
return \iconv('UTF-8', $encoding.'//IGNORE', $s);
}
public static function mb_internal_encoding($encoding = null)
{
if (null === $encoding) {
return self::$internalEncoding;
}
$normalizedEncoding = self::getEncoding($encoding);
if ('UTF-8' === $normalizedEncoding || false !== @\iconv($normalizedEncoding, $normalizedEncoding, ' ')) {
self::$internalEncoding = $normalizedEncoding;
return true;
}
if (80000 > \PHP_VERSION_ID) {
return false;
}
throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding));
}
public static function mb_language($lang = null)
{
if (null === $lang) {
return self::$language;
}
switch ($normalizedLang = strtolower($lang)) {
case 'uni':
case 'neutral':
self::$language = $normalizedLang;
return true;
}
if (80000 > \PHP_VERSION_ID) {
return false;
}
throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang));
}
public static function mb_list_encodings()
{
return ['UTF-8'];
}
public static function mb_encoding_aliases($encoding)
{
switch (strtoupper($encoding)) {
case 'UTF8':
case 'UTF-8':
return ['utf8'];
}
return false;
}
public static function mb_check_encoding($var = null, $encoding = null)
{
if (null === $encoding) {
if (null === $var) {
return false;
}
$encoding = self::$internalEncoding;
}
return self::mb_detect_encoding($var, [$encoding]) || false !== @\iconv($encoding, $encoding, $var);
}
public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
{
if (null === $encodingList) {
$encodingList = self::$encodingList;
} else {
if (!\is_array($encodingList)) {
$encodingList = array_map('trim', explode(',', $encodingList));
}
$encodingList = array_map('strtoupper', $encodingList);
}
foreach ($encodingList as $enc) {
switch ($enc) {
case 'ASCII':
if (!preg_match('/[\x80-\xFF]/', $str)) {
return $enc;
}
break;
case 'UTF8':
case 'UTF-8':
if (preg_match('//u', $str)) {
return 'UTF-8';
}
break;
default:
if (0 === strncmp($enc, 'ISO-8859-', 9)) {
return $enc;
}
}
}
return false;
}
public static function mb_detect_order($encodingList = null)
{
if (null === $encodingList) {
return self::$encodingList;
}
if (!\is_array($encodingList)) {
$encodingList = array_map('trim', explode(',', $encodingList));
}
$encodingList = array_map('strtoupper', $encodingList);
foreach ($encodingList as $enc) {
switch ($enc) {
default:
if (strncmp($enc, 'ISO-8859-', 9)) {
return false;
}
// no break
case 'ASCII':
case 'UTF8':
case 'UTF-8':
}
}
self::$encodingList = $encodingList;
return true;
}
public static function mb_strlen($s, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return \strlen($s);
}
return @\iconv_strlen($s, $encoding);
}
public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return strpos($haystack, $needle, $offset);
}
$needle = (string) $needle;
if ('' === $needle) {
if (80000 > \PHP_VERSION_ID) {
trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING);
return false;
}
return 0;
}
return \iconv_strpos($haystack, $needle, $offset, $encoding);
}
public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return strrpos($haystack, $needle, $offset);
}
if ($offset != (int) $offset) {
$offset = 0;
} elseif ($offset = (int) $offset) {
if ($offset < 0) {
if (0 > $offset += self::mb_strlen($needle)) {
$haystack = self::mb_substr($haystack, 0, $offset, $encoding);
}
$offset = 0;
} else {
$haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
}
}
$pos = '' !== $needle || 80000 > \PHP_VERSION_ID
? \iconv_strrpos($haystack, $needle, $encoding)
: self::mb_strlen($haystack, $encoding);
return false !== $pos ? $offset + $pos : false;
}
public static function mb_str_split($string, $split_length = 1, $encoding = null)
{
if (null !== $string && !is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) {
trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING);
return null;
}
if (1 > $split_length = (int) $split_length) {
if (80000 > \PHP_VERSION_ID) {
trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING);
return false;
}
throw new \ValueError('Argument #2 ($length) must be greater than 0');
}
if (null === $encoding) {
$encoding = mb_internal_encoding();
}
if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
$rx = '/(';
while (65535 < $split_length) {
$rx .= '.{65535}';
$split_length -= 65535;
}
$rx .= '.{'.$split_length.'})/us';
return preg_split($rx, $string, null, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY);
}
$result = [];
$length = mb_strlen($string, $encoding);
for ($i = 0; $i < $length; $i += $split_length) {
$result[] = mb_substr($string, $i, $split_length, $encoding);
}
return $result;
}
public static function mb_strtolower($s, $encoding = null)
{
return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding);
}
public static function mb_strtoupper($s, $encoding = null)
{
return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding);
}
public static function mb_substitute_character($c = null)
{
if (null === $c) {
return 'none';
}
if (0 === strcasecmp($c, 'none')) {
return true;
}
if (80000 > \PHP_VERSION_ID) {
return false;
}
throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint');
}
public static function mb_substr($s, $start, $length = null, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return (string) substr($s, $start, null === $length ? 2147483647 : $length);
}
if ($start < 0) {
$start = \iconv_strlen($s, $encoding) + $start;
if ($start < 0) {
$start = 0;
}
}
if (null === $length) {
$length = 2147483647;
} elseif ($length < 0) {
$length = \iconv_strlen($s, $encoding) + $length - $start;
if ($length < 0) {
return '';
}
}
return (string) \iconv_substr($s, $start, $length, $encoding);
}
public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
{
$haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
$needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
return self::mb_strpos($haystack, $needle, $offset, $encoding);
}
public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
{
$pos = self::mb_stripos($haystack, $needle, 0, $encoding);
return self::getSubpart($pos, $part, $haystack, $encoding);
}
public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
$pos = strrpos($haystack, $needle);
} else {
$needle = self::mb_substr($needle, 0, 1, $encoding);
$pos = \iconv_strrpos($haystack, $needle, $encoding);
}
return self::getSubpart($pos, $part, $haystack, $encoding);
}
public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
{
$needle = self::mb_substr($needle, 0, 1, $encoding);
$pos = self::mb_strripos($haystack, $needle, $encoding);
return self::getSubpart($pos, $part, $haystack, $encoding);
}
public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
{
$haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
$needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
return self::mb_strrpos($haystack, $needle, $offset, $encoding);
}
public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
{
$pos = strpos($haystack, $needle);
if (false === $pos) {
return false;
}
if ($part) {
return substr($haystack, 0, $pos);
}
return substr($haystack, $pos);
}
public static function mb_get_info($type = 'all')
{
$info = [
'internal_encoding' => self::$internalEncoding,
'http_output' => 'pass',
'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
'func_overload' => 0,
'func_overload_list' => 'no overload',
'mail_charset' => 'UTF-8',
'mail_header_encoding' => 'BASE64',
'mail_body_encoding' => 'BASE64',
'illegal_chars' => 0,
'encoding_translation' => 'Off',
'language' => self::$language,
'detect_order' => self::$encodingList,
'substitute_character' => 'none',
'strict_detection' => 'Off',
];
if ('all' === $type) {
return $info;
}
if (isset($info[$type])) {
return $info[$type];
}
return false;
}
public static function mb_http_input($type = '')
{
return false;
}
public static function mb_http_output($encoding = null)
{
return null !== $encoding ? 'pass' === $encoding : 'pass';
}
public static function mb_strwidth($s, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('UTF-8' !== $encoding) {
$s = \iconv($encoding, 'UTF-8//IGNORE', $s);
}
$s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
return ($wide << 1) + \iconv_strlen($s, 'UTF-8');
}
public static function mb_substr_count($haystack, $needle, $encoding = null)
{
return substr_count($haystack, $needle);
}
public static function mb_output_handler($contents, $status)
{
return $contents;
}
public static function mb_chr($code, $encoding = null)
{
if (0x80 > $code %= 0x200000) {
$s = \chr($code);
} elseif (0x800 > $code) {
$s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
} elseif (0x10000 > $code) {
$s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
} else {
$s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
}
if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
$s = mb_convert_encoding($s, $encoding, 'UTF-8');
}
return $s;
}
public static function mb_ord($s, $encoding = null)
{
if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
$s = mb_convert_encoding($s, 'UTF-8', $encoding);
}
if (1 === \strlen($s)) {
return \ord($s);
}
$code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
if (0xF0 <= $code) {
return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
}
if (0xE0 <= $code) {
return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
}
if (0xC0 <= $code) {
return (($code - 0xC0) << 6) + $s[2] - 0x80;
}
return $code;
}
private static function getSubpart($pos, $part, $haystack, $encoding)
{
if (false === $pos) {
return false;
}
if ($part) {
return self::mb_substr($haystack, 0, $pos, $encoding);
}
return self::mb_substr($haystack, $pos, null, $encoding);
}
private static function html_encoding_callback(array $m)
{
$i = 1;
$entities = '';
$m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8'));
while (isset($m[$i])) {
if (0x80 > $m[$i]) {
$entities .= \chr($m[$i++]);
continue;
}
if (0xF0 <= $m[$i]) {
$c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
} elseif (0xE0 <= $m[$i]) {
$c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
} else {
$c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
}
$entities .= '&#'.$c.';';
}
return $entities;
}
private static function title_case(array $s)
{
return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8');
}
private static function getData($file)
{
if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
return require $file;
}
return false;
}
private static function getEncoding($encoding)
{
if (null === $encoding) {
return self::$internalEncoding;
}
if ('UTF-8' === $encoding) {
return 'UTF-8';
}
$encoding = strtoupper($encoding);
if ('8BIT' === $encoding || 'BINARY' === $encoding) {
return 'CP850';
}
if ('UTF8' === $encoding) {
return 'UTF-8';
}
return $encoding;
}
}

View File

@ -0,0 +1,13 @@
Symfony Polyfill / Mbstring
===========================
This component provides a partial, native PHP implementation for the
[Mbstring](https://php.net/mbstring) extension.
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
License
=======
This library is released under the [MIT license](LICENSE).

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,147 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Mbstring as p;
if (\PHP_VERSION_ID >= 80000) {
return require __DIR__.'/bootstrap80.php';
}
if (!function_exists('mb_convert_encoding')) {
function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); }
}
if (!function_exists('mb_decode_mimeheader')) {
function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); }
}
if (!function_exists('mb_encode_mimeheader')) {
function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); }
}
if (!function_exists('mb_decode_numericentity')) {
function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); }
}
if (!function_exists('mb_encode_numericentity')) {
function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); }
}
if (!function_exists('mb_convert_case')) {
function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); }
}
if (!function_exists('mb_internal_encoding')) {
function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); }
}
if (!function_exists('mb_language')) {
function mb_language($language = null) { return p\Mbstring::mb_language($language); }
}
if (!function_exists('mb_list_encodings')) {
function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
}
if (!function_exists('mb_encoding_aliases')) {
function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
}
if (!function_exists('mb_check_encoding')) {
function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); }
}
if (!function_exists('mb_detect_encoding')) {
function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); }
}
if (!function_exists('mb_detect_order')) {
function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); }
}
if (!function_exists('mb_parse_str')) {
function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; }
}
if (!function_exists('mb_strlen')) {
function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); }
}
if (!function_exists('mb_strpos')) {
function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('mb_strtolower')) {
function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); }
}
if (!function_exists('mb_strtoupper')) {
function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); }
}
if (!function_exists('mb_substitute_character')) {
function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); }
}
if (!function_exists('mb_substr')) {
function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); }
}
if (!function_exists('mb_stripos')) {
function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('mb_stristr')) {
function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); }
}
if (!function_exists('mb_strrchr')) {
function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); }
}
if (!function_exists('mb_strrichr')) {
function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); }
}
if (!function_exists('mb_strripos')) {
function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('mb_strrpos')) {
function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('mb_strstr')) {
function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); }
}
if (!function_exists('mb_get_info')) {
function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
}
if (!function_exists('mb_http_output')) {
function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); }
}
if (!function_exists('mb_strwidth')) {
function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); }
}
if (!function_exists('mb_substr_count')) {
function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); }
}
if (!function_exists('mb_output_handler')) {
function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); }
}
if (!function_exists('mb_http_input')) {
function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); }
}
if (!function_exists('mb_convert_variables')) {
function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); }
}
if (!function_exists('mb_ord')) {
function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); }
}
if (!function_exists('mb_chr')) {
function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); }
}
if (!function_exists('mb_scrub')) {
function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); }
}
if (!function_exists('mb_str_split')) {
function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); }
}
if (extension_loaded('mbstring')) {
return;
}
if (!defined('MB_CASE_UPPER')) {
define('MB_CASE_UPPER', 0);
}
if (!defined('MB_CASE_LOWER')) {
define('MB_CASE_LOWER', 1);
}
if (!defined('MB_CASE_TITLE')) {
define('MB_CASE_TITLE', 2);
}

View File

@ -0,0 +1,143 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Mbstring as p;
if (!function_exists('mb_convert_encoding')) {
function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); }
}
if (!function_exists('mb_decode_mimeheader')) {
function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); }
}
if (!function_exists('mb_encode_mimeheader')) {
function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); }
}
if (!function_exists('mb_decode_numericentity')) {
function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); }
}
if (!function_exists('mb_encode_numericentity')) {
function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); }
}
if (!function_exists('mb_convert_case')) {
function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); }
}
if (!function_exists('mb_internal_encoding')) {
function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); }
}
if (!function_exists('mb_language')) {
function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); }
}
if (!function_exists('mb_list_encodings')) {
function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); }
}
if (!function_exists('mb_encoding_aliases')) {
function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); }
}
if (!function_exists('mb_check_encoding')) {
function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); }
}
if (!function_exists('mb_detect_encoding')) {
function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); }
}
if (!function_exists('mb_detect_order')) {
function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); }
}
if (!function_exists('mb_parse_str')) {
function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; }
}
if (!function_exists('mb_strlen')) {
function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); }
}
if (!function_exists('mb_strpos')) {
function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
}
if (!function_exists('mb_strtolower')) {
function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); }
}
if (!function_exists('mb_strtoupper')) {
function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); }
}
if (!function_exists('mb_substitute_character')) {
function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); }
}
if (!function_exists('mb_substr')) {
function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); }
}
if (!function_exists('mb_stripos')) {
function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
}
if (!function_exists('mb_stristr')) {
function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
}
if (!function_exists('mb_strrchr')) {
function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
}
if (!function_exists('mb_strrichr')) {
function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
}
if (!function_exists('mb_strripos')) {
function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
}
if (!function_exists('mb_strrpos')) {
function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
}
if (!function_exists('mb_strstr')) {
function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
}
if (!function_exists('mb_get_info')) {
function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); }
}
if (!function_exists('mb_http_output')) {
function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); }
}
if (!function_exists('mb_strwidth')) {
function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); }
}
if (!function_exists('mb_substr_count')) {
function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); }
}
if (!function_exists('mb_output_handler')) {
function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); }
}
if (!function_exists('mb_http_input')) {
function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); }
}
if (!function_exists('mb_convert_variables')) {
function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); }
}
if (!function_exists('mb_ord')) {
function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); }
}
if (!function_exists('mb_chr')) {
function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); }
}
if (!function_exists('mb_scrub')) {
function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); }
}
if (!function_exists('mb_str_split')) {
function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); }
}
if (extension_loaded('mbstring')) {
return;
}
if (!defined('MB_CASE_UPPER')) {
define('MB_CASE_UPPER', 0);
}
if (!defined('MB_CASE_LOWER')) {
define('MB_CASE_LOWER', 1);
}
if (!defined('MB_CASE_TITLE')) {
define('MB_CASE_TITLE', 2);
}

View File

@ -0,0 +1,38 @@
{
"name": "symfony/polyfill-mbstring",
"type": "library",
"description": "Symfony polyfill for the Mbstring extension",
"keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"require": {
"php": ">=7.1"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" },
"files": [ "bootstrap.php" ]
},
"suggest": {
"ext-mbstring": "For best performance"
},
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
}
}

19
vendor/symfony/polyfill-php80/LICENSE vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2020 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

105
vendor/symfony/polyfill-php80/Php80.php vendored Normal file
View File

@ -0,0 +1,105 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Polyfill\Php80;
/**
* @author Ion Bazan <ion.bazan@gmail.com>
* @author Nico Oelgart <nicoswd@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class Php80
{
public static function fdiv(float $dividend, float $divisor): float
{
return @($dividend / $divisor);
}
public static function get_debug_type($value): string
{
switch (true) {
case null === $value: return 'null';
case \is_bool($value): return 'bool';
case \is_string($value): return 'string';
case \is_array($value): return 'array';
case \is_int($value): return 'int';
case \is_float($value): return 'float';
case \is_object($value): break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if (null === $type = @get_resource_type($value)) {
return 'unknown';
}
if ('Unknown' === $type) {
$type = 'closed';
}
return "resource ($type)";
}
$class = \get_class($value);
if (false === strpos($class, '@')) {
return $class;
}
return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
}
public static function get_resource_id($res): int
{
if (!\is_resource($res) && null === @get_resource_type($res)) {
throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
}
return (int) $res;
}
public static function preg_last_error_msg(): string
{
switch (preg_last_error()) {
case \PREG_INTERNAL_ERROR:
return 'Internal error';
case \PREG_BAD_UTF8_ERROR:
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
case \PREG_BAD_UTF8_OFFSET_ERROR:
return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
case \PREG_BACKTRACK_LIMIT_ERROR:
return 'Backtrack limit exhausted';
case \PREG_RECURSION_LIMIT_ERROR:
return 'Recursion limit exhausted';
case \PREG_JIT_STACKLIMIT_ERROR:
return 'JIT stack limit exhausted';
case \PREG_NO_ERROR:
return 'No error';
default:
return 'Unknown error';
}
}
public static function str_contains(string $haystack, string $needle): bool
{
return '' === $needle || false !== strpos($haystack, $needle);
}
public static function str_starts_with(string $haystack, string $needle): bool
{
return 0 === strncmp($haystack, $needle, \strlen($needle));
}
public static function str_ends_with(string $haystack, string $needle): bool
{
return '' === $needle || ('' !== $haystack && 0 === substr_compare($haystack, $needle, -\strlen($needle)));
}
}

24
vendor/symfony/polyfill-php80/README.md vendored Normal file
View File

@ -0,0 +1,24 @@
Symfony Polyfill / Php80
========================
This component provides features added to PHP 8.0 core:
- `Stringable` interface
- [`fdiv`](https://php.net/fdiv)
- `ValueError` class
- `UnhandledMatchError` class
- `FILTER_VALIDATE_BOOL` constant
- [`get_debug_type`](https://php.net/get_debug_type)
- [`preg_last_error_msg`](https://php.net/preg_last_error_msg)
- [`str_contains`](https://php.net/str_contains)
- [`str_starts_with`](https://php.net/str_starts_with)
- [`str_ends_with`](https://php.net/str_ends_with)
- [`get_resource_id`](https://php.net/get_resource_id)
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
License
=======
This library is released under the [MIT license](LICENSE).

View File

@ -0,0 +1,22 @@
<?php
#[Attribute(Attribute::TARGET_CLASS)]
final class Attribute
{
public const TARGET_CLASS = 1;
public const TARGET_FUNCTION = 2;
public const TARGET_METHOD = 4;
public const TARGET_PROPERTY = 8;
public const TARGET_CLASS_CONSTANT = 16;
public const TARGET_PARAMETER = 32;
public const TARGET_ALL = 63;
public const IS_REPEATABLE = 64;
/** @var int */
public $flags;
public function __construct(int $flags = self::TARGET_ALL)
{
$this->flags = $flags;
}
}

View File

@ -0,0 +1,11 @@
<?php
if (\PHP_VERSION_ID < 80000) {
interface Stringable
{
/**
* @return string
*/
public function __toString();
}
}

View File

@ -0,0 +1,5 @@
<?php
class UnhandledMatchError extends Error
{
}

View File

@ -0,0 +1,5 @@
<?php
class ValueError extends Error
{
}

View File

@ -0,0 +1,42 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Php80 as p;
if (\PHP_VERSION_ID >= 80000) {
return;
}
if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
}
if (!function_exists('fdiv')) {
function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
}
if (!function_exists('preg_last_error_msg')) {
function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
}
if (!function_exists('str_contains')) {
function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
}
if (!function_exists('str_starts_with')) {
function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
}
if (!function_exists('str_ends_with')) {
function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
}
if (!function_exists('get_debug_type')) {
function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
}
if (!function_exists('get_resource_id')) {
function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
}

View File

@ -0,0 +1,40 @@
{
"name": "symfony/polyfill-php80",
"type": "library",
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"keywords": ["polyfill", "shim", "compatibility", "portable"],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"require": {
"php": ">=7.1"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Php80\\": "" },
"files": [ "bootstrap.php" ],
"classmap": [ "Resources/stubs" ]
},
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
}
}

30
vendor/vlucas/phpdotenv/LICENSE vendored Normal file
View File

@ -0,0 +1,30 @@
BSD 3-Clause License
Copyright (c) 2014, Graham Campbell.
Copyright (c) 2013, Vance Lucas.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

53
vendor/vlucas/phpdotenv/composer.json vendored Normal file
View File

@ -0,0 +1,53 @@
{
"name": "vlucas/phpdotenv",
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
"keywords": ["env", "dotenv", "environment"],
"license": "BSD-3-Clause",
"authors": [
{
"name": "Graham Campbell",
"email": "graham@alt-three.com",
"homepage": "https://gjcampbell.co.uk/"
},
{
"name": "Vance Lucas",
"email": "vance@vancelucas.com",
"homepage": "https://vancelucas.com/"
}
],
"require": {
"php": "^7.1.3 || ^8.0",
"ext-pcre": "*",
"graham-campbell/result-type": "^1.0.1",
"phpoption/phpoption": "^1.7.4",
"symfony/polyfill-ctype": "^1.17",
"symfony/polyfill-mbstring": "^1.17",
"symfony/polyfill-php80": "^1.17"
},
"require-dev": {
"ext-filter": "*",
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5.1"
},
"autoload": {
"psr-4": {
"Dotenv\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Dotenv\\Tests\\": "tests/Dotenv/"
}
},
"suggest": {
"ext-filter": "Required to use the boolean validator."
},
"config": {
"preferred-install": "dist"
},
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
}
}

267
vendor/vlucas/phpdotenv/src/Dotenv.php vendored Normal file
View File

@ -0,0 +1,267 @@
<?php
declare(strict_types=1);
namespace Dotenv;
use Dotenv\Exception\InvalidPathException;
use Dotenv\Loader\Loader;
use Dotenv\Loader\LoaderInterface;
use Dotenv\Parser\Parser;
use Dotenv\Parser\ParserInterface;
use Dotenv\Repository\Adapter\ArrayAdapter;
use Dotenv\Repository\Adapter\PutenvAdapter;
use Dotenv\Repository\RepositoryBuilder;
use Dotenv\Repository\RepositoryInterface;
use Dotenv\Store\StoreBuilder;
use Dotenv\Store\StoreInterface;
use Dotenv\Store\StringStore;
class Dotenv
{
/**
* The store instance.
*
* @var \Dotenv\Store\StoreInterface
*/
private $store;
/**
* The parser instance.
*
* @var \Dotenv\Parser\ParserInterface
*/
private $parser;
/**
* The loader instance.
*
* @var \Dotenv\Loader\LoaderInterface
*/
private $loader;
/**
* The repository instance.
*
* @var \Dotenv\Repository\RepositoryInterface
*/
private $repository;
/**
* Create a new dotenv instance.
*
* @param \Dotenv\Store\StoreInterface $store
* @param \Dotenv\Parser\ParserInterface $parser
* @param \Dotenv\Loader\LoaderInterface $loader
* @param \Dotenv\Repository\RepositoryInterface $repository
*
* @return void
*/
public function __construct(
StoreInterface $store,
ParserInterface $parser,
LoaderInterface $loader,
RepositoryInterface $repository
) {
$this->store = $store;
$this->parser = $parser;
$this->loader = $loader;
$this->repository = $repository;
}
/**
* Create a new dotenv instance.
*
* @param \Dotenv\Repository\RepositoryInterface $repository
* @param string|string[] $paths
* @param string|string[]|null $names
* @param bool $shortCircuit
* @param string|null $fileEncoding
*
* @return \Dotenv\Dotenv
*/
public static function create(RepositoryInterface $repository, $paths, $names = null, bool $shortCircuit = true, string $fileEncoding = null)
{
$builder = $names === null ? StoreBuilder::createWithDefaultName() : StoreBuilder::createWithNoNames();
foreach ((array) $paths as $path) {
$builder = $builder->addPath($path);
}
foreach ((array) $names as $name) {
$builder = $builder->addName($name);
}
if ($shortCircuit) {
$builder = $builder->shortCircuit();
}
return new self($builder->fileEncoding($fileEncoding)->make(), new Parser(), new Loader(), $repository);
}
/**
* Create a new mutable dotenv instance with default repository.
*
* @param string|string[] $paths
* @param string|string[]|null $names
* @param bool $shortCircuit
* @param string|null $fileEncoding
*
* @return \Dotenv\Dotenv
*/
public static function createMutable($paths, $names = null, bool $shortCircuit = true, string $fileEncoding = null)
{
$repository = RepositoryBuilder::createWithDefaultAdapters()->make();
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
}
/**
* Create a new mutable dotenv instance with default repository with the putenv adapter.
*
* @param string|string[] $paths
* @param string|string[]|null $names
* @param bool $shortCircuit
* @param string|null $fileEncoding
*
* @return \Dotenv\Dotenv
*/
public static function createUnsafeMutable($paths, $names = null, bool $shortCircuit = true, string $fileEncoding = null)
{
$repository = RepositoryBuilder::createWithDefaultAdapters()
->addAdapter(PutenvAdapter::class)
->make();
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
}
/**
* Create a new immutable dotenv instance with default repository.
*
* @param string|string[] $paths
* @param string|string[]|null $names
* @param bool $shortCircuit
* @param string|null $fileEncoding
*
* @return \Dotenv\Dotenv
*/
public static function createImmutable($paths, $names = null, bool $shortCircuit = true, string $fileEncoding = null)
{
$repository = RepositoryBuilder::createWithDefaultAdapters()->immutable()->make();
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
}
/**
* Create a new immutable dotenv instance with default repository with the putenv adapter.
*
* @param string|string[] $paths
* @param string|string[]|null $names
* @param bool $shortCircuit
* @param string|null $fileEncoding
*
* @return \Dotenv\Dotenv
*/
public static function createUnsafeImmutable($paths, $names = null, bool $shortCircuit = true, string $fileEncoding = null)
{
$repository = RepositoryBuilder::createWithDefaultAdapters()
->addAdapter(PutenvAdapter::class)
->immutable()
->make();
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
}
/**
* Create a new dotenv instance with an array backed repository.
*
* @param string|string[] $paths
* @param string|string[]|null $names
* @param bool $shortCircuit
* @param string|null $fileEncoding
*
* @return \Dotenv\Dotenv
*/
public static function createArrayBacked($paths, $names = null, bool $shortCircuit = true, string $fileEncoding = null)
{
$repository = RepositoryBuilder::createWithNoAdapters()->addAdapter(ArrayAdapter::class)->make();
return self::create($repository, $paths, $names, $shortCircuit, $fileEncoding);
}
/**
* Parse the given content and resolve nested variables.
*
* This method behaves just like load(), only without mutating your actual
* environment. We do this by using an array backed repository.
*
* @param string $content
*
* @throws \Dotenv\Exception\InvalidFileException
*
* @return array<string,string|null>
*/
public static function parse(string $content)
{
$repository = RepositoryBuilder::createWithNoAdapters()->addAdapter(ArrayAdapter::class)->make();
$phpdotenv = new self(new StringStore($content), new Parser(), new Loader(), $repository);
return $phpdotenv->load();
}
/**
* Read and load environment file(s).
*
* @throws \Dotenv\Exception\InvalidPathException|\Dotenv\Exception\InvalidEncodingException|\Dotenv\Exception\InvalidFileException
*
* @return array<string,string|null>
*/
public function load()
{
$entries = $this->parser->parse($this->store->read());
return $this->loader->load($this->repository, $entries);
}
/**
* Read and load environment file(s), silently failing if no files can be read.
*
* @throws \Dotenv\Exception\InvalidEncodingException|\Dotenv\Exception\InvalidFileException
*
* @return array<string,string|null>
*/
public function safeLoad()
{
try {
return $this->load();
} catch (InvalidPathException $e) {
// suppressing exception
return [];
}
}
/**
* Required ensures that the specified variables exist, and returns a new validator object.
*
* @param string|string[] $variables
*
* @return \Dotenv\Validator
*/
public function required($variables)
{
return (new Validator($this->repository, (array) $variables))->required();
}
/**
* Returns a new validator object that won't check if the specified variables exist.
*
* @param string|string[] $variables
*
* @return \Dotenv\Validator
*/
public function ifPresent($variables)
{
return new Validator($this->repository, (array) $variables);
}
}

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace Dotenv\Exception;
use Throwable;
interface ExceptionInterface extends Throwable
{
//
}

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace Dotenv\Exception;
use InvalidArgumentException;
final class InvalidEncodingException extends InvalidArgumentException implements ExceptionInterface
{
//
}

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace Dotenv\Exception;
use InvalidArgumentException;
final class InvalidFileException extends InvalidArgumentException implements ExceptionInterface
{
//
}

Some files were not shown because too many files have changed in this diff Show More