diff --git a/inc.lib/composer.json b/inc.lib/composer.json
index 8eb58d56..009eb920 100644
--- a/inc.lib/composer.json
+++ b/inc.lib/composer.json
@@ -13,7 +13,7 @@
"setasign/fpdf": "^1.8",
"setasign/fpdi": "^2.6",
"setasign/fpdi-fpdf": "^2.3",
- "planetbiru/magic-object": "dev-feature/1.8"
+ "planetbiru/magic-object": "^1.13"
},
"config": {
"platform": {
diff --git a/inc.lib/composer.lock b/inc.lib/composer.lock
index 219d0494..a04937b4 100644
--- a/inc.lib/composer.lock
+++ b/inc.lib/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "6e45177b10e6c5bdf1b87f892f93f3fe",
+ "content-hash": "772e4e5be7e9feb441485b0432a43f85",
"packages": [
{
"name": "alchemy/binary-driver",
@@ -546,20 +546,20 @@
},
{
"name": "planetbiru/magic-object",
- "version": "dev-feature/1.8",
+ "version": "1.13.7",
"source": {
"type": "git",
"url": "https://github.com/Planetbiru/MagicObject.git",
- "reference": "2338bd27fb59592d74bdea58cf99fb97878113c4"
+ "reference": "3061178950e97d3bfab54cbead356bb51b796cd9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Planetbiru/MagicObject/zipball/2338bd27fb59592d74bdea58cf99fb97878113c4",
- "reference": "2338bd27fb59592d74bdea58cf99fb97878113c4",
+ "url": "https://api.github.com/repos/Planetbiru/MagicObject/zipball/3061178950e97d3bfab54cbead356bb51b796cd9",
+ "reference": "3061178950e97d3bfab54cbead356bb51b796cd9",
"shasum": ""
},
"require": {
- "symfony/yaml": "^3.4"
+ "symfony/yaml": "3.4"
},
"type": "library",
"autoload": {
@@ -579,9 +579,9 @@
"description": "Magic object",
"support": {
"issues": "https://github.com/Planetbiru/MagicObject/issues",
- "source": "https://github.com/Planetbiru/MagicObject/tree/feature/1.8"
+ "source": "https://github.com/Planetbiru/MagicObject/tree/1.13.7"
},
- "time": "2024-06-01T05:59:37+00:00"
+ "time": "2024-07-12T14:53:22+00:00"
},
{
"name": "psr/cache",
@@ -2175,21 +2175,20 @@
},
{
"name": "symfony/yaml",
- "version": "v3.4.47",
+ "version": "v3.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "88289caa3c166321883f67fe5130188ebbb47094"
+ "reference": "b3d0c9c11be3831b84825967dc6b52b5a7b84e04"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094",
- "reference": "88289caa3c166321883f67fe5130188ebbb47094",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/b3d0c9c11be3831b84825967dc6b52b5a7b84e04",
+ "reference": "b3d0c9c11be3831b84825967dc6b52b5a7b84e04",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8",
- "symfony/polyfill-ctype": "~1.8"
+ "php": "^5.5.9|>=7.0.8"
},
"conflict": {
"symfony/console": "<3.4"
@@ -2201,6 +2200,11 @@
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.4-dev"
+ }
+ },
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
@@ -2226,31 +2230,15 @@
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/yaml/tree/v3.4.47"
+ "source": "https://github.com/symfony/yaml/tree/3.4"
},
- "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": "2020-10-24T10:57:07+00:00"
+ "time": "2017-11-29T13:28:14+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": {
- "planetbiru/magic-object": 20
- },
+ "stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
diff --git a/inc.lib/vendor/composer/autoload_files.php b/inc.lib/vendor/composer/autoload_files.php
index 228e9ef3..7e26e20d 100644
--- a/inc.lib/vendor/composer/autoload_files.php
+++ b/inc.lib/vendor/composer/autoload_files.php
@@ -7,10 +7,10 @@
return array(
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
- '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
+ '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'32dcc8afd4335739640db7d200c1971d' => $vendorDir . '/symfony/polyfill-apcu/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php',
diff --git a/inc.lib/vendor/composer/autoload_static.php b/inc.lib/vendor/composer/autoload_static.php
index 29066b61..0341f8e8 100644
--- a/inc.lib/vendor/composer/autoload_static.php
+++ b/inc.lib/vendor/composer/autoload_static.php
@@ -8,10 +8,10 @@ class ComposerStaticInit2219d434bd9928e433eb450fe0d2c608
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
- '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
+ '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'32dcc8afd4335739640db7d200c1971d' => __DIR__ . '/..' . '/symfony/polyfill-apcu/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php',
diff --git a/inc.lib/vendor/composer/installed.json b/inc.lib/vendor/composer/installed.json
index ee7356e6..9fd00f26 100644
--- a/inc.lib/vendor/composer/installed.json
+++ b/inc.lib/vendor/composer/installed.json
@@ -564,23 +564,23 @@
},
{
"name": "planetbiru/magic-object",
- "version": "dev-feature/1.8",
- "version_normalized": "dev-feature/1.8",
+ "version": "1.13.7",
+ "version_normalized": "1.13.7.0",
"source": {
"type": "git",
"url": "https://github.com/Planetbiru/MagicObject.git",
- "reference": "2338bd27fb59592d74bdea58cf99fb97878113c4"
+ "reference": "3061178950e97d3bfab54cbead356bb51b796cd9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Planetbiru/MagicObject/zipball/2338bd27fb59592d74bdea58cf99fb97878113c4",
- "reference": "2338bd27fb59592d74bdea58cf99fb97878113c4",
+ "url": "https://api.github.com/repos/Planetbiru/MagicObject/zipball/3061178950e97d3bfab54cbead356bb51b796cd9",
+ "reference": "3061178950e97d3bfab54cbead356bb51b796cd9",
"shasum": ""
},
"require": {
- "symfony/yaml": "^3.4"
+ "symfony/yaml": "3.4"
},
- "time": "2024-06-01T05:59:37+00:00",
+ "time": "2024-07-12T14:53:22+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -600,7 +600,7 @@
"description": "Magic object",
"support": {
"issues": "https://github.com/Planetbiru/MagicObject/issues",
- "source": "https://github.com/Planetbiru/MagicObject/tree/feature/1.8"
+ "source": "https://github.com/Planetbiru/MagicObject/tree/1.13.7"
},
"install-path": "../planetbiru/magic-object"
},
@@ -2268,22 +2268,21 @@
},
{
"name": "symfony/yaml",
- "version": "v3.4.47",
- "version_normalized": "3.4.47.0",
+ "version": "v3.4.0",
+ "version_normalized": "3.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "88289caa3c166321883f67fe5130188ebbb47094"
+ "reference": "b3d0c9c11be3831b84825967dc6b52b5a7b84e04"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094",
- "reference": "88289caa3c166321883f67fe5130188ebbb47094",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/b3d0c9c11be3831b84825967dc6b52b5a7b84e04",
+ "reference": "b3d0c9c11be3831b84825967dc6b52b5a7b84e04",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8",
- "symfony/polyfill-ctype": "~1.8"
+ "php": "^5.5.9|>=7.0.8"
},
"conflict": {
"symfony/console": "<3.4"
@@ -2294,8 +2293,13 @@
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
- "time": "2020-10-24T10:57:07+00:00",
+ "time": "2017-11-29T13:28:14+00:00",
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.4-dev"
+ }
+ },
"installation-source": "dist",
"autoload": {
"psr-4": {
@@ -2322,22 +2326,8 @@
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/yaml/tree/v3.4.47"
+ "source": "https://github.com/symfony/yaml/tree/3.4"
},
- "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/yaml"
}
],
diff --git a/inc.lib/vendor/composer/installed.php b/inc.lib/vendor/composer/installed.php
index fe0d239a..f6053f03 100644
--- a/inc.lib/vendor/composer/installed.php
+++ b/inc.lib/vendor/composer/installed.php
@@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
- 'reference' => 'ee6c145e3fdd4cecc9d8245b08acea6f613b3f47',
+ 'reference' => 'd33f61522eac3bce3e44b1d041151cf83725ffa8',
'name' => '__root__',
'dev' => true,
),
@@ -16,7 +16,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
- 'reference' => 'ee6c145e3fdd4cecc9d8245b08acea6f613b3f47',
+ 'reference' => 'd33f61522eac3bce3e44b1d041151cf83725ffa8',
'dev_requirement' => false,
),
'alchemy/binary-driver' => array(
@@ -92,12 +92,12 @@
'dev_requirement' => false,
),
'planetbiru/magic-object' => array(
- 'pretty_version' => 'dev-feature/1.8',
- 'version' => 'dev-feature/1.8',
+ 'pretty_version' => '1.13.7',
+ 'version' => '1.13.7.0',
'type' => 'library',
'install_path' => __DIR__ . '/../planetbiru/magic-object',
'aliases' => array(),
- 'reference' => '2338bd27fb59592d74bdea58cf99fb97878113c4',
+ 'reference' => '3061178950e97d3bfab54cbead356bb51b796cd9',
'dev_requirement' => false,
),
'psr/cache' => array(
@@ -335,12 +335,12 @@
'dev_requirement' => false,
),
'symfony/yaml' => array(
- 'pretty_version' => 'v3.4.47',
- 'version' => '3.4.47.0',
+ 'pretty_version' => 'v3.4.0',
+ 'version' => '3.4.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/yaml',
'aliases' => array(),
- 'reference' => '88289caa3c166321883f67fe5130188ebbb47094',
+ 'reference' => 'b3d0c9c11be3831b84825967dc6b52b5a7b84e04',
'dev_requirement' => false,
),
),
diff --git a/inc.lib/vendor/planetbiru/magic-object/README.md b/inc.lib/vendor/planetbiru/magic-object/README.md
index 3e34b06e..091445c6 100644
--- a/inc.lib/vendor/planetbiru/magic-object/README.md
+++ b/inc.lib/vendor/planetbiru/magic-object/README.md
@@ -154,4 +154,4 @@ Applications that uses **MagicObjects** are :
1. **Music Production Manager** https://github.com/kamshory/MusicProductionManager
2. **AppBuilder** https://github.com/Planetbiru/AppBuilder
3. **Koperasi-Simpan-Pinjam-Syariah** https://github.com/kamshory/Koperasi-Simpan-Pinjam-Syariah
-
+4. **Toserba Online** https://toserba-online.top/
diff --git a/inc.lib/vendor/planetbiru/magic-object/composer.json b/inc.lib/vendor/planetbiru/magic-object/composer.json
index 29bcddc0..b773f425 100644
--- a/inc.lib/vendor/planetbiru/magic-object/composer.json
+++ b/inc.lib/vendor/planetbiru/magic-object/composer.json
@@ -13,6 +13,6 @@
}
],
"require": {
- "symfony/yaml": "^3.4"
+ "symfony/yaml": "3.4"
}
}
diff --git a/inc.lib/vendor/planetbiru/magic-object/composer.lock b/inc.lib/vendor/planetbiru/magic-object/composer.lock
index cd3387d0..d2c7f220 100644
--- a/inc.lib/vendor/planetbiru/magic-object/composer.lock
+++ b/inc.lib/vendor/planetbiru/magic-object/composer.lock
@@ -4,104 +4,24 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "30ba00fe281a7531e0141dd89972af92",
+ "content-hash": "8e401193e906994bfa0ced4ead192d5b",
"packages": [
- {
- "name": "symfony/polyfill-ctype",
- "version": "v1.29.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4",
- "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4",
- "shasum": ""
- },
- "require": {
- "php": ">=7.1"
- },
- "provide": {
- "ext-ctype": "*"
- },
- "suggest": {
- "ext-ctype": "For best performance"
- },
- "type": "library",
- "extra": {
- "thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
- }
- },
- "autoload": {
- "files": [
- "bootstrap.php"
- ],
- "psr-4": {
- "Symfony\\Polyfill\\Ctype\\": ""
- }
- },
- "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.29.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": "2024-01-29T20:11:03+00:00"
- },
{
"name": "symfony/yaml",
- "version": "v3.4.47",
+ "version": "v3.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "88289caa3c166321883f67fe5130188ebbb47094"
+ "reference": "b3d0c9c11be3831b84825967dc6b52b5a7b84e04"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094",
- "reference": "88289caa3c166321883f67fe5130188ebbb47094",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/b3d0c9c11be3831b84825967dc6b52b5a7b84e04",
+ "reference": "b3d0c9c11be3831b84825967dc6b52b5a7b84e04",
"shasum": ""
},
"require": {
- "php": "^5.5.9|>=7.0.8",
- "symfony/polyfill-ctype": "~1.8"
+ "php": "^5.5.9|>=7.0.8"
},
"conflict": {
"symfony/console": "<3.4"
@@ -113,6 +33,11 @@
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.4-dev"
+ }
+ },
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
@@ -138,23 +63,9 @@
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/yaml/tree/v3.4.47"
+ "source": "https://github.com/symfony/yaml/tree/3.4"
},
- "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": "2020-10-24T10:57:07+00:00"
+ "time": "2017-11-29T13:28:14+00:00"
}
],
"packages-dev": [],
diff --git a/inc.lib/vendor/planetbiru/magic-object/manual/includes/_entity.md b/inc.lib/vendor/planetbiru/magic-object/manual/includes/_entity.md
index 5a038563..030fa234 100644
--- a/inc.lib/vendor/planetbiru/magic-object/manual/includes/_entity.md
+++ b/inc.lib/vendor/planetbiru/magic-object/manual/includes/_entity.md
@@ -2,6 +2,18 @@
Entity is class to access database. Entity is derived from MagicObject. Some annotations required to activated all entity features.
+**Constructor**
+
+Parameters:
+
+1. array|stdClass|object $data
+
+Initial data
+
+2. PicoDatabase $database
+
+Database connection
+
```php
addAnd($spec2);
$album = new Album(null, $database);
$album->where($specfification)->delete();
+```
+
+### Subquery
+
+For large data with a very large number of records, using joins, whether inner joins, outer joins, left joins or right joins, will require a lot of resources, which will reduce application and database performance. MagicObject version 1.10 introduces searches using subqueries instead of joins so that the data search process becomes faster.
+
+Using subqueries is not without its drawbacks. The unavoidable disadvantages of subqueries are as follows:
+
+1. just take one column from the reference table
+2. Cannot use columns in the reference table either for filter (where) or for sorting (order by).
+
+Users must be aware of these two shortcomings before deciding to use a subquery.
+
+Example:
+
+```php
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="album")
+ */
+class EntityAlbum extends MagicObject
+{
+ /**
+ * Album ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="album_id", type="varchar(50)", length=50, nullable=false)
+ * @Label(content="Album ID")
+ * @var string
+ */
+ protected $albumId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Title
+ *
+ * @Column(name="title", type="text", nullable=true)
+ * @Label(content="Title")
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * Description
+ *
+ * @Column(name="description", type="longtext", nullable=true)
+ * @Label(content="Description")
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * Producer ID
+ *
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Producer
+ *
+ * @JoinColumn(name="producer_id")
+ * @Label(content="Producer")
+ * @var Producer
+ */
+ protected $producer;
+
+ /**
+ * Release Date
+ *
+ * @Column(name="release_date", type="date", nullable=true)
+ * @Label(content="Release Date")
+ * @var string
+ */
+ protected $releaseDate;
+
+ /**
+ * Number Of Song
+ *
+ * @Column(name="number_of_song", type="int(11)", length=11, nullable=true)
+ * @Label(content="Number Of Song")
+ * @var integer
+ */
+ protected $numberOfSong;
+
+ /**
+ * Duration
+ *
+ * @Column(name="duration", type="float", nullable=true)
+ * @Label(content="Duration")
+ * @var double
+ */
+ protected $duration;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Sort Order
+ *
+ * @Column(name="sort_order", type="int(11)", length=11, nullable=true)
+ * @Label(content="Sort Order")
+ * @var integer
+ */
+ protected $sortOrder;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+ /**
+ * As Draft
+ *
+ * @Column(name="as_draft", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @var boolean
+ */
+ protected $asDraft;
+
+}
+
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="producer")
+ */
+class Producer extends MagicObject
+{
+ /**
+ * Producer ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=false)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Gender
+ *
+ * @Column(name="gender", type="varchar(2)", length=2, nullable=true)
+ * @Label(content="Gender")
+ * @var string
+ */
+ protected $gender;
+
+ /**
+ * Birth Day
+ *
+ * @Column(name="birth_day", type="date", nullable=true)
+ * @Label(content="Birth Day")
+ * @var string
+ */
+ protected $birthDay;
+
+ /**
+ * Phone
+ *
+ * @Column(name="phone", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone")
+ * @var string
+ */
+ protected $phone;
+
+ /**
+ * Phone2
+ *
+ * @Column(name="phone2", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone2")
+ * @var string
+ */
+ protected $phone2;
+
+ /**
+ * Phone3
+ *
+ * @Column(name="phone3", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone3")
+ * @var string
+ */
+ protected $phone3;
+
+ /**
+ * Email
+ *
+ * @Column(name="email", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email")
+ * @var string
+ */
+ protected $email;
+
+ /**
+ * Email2
+ *
+ * @Column(name="email2", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email2")
+ * @var string
+ */
+ protected $email2;
+
+ /**
+ * Email3
+ *
+ * @Column(name="email3", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email3")
+ * @var string
+ */
+ protected $email3;
+
+ /**
+ * Website
+ *
+ * @Column(name="website", type="text", nullable=true)
+ * @Label(content="Website")
+ * @var string
+ */
+ protected $website;
+
+ /**
+ * Address
+ *
+ * @Column(name="address", type="text", nullable=true)
+ * @Label(content="Address")
+ * @var string
+ */
+ protected $address;
+
+ /**
+ * Picture
+ *
+ * @Column(name="picture", type="tinyint(1)", length=1, nullable=true)
+ * @var boolean
+ */
+ protected $picture;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Image Update
+ *
+ * @Column(name="image_update", type="timestamp", length=19, nullable=true)
+ * @Label(content="Image Update")
+ * @var string
+ */
+ protected $imageUpdate;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+}
+
+$album = new EntityAlbum(null, $database);
+
+$subqueryMap = array(
+ 'producer'=>array(
+ 'entityName'=>'Producer',
+ 'tableName'=>'producer',
+ 'primaryKey'=>'producer_id',
+ 'columnName'=>'producer_id',
+ 'objectName'=>'producer',
+ 'propertyName'=>'name'
+ )
+);
+
+$result = $album->findAll(null, null, null, true, $subqueryMap);
+
+foreach($result->getResult() as $row)
+{
+ echo $row;
+}
+```
+
+### Find All with Option
+
+1. MagicObject::FIND_OPTION_NO_COUNT_DATA
+2. MagicObject::FIND_OPTION_NO_FETCH_DATA
+
+If the `MagicObject::FIND_OPTION_NO_COUNT_DATA` option is provided, the MagicObject will not count data even if a PicoPageable is provided. This will reduce data processing time but the user does not know how much data actually is. This option can be selected when dealing with very large data.
+
+If the `MagicObject::FIND_OPTION_NO_FETCH_DATA` option is given, MagicObject will not directly fetch data and store it in the object. Users must retrieve data one by one using the fetch method. This option can be selected when handling very large data so that it does not consume much memory.
+
+Example:
+
+```php
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="album")
+ */
+class EntityAlbum extends MagicObject
+{
+ /**
+ * Album ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="album_id", type="varchar(50)", length=50, nullable=false)
+ * @Label(content="Album ID")
+ * @var string
+ */
+ protected $albumId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Title
+ *
+ * @Column(name="title", type="text", nullable=true)
+ * @Label(content="Title")
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * Description
+ *
+ * @Column(name="description", type="longtext", nullable=true)
+ * @Label(content="Description")
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * Producer ID
+ *
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Producer
+ *
+ * @JoinColumn(name="producer_id")
+ * @Label(content="Producer")
+ * @var Producer
+ */
+ protected $producer;
+
+ /**
+ * Release Date
+ *
+ * @Column(name="release_date", type="date", nullable=true)
+ * @Label(content="Release Date")
+ * @var string
+ */
+ protected $releaseDate;
+
+ /**
+ * Number Of Song
+ *
+ * @Column(name="number_of_song", type="int(11)", length=11, nullable=true)
+ * @Label(content="Number Of Song")
+ * @var integer
+ */
+ protected $numberOfSong;
+
+ /**
+ * Duration
+ *
+ * @Column(name="duration", type="float", nullable=true)
+ * @Label(content="Duration")
+ * @var double
+ */
+ protected $duration;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Sort Order
+ *
+ * @Column(name="sort_order", type="int(11)", length=11, nullable=true)
+ * @Label(content="Sort Order")
+ * @var integer
+ */
+ protected $sortOrder;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+ /**
+ * As Draft
+ *
+ * @Column(name="as_draft", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @var boolean
+ */
+ protected $asDraft;
+
+}
+
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="producer")
+ */
+class Producer extends MagicObject
+{
+ /**
+ * Producer ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=false)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Gender
+ *
+ * @Column(name="gender", type="varchar(2)", length=2, nullable=true)
+ * @Label(content="Gender")
+ * @var string
+ */
+ protected $gender;
+
+ /**
+ * Birth Day
+ *
+ * @Column(name="birth_day", type="date", nullable=true)
+ * @Label(content="Birth Day")
+ * @var string
+ */
+ protected $birthDay;
+
+ /**
+ * Phone
+ *
+ * @Column(name="phone", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone")
+ * @var string
+ */
+ protected $phone;
+
+ /**
+ * Phone2
+ *
+ * @Column(name="phone2", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone2")
+ * @var string
+ */
+ protected $phone2;
+
+ /**
+ * Phone3
+ *
+ * @Column(name="phone3", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone3")
+ * @var string
+ */
+ protected $phone3;
+
+ /**
+ * Email
+ *
+ * @Column(name="email", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email")
+ * @var string
+ */
+ protected $email;
+
+ /**
+ * Email2
+ *
+ * @Column(name="email2", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email2")
+ * @var string
+ */
+ protected $email2;
+
+ /**
+ * Email3
+ *
+ * @Column(name="email3", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email3")
+ * @var string
+ */
+ protected $email3;
+
+ /**
+ * Website
+ *
+ * @Column(name="website", type="text", nullable=true)
+ * @Label(content="Website")
+ * @var string
+ */
+ protected $website;
+
+ /**
+ * Address
+ *
+ * @Column(name="address", type="text", nullable=true)
+ * @Label(content="Address")
+ * @var string
+ */
+ protected $address;
+
+ /**
+ * Picture
+ *
+ * @Column(name="picture", type="tinyint(1)", length=1, nullable=true)
+ * @var boolean
+ */
+ protected $picture;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Image Update
+ *
+ * @Column(name="image_update", type="timestamp", length=19, nullable=true)
+ * @Label(content="Image Update")
+ * @var string
+ */
+ protected $imageUpdate;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+}
+
+$album = new EntityAlbum(null, $database);
+
+$subqueryMap = array(
+ 'producer'=>array(
+ 'entityName'=>'Producer',
+ 'tableName'=>'producer',
+ 'primaryKey'=>'producer_id',
+ 'columnName'=>'producer_id',
+ 'objectName'=>'producer',
+ 'propertyName'=>'name'
+ )
+);
+
+$result = $album->findAll(null, null, null, true, null, MagicObject::FIND_OPTION_NO_COUNT_DATA | MagicObject::FIND_OPTION_NO_FETCH_DATA);
+
+while($data = $result->fetch())
+{
+ echo $data;
+}
```
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/manual/index.html b/inc.lib/vendor/planetbiru/magic-object/manual/index.html
index 90a5de05..fae39304 100644
--- a/inc.lib/vendor/planetbiru/magic-object/manual/index.html
+++ b/inc.lib/vendor/planetbiru/magic-object/manual/index.html
@@ -1247,6 +1247,16 @@
Session with Redis
Entity
Entity is class to access database. Entity is derived from MagicObject. Some annotations required to activated all entity features.
+Constructor
+Parameters:
+
+- array|stdClass|object $data
+
+Initial data
+
+- PicoDatabase $database
+
+Database connection
<?php
namespace MusicProductionManager\Data\Entity;
@@ -1489,6 +1499,9 @@ Property Parameters
2. GenerationType.IDENTITY
Autoincrement using database feature
+3. TABLE Not implemented yet
+4. SEQUENCE Not implemented yet
+5. AUTO Not implemented yet
MagicObject will not update time_create
, admin_create
, and ip_create
because updatable=false
. So, even if the application wants to update this value, this column will be ignored when performing an update query to the database.
generator
is generator of the value.
@NotNull
@@ -4578,6 +4591,849 @@ Filter Delete
$album = new Album(null, $database);
$album->where($specfification)->delete();
+Subquery
+For large data with a very large number of records, using joins, whether inner joins, outer joins, left joins or right joins, will require a lot of resources, which will reduce application and database performance. MagicObject version 1.10 introduces searches using subqueries instead of joins so that the data search process becomes faster.
+Using subqueries is not without its drawbacks. The unavoidable disadvantages of subqueries are as follows:
+
+- just take one column from the reference table
+- Cannot use columns in the reference table either for filter (where) or for sorting (order by).
+
+Users must be aware of these two shortcomings before deciding to use a subquery.
+Example:
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="album")
+ */
+class EntityAlbum extends MagicObject
+{
+ /**
+ * Album ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="album_id", type="varchar(50)", length=50, nullable=false)
+ * @Label(content="Album ID")
+ * @var string
+ */
+ protected $albumId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Title
+ *
+ * @Column(name="title", type="text", nullable=true)
+ * @Label(content="Title")
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * Description
+ *
+ * @Column(name="description", type="longtext", nullable=true)
+ * @Label(content="Description")
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * Producer ID
+ *
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Producer
+ *
+ * @JoinColumn(name="producer_id")
+ * @Label(content="Producer")
+ * @var Producer
+ */
+ protected $producer;
+
+ /**
+ * Release Date
+ *
+ * @Column(name="release_date", type="date", nullable=true)
+ * @Label(content="Release Date")
+ * @var string
+ */
+ protected $releaseDate;
+
+ /**
+ * Number Of Song
+ *
+ * @Column(name="number_of_song", type="int(11)", length=11, nullable=true)
+ * @Label(content="Number Of Song")
+ * @var integer
+ */
+ protected $numberOfSong;
+
+ /**
+ * Duration
+ *
+ * @Column(name="duration", type="float", nullable=true)
+ * @Label(content="Duration")
+ * @var double
+ */
+ protected $duration;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Sort Order
+ *
+ * @Column(name="sort_order", type="int(11)", length=11, nullable=true)
+ * @Label(content="Sort Order")
+ * @var integer
+ */
+ protected $sortOrder;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+ /**
+ * As Draft
+ *
+ * @Column(name="as_draft", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @var boolean
+ */
+ protected $asDraft;
+
+}
+
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="producer")
+ */
+class Producer extends MagicObject
+{
+ /**
+ * Producer ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=false)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Gender
+ *
+ * @Column(name="gender", type="varchar(2)", length=2, nullable=true)
+ * @Label(content="Gender")
+ * @var string
+ */
+ protected $gender;
+
+ /**
+ * Birth Day
+ *
+ * @Column(name="birth_day", type="date", nullable=true)
+ * @Label(content="Birth Day")
+ * @var string
+ */
+ protected $birthDay;
+
+ /**
+ * Phone
+ *
+ * @Column(name="phone", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone")
+ * @var string
+ */
+ protected $phone;
+
+ /**
+ * Phone2
+ *
+ * @Column(name="phone2", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone2")
+ * @var string
+ */
+ protected $phone2;
+
+ /**
+ * Phone3
+ *
+ * @Column(name="phone3", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone3")
+ * @var string
+ */
+ protected $phone3;
+
+ /**
+ * Email
+ *
+ * @Column(name="email", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email")
+ * @var string
+ */
+ protected $email;
+
+ /**
+ * Email2
+ *
+ * @Column(name="email2", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email2")
+ * @var string
+ */
+ protected $email2;
+
+ /**
+ * Email3
+ *
+ * @Column(name="email3", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email3")
+ * @var string
+ */
+ protected $email3;
+
+ /**
+ * Website
+ *
+ * @Column(name="website", type="text", nullable=true)
+ * @Label(content="Website")
+ * @var string
+ */
+ protected $website;
+
+ /**
+ * Address
+ *
+ * @Column(name="address", type="text", nullable=true)
+ * @Label(content="Address")
+ * @var string
+ */
+ protected $address;
+
+ /**
+ * Picture
+ *
+ * @Column(name="picture", type="tinyint(1)", length=1, nullable=true)
+ * @var boolean
+ */
+ protected $picture;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Image Update
+ *
+ * @Column(name="image_update", type="timestamp", length=19, nullable=true)
+ * @Label(content="Image Update")
+ * @var string
+ */
+ protected $imageUpdate;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+}
+
+$album = new EntityAlbum(null, $database);
+
+$subqueryMap = array(
+ 'producer'=>array(
+ 'entityName'=>'Producer',
+ 'tableName'=>'producer',
+ 'primaryKey'=>'producer_id',
+ 'columnName'=>'producer_id',
+ 'objectName'=>'producer',
+ 'propertyName'=>'name'
+ )
+);
+
+$result = $album->findAll(null, null, null, true, $subqueryMap);
+
+foreach($result->getResult() as $row)
+{
+ echo $row;
+}
+Find All with Option
+
+- MagicObject::FIND_OPTION_NO_COUNT_DATA
+- MagicObject::FIND_OPTION_NO_FETCH_DATA
+
+If the MagicObject::FIND_OPTION_NO_COUNT_DATA
option is provided, the MagicObject will not count data even if a PicoPageable is provided. This will reduce data processing time but the user does not know how much data actually is. This option can be selected when dealing with very large data.
+If the MagicObject::FIND_OPTION_NO_FETCH_DATA
option is given, MagicObject will not directly fetch data and store it in the object. Users must retrieve data one by one using the fetch method. This option can be selected when handling very large data so that it does not consume much memory.
+Example:
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="album")
+ */
+class EntityAlbum extends MagicObject
+{
+ /**
+ * Album ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="album_id", type="varchar(50)", length=50, nullable=false)
+ * @Label(content="Album ID")
+ * @var string
+ */
+ protected $albumId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Title
+ *
+ * @Column(name="title", type="text", nullable=true)
+ * @Label(content="Title")
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * Description
+ *
+ * @Column(name="description", type="longtext", nullable=true)
+ * @Label(content="Description")
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * Producer ID
+ *
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Producer
+ *
+ * @JoinColumn(name="producer_id")
+ * @Label(content="Producer")
+ * @var Producer
+ */
+ protected $producer;
+
+ /**
+ * Release Date
+ *
+ * @Column(name="release_date", type="date", nullable=true)
+ * @Label(content="Release Date")
+ * @var string
+ */
+ protected $releaseDate;
+
+ /**
+ * Number Of Song
+ *
+ * @Column(name="number_of_song", type="int(11)", length=11, nullable=true)
+ * @Label(content="Number Of Song")
+ * @var integer
+ */
+ protected $numberOfSong;
+
+ /**
+ * Duration
+ *
+ * @Column(name="duration", type="float", nullable=true)
+ * @Label(content="Duration")
+ * @var double
+ */
+ protected $duration;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Sort Order
+ *
+ * @Column(name="sort_order", type="int(11)", length=11, nullable=true)
+ * @Label(content="Sort Order")
+ * @var integer
+ */
+ protected $sortOrder;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+ /**
+ * As Draft
+ *
+ * @Column(name="as_draft", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @var boolean
+ */
+ protected $asDraft;
+
+}
+
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="producer")
+ */
+class Producer extends MagicObject
+{
+ /**
+ * Producer ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=false)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Gender
+ *
+ * @Column(name="gender", type="varchar(2)", length=2, nullable=true)
+ * @Label(content="Gender")
+ * @var string
+ */
+ protected $gender;
+
+ /**
+ * Birth Day
+ *
+ * @Column(name="birth_day", type="date", nullable=true)
+ * @Label(content="Birth Day")
+ * @var string
+ */
+ protected $birthDay;
+
+ /**
+ * Phone
+ *
+ * @Column(name="phone", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone")
+ * @var string
+ */
+ protected $phone;
+
+ /**
+ * Phone2
+ *
+ * @Column(name="phone2", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone2")
+ * @var string
+ */
+ protected $phone2;
+
+ /**
+ * Phone3
+ *
+ * @Column(name="phone3", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone3")
+ * @var string
+ */
+ protected $phone3;
+
+ /**
+ * Email
+ *
+ * @Column(name="email", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email")
+ * @var string
+ */
+ protected $email;
+
+ /**
+ * Email2
+ *
+ * @Column(name="email2", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email2")
+ * @var string
+ */
+ protected $email2;
+
+ /**
+ * Email3
+ *
+ * @Column(name="email3", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email3")
+ * @var string
+ */
+ protected $email3;
+
+ /**
+ * Website
+ *
+ * @Column(name="website", type="text", nullable=true)
+ * @Label(content="Website")
+ * @var string
+ */
+ protected $website;
+
+ /**
+ * Address
+ *
+ * @Column(name="address", type="text", nullable=true)
+ * @Label(content="Address")
+ * @var string
+ */
+ protected $address;
+
+ /**
+ * Picture
+ *
+ * @Column(name="picture", type="tinyint(1)", length=1, nullable=true)
+ * @var boolean
+ */
+ protected $picture;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Image Update
+ *
+ * @Column(name="image_update", type="timestamp", length=19, nullable=true)
+ * @Label(content="Image Update")
+ * @var string
+ */
+ protected $imageUpdate;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+}
+
+$album = new EntityAlbum(null, $database);
+
+$subqueryMap = array(
+ 'producer'=>array(
+ 'entityName'=>'Producer',
+ 'tableName'=>'producer',
+ 'primaryKey'=>'producer_id',
+ 'columnName'=>'producer_id',
+ 'objectName'=>'producer',
+ 'propertyName'=>'name'
+ )
+);
+
+$result = $album->findAll(null, null, null, true, null, MagicObject::FIND_OPTION_NO_COUNT_DATA | MagicObject::FIND_OPTION_NO_FETCH_DATA);
+
+while($data = $result->fetch())
+{
+ echo $data;
+}
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabase.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabase.php
index 9ea09d24..b386cf85 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabase.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabase.php
@@ -2,6 +2,7 @@
namespace MagicObject\Database;
+use Exception;
use PDO;
use PDOException;
use PDOStatement;
@@ -57,7 +58,18 @@ class PicoDatabase //NOSONAR
*/
private $databaseType = "";
+ /**
+ * Callback function when execute query when modify data and execute function and procedure
+ *
+ * @var callable
+ */
private $callbackExecuteQuery = null;
+
+ /**
+ * Callback function when execute query
+ *
+ * @var callable
+ */
private $callbackDebugQuery = null;
/**
@@ -82,9 +94,11 @@ public function __construct($databaseCredentials, $callbackExecuteQuery = null,
/**
* Connect to database
+ *
+ * @param boolean $withDatabase
* @return boolean true if success and false if failed
*/
- public function connect()
+ public function connect($withDatabase = true)
{
$databaseTimeZone = $this->databaseCredentials->getTimeZone();
if($databaseTimeZone != null && !empty($databaseTimeZone))
@@ -92,10 +106,10 @@ public function connect()
date_default_timezone_set($this->databaseCredentials->getTimeZone());
}
$timeZoneOffset = date("P");
- $connected = true;
+ $connected = false;
try
{
- $connectionString = $this->constructConnectionString();
+ $connectionString = $this->constructConnectionString($withDatabase);
if(!$this->databaseCredentials->issetUsername())
{
throw new InvalidDatabaseConfiguration("Database username may not be empty. Please check your database configuration!");
@@ -107,7 +121,6 @@ public function connect()
$initialQueries .= "SET search_path TO ".$this->databaseCredentials->getDatabaseShema();
}
-
$this->databaseType = $this->databaseCredentials->getDriver();
$this->databaseConnection = new PDO(
$connectionString,
@@ -123,10 +136,9 @@ public function connect()
$connected = true;
$this->connected = $connected;
}
- catch (PDOException $e)
+ catch (Exception $e)
{
- // Do nothing
- echo $e->getMessage();
+ throw new PDOException($e->getMessage(), intval($e->getCode()));
}
return $connected;
}
@@ -137,31 +149,39 @@ public function connect()
* @return string
* @throws InvalidDatabaseConfiguration
*/
- private function constructConnectionString()
+ private function constructConnectionString($withDatabase = true)
{
$emptyDriver = !$this->databaseCredentials->issetDriver();
$emptyHost = !$this->databaseCredentials->issetHost();
$emptyPort = !$this->databaseCredentials->issetPort();
$emptyName = !$this->databaseCredentials->issetDatabaseName();
+ $emptyValue = "";
+ $emptyValue .= $emptyDriver ? "{driver}" : "";
+ $emptyValue .= $emptyHost ? "{host}" : "";
+ $emptyValue .= $emptyPort ? "{port}" : "";
+ $invalidParam1 = $emptyDriver || $emptyHost || $emptyPort;
- if(
- $emptyDriver
- ||
- $emptyHost
- ||
- $emptyPort
- ||
- $emptyName
- )
+ if($withDatabase)
+ {
+ if(
+ $invalidParam1
+ ||
+ $emptyName
+ )
+ {
+ $emptyValue .= $emptyName ? "{database_name}" : "";
+ throw new InvalidDatabaseConfiguration("Invalid database configuration. $emptyValue. Please check your database configuration!");
+ }
+ return $this->databaseCredentials->getDriver() . ':host=' . $this->databaseCredentials->getHost() . '; port=' . ((int) $this->databaseCredentials->getPort()) . '; dbname=' . $this->databaseCredentials->getDatabaseName();
+ }
+ else
{
- $emptyValue = "";
- $emptyValue .= $emptyDriver ? "{driver}" : "";
- $emptyValue .= $emptyHost ? "{host}" : "";
- $emptyValue .= $emptyPort ? "{port}" : "";
- $emptyValue .= $emptyName ? "{database_name}" : "";
- throw new InvalidDatabaseConfiguration("Invalid database configuration. $emptyValue. Please check your database configuration!");
+ if($invalidParam1)
+ {
+ throw new InvalidDatabaseConfiguration("Invalid database configuration. $emptyValue. Please check your database configuration!");
+ }
+ return $this->databaseCredentials->getDriver() . ':host=' . $this->databaseCredentials->getHost() . '; port=' . ((int) $this->databaseCredentials->getPort());
}
- return $this->databaseCredentials->getDriver() . ':host=' . $this->databaseCredentials->getHost() . '; port=' . ((int) $this->databaseCredentials->getPort()) . '; dbname=' . $this->databaseCredentials->getDatabaseName();
}
/**
@@ -262,14 +282,7 @@ public function fetch($sql, $tentativeType = PDO::FETCH_ASSOC, $defaultValue = n
try
{
$stmt->execute();
- if ($stmt->rowCount() > 0)
- {
- $result = $stmt->fetch($tentativeType);
- }
- else
- {
- $result = $defaultValue;
- }
+ $result = $stmt->rowCount() > 0 ? $stmt->fetch($tentativeType) : $defaultValue;
}
catch (PDOException $e)
{
@@ -299,7 +312,7 @@ public function isRecordExists($sql)
}
catch (PDOException $e)
{
- throw new PDOException($e);
+ throw new PDOException($e->getMessage(), intval($e->getCode()));
}
}
@@ -323,14 +336,7 @@ public function fetchAll($sql, $tentativeType = PDO::FETCH_ASSOC, $defaultValue
try
{
$stmt->execute();
- if ($stmt->rowCount() > 0)
- {
- $result = $stmt->fetchAll($tentativeType);
- }
- else
- {
- $result = $defaultValue;
- }
+ $result = $stmt->rowCount() > 0 ? $stmt->fetchAll($tentativeType) : $defaultValue;
}
catch (PDOException $e)
{
@@ -380,7 +386,7 @@ public function executeQuery($sql)
}
catch (PDOException $e)
{
- throw new PDOException($e);
+ throw new PDOException($e->getMessage(), intval($e->getCode()));
}
return $stmt;
}
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabasePersistence.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabasePersistence.php
index c8a86e7d..5257fd64 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabasePersistence.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabasePersistence.php
@@ -54,6 +54,7 @@ class PicoDatabasePersistence // NOSONAR
const ORDER_ASC = "asc";
const ORDER_DESC = "desc";
+ const MESSAGE_NO_PRIMARY_KEY_DEFINED = "No primaru key defined";
const MESSAGE_NO_RECORD_FOUND = "No record found";
const MESSAGE_INVALID_FILTER = "Invalid filter";
const SQL_DATETIME_FORMAT = "Y-m-d H:i:s";
@@ -167,7 +168,6 @@ class PicoDatabasePersistence // NOSONAR
*/
protected $whereStr = null;
-
/**
* Specification
*
@@ -208,18 +208,6 @@ public function __construct($database, $object)
$this->className = get_class($object);
$this->object = $object;
}
-
- /**
- * Set flag to skip null column
- *
- * @param boolean $skip Skip null
- * @return self
- */
- public function includeNull($skip)
- {
- $this->flagIncludeNull = $skip;
- return $this;
- }
/**
* Check if string is null or empty
@@ -227,7 +215,7 @@ public function includeNull($skip)
* @param string $string
* @return string
*/
- private function nulOrEmpty($string)
+ public static function nulOrEmpty($string)
{
return $string == null || empty($string);
}
@@ -238,10 +226,54 @@ private function nulOrEmpty($string)
* @param string $string
* @return string
*/
- private function notNullAndNotEmpty($string)
+ public static function notNullAndNotEmpty($string)
{
return $string != null && !empty($string);
}
+
+ /**
+ * Apply subquery result
+ *
+ * @param array $data
+ * @param array $row
+ * @param array $subqueryMap
+ * @return array
+ */
+ public static function applySubqueryResult($data, $row, $subqueryMap)
+ {
+ if(isset($subqueryMap) && is_array($subqueryMap))
+ {
+ foreach($subqueryMap as $info)
+ {
+ $objectName = $info['objectName'];
+ $objectNameSub = $info['objectName'];
+ if(isset($row[$objectNameSub]))
+ {
+ $data[$objectName] = (new MagicObject())
+ ->set($info['primaryKey'], $row[$info['columnName']])
+ ->set($info['propertyName'], $row[$objectNameSub])
+ ;
+ }
+ else
+ {
+ $data[$objectName] = new MagicObject();
+ }
+ }
+ }
+ return $data;
+ }
+
+ /**
+ * Set flag to skip null column
+ *
+ * @param boolean $skip Skip null
+ * @return self
+ */
+ public function includeNull($skip)
+ {
+ $this->flagIncludeNull = $skip;
+ return $this;
+ }
/**
* Parse key value string
@@ -677,7 +709,7 @@ private function getNullCols($info)
{
$nullCols = array();
$nullList = $this->object->nullPropertiyList();
- if(isset($nullList) && is_array($nullList))
+ if($this->isArray($nullList))
{
foreach($nullList as $key=>$val)
{
@@ -921,12 +953,12 @@ private function addGeneratedValue($info, $fisrtCall)
if(!$this->generatedValue)
{
$keys = $info->getAutoIncrementKeys();
- if(isset($keys) && is_array($keys))
+ if($this->isArray($keys))
{
foreach($keys as $prop=>$col)
{
$autoVal = $this->object->get($prop);
- if($this->nulOrEmpty($autoVal) && isset($col[self::KEY_STRATEGY]))
+ if(self::nulOrEmpty($autoVal) && isset($col[self::KEY_STRATEGY]))
{
$this->setGeneratedValue($prop, $col[self::KEY_STRATEGY], $fisrtCall);
}
@@ -1010,7 +1042,6 @@ private function _insert($info = null, $queryBuilder = null)
if(!$this->generatedValue)
{
$this->addGeneratedValue($info, false);
- $this->object->update();
}
return $stmt;
}
@@ -1086,7 +1117,7 @@ private function fixInsertableValues($values, $info = null)
{
foreach($info->getAutoIncrementKeys() as $name=>$col)
{
- if(strcasecmp($col[self::KEY_STRATEGY], "GenerationType.UUID") == 0)
+ if(strcasecmp($col[self::KEY_STRATEGY], "GenerationType.UUID") == 0 && !$this->generatedValue)
{
$value = $this->database->generateNewId();
$values[$col[self::KEY_NAME]] = $value;
@@ -1197,7 +1228,7 @@ private function getColumnMap($info)
/**
* Fix comparison
*
- * @param string $column
+ * @param string $column Column
* @return string
*/
private function fixComparison($column)
@@ -1224,7 +1255,7 @@ private function fixComparison($column)
/**
* Create WHERE by argument given
*
- * @param object $info
+ * @param PicoTableInfo $info Table information
* @param string $propertyName Property name
* @param array $propertyValues Property values
* @return string
@@ -1261,7 +1292,7 @@ private function createWhereFromArgs($info, $propertyName, $propertyValues)
/**
* Get table name
*
- * @param string|null $entityName
+ * @param string|null $entityName Entity name
* @return string|null
*/
private function getTableOf($entityName)
@@ -1277,7 +1308,7 @@ private function getTableOf($entityName)
$tableName = $entityName;
try
{
- $className = $this->getRealClassName($entityName);
+ $className = $this->getRealClassName($entityName);
$annotationParser = new PicoAnnotationParser($className);
$parameters = $annotationParser->getParametersAsObject();
if($parameters->getTable() != null)
@@ -1287,9 +1318,6 @@ private function getTableOf($entityName)
{
$tableName = $attribute->getName();
$this->entityTable[$entityName] = $tableName;
-
-
- //$this->joinPrimaryKeys[]
}
}
}
@@ -1298,10 +1326,15 @@ private function getTableOf($entityName)
// do nothing
$tableName = null;
}
-
return $tableName;
}
+ /**
+ * Get entity primary key
+ *
+ * @param string $entityName
+ * @return string[]
+ */
private function getPrimaryKeyOf($entityName)
{
$columns = array();
@@ -1319,9 +1352,7 @@ private function getPrimaryKeyOf($entityName)
$properties = $reflexProp->parseKeyValueAsObject($parameters->getColumn());
$columns[$prop->name] = $properties->getName();
}
-
// get column name of each parameters
-
}
}
catch(Exception $e)
@@ -1352,8 +1383,7 @@ private function getColumnMapOf($entityName)
$properties = $reflexProp->parseKeyValueAsObject($parameters->getColumn());
$columns[$prop->name] = $properties->getName();
- // get column name of each parameters
-
+ // get column name of each parameters
}
}
catch(Exception $e)
@@ -1366,15 +1396,14 @@ private function getColumnMapOf($entityName)
/**
* Get join source
*
- * @param string|null $parentName
- * @param string $masterTable
- * @param string|null $entityTable
- * @param string $field
+ * @param string|null $parentName Parent name
+ * @param string $masterTable Master table
+ * @param string|null $entityTable Entity table
+ * @param string $field Field
* @return string
*/
private function getJoinSource($parentName, $masterTable, $entityTable, $field, $master = false)
{
-
$result = $masterTable.".".$field;
if($entityTable != null && $parentName != null)
{
@@ -1502,7 +1531,7 @@ private function addWhere($arr, $masterColumnMaps, $sqlQuery, $spec, $info)
if($spec instanceof PicoPredicate)
{
$masterTable = $info->getTableName();
- $entityField = new PicoEntityField($spec->getField());
+ $entityField = new PicoEntityField($spec->getField(), $info);
$field = $entityField->getField();
$entityName = $entityField->getEntity();
$parentName = $entityField->getParentField();
@@ -1661,7 +1690,7 @@ public function createOrderByQuery($order, $info = null)
$ret = null;
if($info == null)
{
- $ret = $this->createWithoutMapping($order);
+ $ret = $this->createWithoutMapping($order, $info);
}
else
{
@@ -1674,9 +1703,10 @@ public function createOrderByQuery($order, $info = null)
* Create sort without mapping
*
* @param PicoSortable $order Sortable
+ * @param PicoTableInfo|null $info
* @return string
*/
- private function createWithoutMapping($order)
+ private function createWithoutMapping($order, $info)
{
$ret = null;
$sorts = array();
@@ -1685,7 +1715,7 @@ private function createWithoutMapping($order)
$columnName = $sortable->getSortBy();
$sortType = $sortable->getSortType();
$sortBy = $columnName;
- $entityField = new PicoEntityField($sortBy);
+ $entityField = new PicoEntityField($sortBy, $info);
if($entityField->getEntity() != null)
{
$tableName = $this->getTableOf($entityField->getEntity());
@@ -1716,10 +1746,11 @@ private function createWithMapping($order, $info)
foreach($order->getSortable() as $sortOrder)
{
- $entityField = new PicoEntityField($sortOrder->getSortBy());
+ $entityField = new PicoEntityField($sortOrder->getSortBy(), $info);
$field = $entityField->getField();
$entityName = $entityField->getEntity();
$parentName = $entityField->getParentField();
+
if($entityName != null)
{
$entityTable = $this->getTableOf($entityName);
@@ -1785,6 +1816,23 @@ private function toArray($propertyValues)
return $propertyValues;
}
+ /**
+ * Get all table columns on entity
+ *
+ * @param PicoTableInfo $info Table information
+ * @return string
+ */
+ private function getAllColumns($info)
+ {
+ $columns = $info->getColumns();
+ $result = array();
+ foreach($columns as $column)
+ {
+ $result[] = $info->getTableName().".".$column['name'];
+ }
+ return $this->joinStringArray($result, self::MAX_LINE_LENGTH, self::COMMA, self::COMMA_RETURN);
+ }
+
/**
* Find one record by primary key value
*
@@ -1825,7 +1873,7 @@ public function find($propertyValues)
}
$sqlQuery = $queryBuilder
->newQuery()
- ->select($info->getTableName().".*")
+ ->select($this->getAllColumns($info))
->from($info->getTableName())
->where($where)
->limit(1)
@@ -1869,7 +1917,7 @@ private function setSpecification($sqlQuery, $specification, $info)
if($specification != null && $specification instanceof PicoSpecification && !$specification->isEmpty())
{
$where = $this->createWhereFromSpecification($sqlQuery, $specification, $info);
- if($this->notNullAndNotEmpty($where))
+ if(self::notNullAndNotEmpty($where))
{
$sqlQuery->where($where);
}
@@ -2094,6 +2142,32 @@ private function isRequireJoinFromSpecification($specification)
return isset($specification) && $specification instanceof PicoSpecification && $specification->isRequireJoin();
}
+ /**
+ * Create PDO statement
+ *
+ * @param PicoSpecification $specification
+ * @param PicoPageable $pageable
+ * @param PicoSortable $sortable
+ * @param array $subqueryMap
+ * @param string $selected
+ * @return PDOStatement
+ * @throws PDOException
+ */
+ public function createPDOStatement($specification, $pageable, $sortable, $subqueryMap = null, $selected = null)
+ {
+ $info = $this->getTableInfo();
+ if($selected == null || empty($selected))
+ {
+ $selected = $this->getAllColumns($info);
+ }
+ if($subqueryMap != null)
+ {
+ $selected = $this->joinString($selected, $this->subquery($info, $subqueryMap), self::COMMA_RETURN);
+ }
+ $sql = $this->findSpecificQuery($selected, $specification, $pageable, $sortable, $info);
+ return $this->database->query($sql);
+ }
+
/**
* Get findAll query
*
@@ -2109,8 +2183,7 @@ public function findAllQuery($specification, $pageable = null, $sortable = null,
{
$info = $this->getTableInfo();
}
- $selected = $info->getTableName().".*";
- return $this->findSpecificQuery($selected, $specification, $pageable, $sortable, $info);
+ return $this->findSpecificQuery($this->getAllColumns($info), $specification, $pageable, $sortable, $info);
}
/**
@@ -2164,15 +2237,187 @@ public function findSpecificQuery($selected, $specification, $pageable = null, $
* @param PicoSpecification $specification Specification
* @param PicoPageable|null $pageable Pagable
* @param PicoSortable|string|null $sortable Sortable
- * @return array|null
+ * @param array $subqueryMap
+ * @throws EntityException|EmptyResultException
+ */
+ public function findAll($specification, $pageable = null, $sortable = null, $subqueryMap = null)
+ {
+ $info = $this->getTableInfo();
+ if($subqueryMap == null)
+ {
+ return $this->findSpecific($this->getAllColumns($info), $specification, $pageable, $sortable);
+ }
+ else
+ {
+ return $this->findSpecificWithSubquery($this->getAllColumns($info), $specification, $pageable, $sortable, $subqueryMap);
+ }
+ }
+
+ /**
+ * Find one with primary key value
+ *
+ * @param mixed $primaryKeyVal
+ * @param array $subqueryMap
+ * @return array
+ */
+ public function findOneWithPrimaryKeyValue($primaryKeyVal, $subqueryMap)
+ {
+ $info = $this->getTableInfo();
+ $tableName = $info->getTableName();
+ $selected = $this->getAllColumns($info);
+ $data = null;
+ $info = $this->getTableInfo();
+ $selected = $this->joinString($selected, $this->subquery($info, $subqueryMap), self::COMMA_RETURN);
+ $primaryKey = null;
+ try
+ {
+ $primaryKeys = array_values($info->getPrimaryKeys());
+ if(is_array($primaryKeys) && isset($primaryKeys[0][self::KEY_NAME]))
+ {
+ // it will be faster than asterisk
+ $primaryKey = $primaryKeys[0][self::KEY_NAME];
+ }
+ if($primaryKey == null)
+ {
+ throw new NoPrimaryKeyDefinedException(self::MESSAGE_NO_PRIMARY_KEY_DEFINED);
+ }
+
+ $sqlQuery = new PicoDatabaseQueryBuilder($this->database);
+ $sqlQuery
+ ->select($selected)
+ ->from($tableName)
+ ->where("$primaryKey = ? ", $primaryKeyVal)
+ ->limit(1)
+ ->offset(0);
+ $stmt = $this->database->executeQuery($sqlQuery);
+ if($this->matchRow($stmt))
+ {
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $data = $this->fixDataType($row, $info);
+ $data = self::applySubqueryResult($data, $row, $subqueryMap);
+ }
+ else
+ {
+ throw new EmptyResultException(self::MESSAGE_NO_RECORD_FOUND);
+ }
+ }
+ catch(Exception $e)
+ {
+ throw new EmptyResultException($e->getMessage());
+ }
+ return $data;
+ }
+
+ /**
+ * Get all record from database wihout filter with subquery
+ *
+ * @param string $selected
+ * @param PicoSpecification $specification Specification
+ * @param PicoPageable|null $pageable Pagable
+ * @param PicoSortable|string|null $sortable Sortable
+ * @param array $subqueryMap
* @throws EntityException|EmptyResultException
*/
- public function findAll($specification, $pageable = null, $sortable = null)
+ public function findSpecificWithSubquery($selected, $specification, $pageable = null, $sortable = null, $subqueryMap = null)
{
- $info = $this->getTableInfo();
- $selected = $info->getTableName().".*";
- return $this->findSpecific($selected, $specification, $pageable, $sortable);
+ $data = null;
+ $result = array();
+ $info = $this->getTableInfo();
+ if($subqueryMap != null)
+ {
+ $selected = $this->joinString($selected, $this->subquery($info, $subqueryMap), self::COMMA_RETURN);
+ }
+ $sqlQuery = $this->findSpecificQuery($selected, $specification, $pageable, $sortable, $info);
+
+ try
+ {
+ $stmt = $this->database->executeQuery($sqlQuery);
+ if($this->matchRow($stmt))
+ {
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT))
+ {
+ $data = $this->fixDataType($row, $info);
+ if($subqueryMap == null)
+ {
+ $data = $this->join($data, $row, $info);
+ }
+ else
+ {
+ $data = self::applySubqueryResult($data, $row, $subqueryMap);
+ }
+ $result[] = $data;
+ }
+ }
+ else
+ {
+ throw new EmptyResultException(self::MESSAGE_NO_RECORD_FOUND);
+ }
+ }
+ catch(Exception $e)
+ {
+ throw new EmptyResultException($e->getMessage());
+ }
+ return $result;
+ }
+
+ /**
+ * Create subquery
+ *
+ * @param PicoTableInfo $info
+ * @param array $subqueryMap
+ * @return string
+ */
+ public function subquery($info, $subqueryMap)
+ {
+ $subquery = array();
+ $tableName = $info->getTableName();
+ if(isset($subqueryMap) && is_array($subqueryMap))
+ {
+ $idx = 1;
+ foreach($subqueryMap as $info)
+ {
+ $joinTableName = $info['tableName'];
+ $columnName = $info['columnName'];
+ $primaryKey = $info['primaryKey'];
+ $objectNameSub = $info['objectName'];
+ $propertyName = $info['propertyName'];
+ $joinName = $info['tableName']."_".$idx;
+ $selection = $info['tableName']."_".$idx.".".$propertyName;
+ $queryBuilder = new PicoDatabaseQueryBuilder($this->database);
+ $queryBuilder
+ ->select($selection)
+ ->from("$joinTableName $joinName")
+ ->where("$joinName.$primaryKey = $tableName.$columnName")
+ ->limit(1)
+ ->offset(0);
+ $subquery[] = "(".$queryBuilder.") as $objectNameSub";
+ $idx++;
+ }
+ }
+ return implode(self::COMMA_RETURN, $subquery);
}
+
+ /**
+ * Join string with separator
+ *
+ * @param string $string1
+ * @param string $string2
+ * @param string $separator
+ * @return string
+ */
+ public function joinString($string1, $string2, $separator)
+ {
+ if(!empty($string1) && !empty($string2))
+ {
+ return $string1.$separator.$string2;
+ }
+ else
+ {
+ return $string1;
+ }
+ }
+
+
/**
* Get all record from database wihout filter
@@ -2196,9 +2441,7 @@ public function findSpecific($selected, $specification, $pageable = null, $sorta
$stmt = $this->database->executeQuery($sqlQuery);
if($this->matchRow($stmt))
{
- $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
- $data = array();
- foreach($rows as $row)
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT))
{
$data = $this->fixDataType($row, $info);
$data = $this->join($data, $row, $info);
@@ -2218,29 +2461,32 @@ public function findSpecific($selected, $specification, $pageable = null, $sorta
}
/**
- * Get all mathced record from database
+ * Get query for all mathced record from database
*
* @param string $propertyName Property name
* @param mixed $propertyValue Property value
* @param PicoPageable $pageable Pagable
* @param PicoSortable|string $sortable Sortable
- * @return array|null
+ * @param PicoTableInfo $info Table info
+ * @return PicoDatabaseQueryBuilder
* @throws PDOException|NoDatabaseConnectionException|EntityException
*/
- public function findBy($propertyName, $propertyValue, $pageable = null, $sortable = null)
+ public function findByQuery($propertyName, $propertyValue, $pageable = null, $sortable = null, $info = null, $subqueryMap = null)
{
- $info = $this->getTableInfo();
+ $selected = $this->getAllColumns($info);
+ if($subqueryMap != null)
+ {
+ $selected = $this->joinString($selected, $this->subquery($info, $subqueryMap), self::COMMA_RETURN);
+ }
$where = $this->createWhereFromArgs($info, $propertyName, $propertyValue);
if(!$this->isValidFilter($where))
{
throw new InvalidFilterException(self::MESSAGE_INVALID_FILTER);
}
$queryBuilder = new PicoDatabaseQueryBuilder($this->database);
- $data = null;
- $result = array();
$sqlQuery = $queryBuilder
->newQuery()
- ->select($info->getTableName().".*")
+ ->select($selected)
->from($info->getTableName())
->where($where);
if($pageable != null)
@@ -2251,14 +2497,35 @@ public function findBy($propertyName, $propertyValue, $pageable = null, $sortabl
{
$sqlQuery = $this->setSortable($sqlQuery, $pageable, $sortable, $info);
}
+
+ return $sqlQuery;
+ }
+
+ /**
+ * Get all mathced record from database
+ *
+ * @param string $propertyName Property name
+ * @param mixed $propertyValue Property value
+ * @param PicoPageable $pageable Pagable
+ * @param PicoSortable|string $sortable Sortable
+ * @param array $subqueryMap
+ * @return array|null
+ * @throws PDOException|NoDatabaseConnectionException|EntityException
+ */
+ public function findBy($propertyName, $propertyValue, $pageable = null, $sortable = null, $subqueryMap = null)
+ {
+ $info = $this->getTableInfo();
+ $data = null;
+ $result = array();
+
+ $sqlQuery = $this->findByQuery($propertyName, $propertyValue, $pageable, $sortable, $info, $subqueryMap);
+
try
{
$stmt = $this->database->executeQuery($sqlQuery);
if($this->matchRow($stmt))
{
- $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
- $data = array();
- foreach($rows as $row)
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT))
{
$data = $this->fixDataType($row, $info);
$data = $this->join($data, $row, $info);
@@ -2268,7 +2535,7 @@ public function findBy($propertyName, $propertyValue, $pageable = null, $sortabl
}
catch(PDOException $e)
{
- throw new PDOException($e->getMessage());
+ throw new PDOException($e->getMessage(), intval($e->getCode()));
}
catch(NoDatabaseConnectionException $e)
{
@@ -2296,27 +2563,45 @@ public function existsBy($propertyName, $propertyValue)
/**
* Get all record from database wihout filter
*
- * @param PicoSpecification $specification Specification
+ * @param PicoSpecification|null $specification Specification
* @return integer
* @throws EntityException|EmptyResultException
*/
public function countAll($specification)
{
$info = $this->getTableInfo();
+ $primaryKeys = array_values($info->getPrimaryKeys());
+ if(is_array($primaryKeys) && isset($primaryKeys[0][self::KEY_NAME]))
+ {
+ // it will be faster than asterisk
+ $agg = $primaryKeys[0][self::KEY_NAME];
+ }
+ else
+ {
+ $agg = "*";
+ }
$queryBuilder = new PicoDatabaseQueryBuilder($this->database);
$sqlQuery = $queryBuilder
->newQuery()
- ->select($info->getTableName().".*")
- ->from($info->getTableName());
-
- if($specification->isRequireJoin())
- {
- $sqlQuery = $this->addJoinQuery($sqlQuery, $info);
- }
- if($specification != null)
+ ->select($this->getAllColumns($info))
+ ->from($info->getTableName());
+
+ if($specification != null && $specification instanceof PicoSpecification)
{
+ if($this->isRequireJoinFromSpecification($specification))
+ {
+ $sqlQuery = $this->addJoinQuery($sqlQuery, $info);
+ }
$sqlQuery = $this->setSpecification($sqlQuery, $specification, $info);
}
+ else
+ {
+ $sqlQuery = $queryBuilder
+ ->newQuery()
+ ->select($agg)
+ ->from($info->getTableName())
+ ;
+ }
try
{
$stmt = $this->database->executeQuery($sqlQuery);
@@ -2439,7 +2724,7 @@ public function findOneBy($propertyName, $propertyValue, $sortable = null)
$data = null;
$sqlQuery = $queryBuilder
->newQuery()
- ->select($info->getTableName().".*")
+ ->select($this->getAllColumns($info))
->from($info->getTableName())
->where($where);
$sqlQuery = $this->setSortable($sqlQuery, null, $sortable, $info);
@@ -2517,7 +2802,7 @@ private function getRealClassName($classNameJoin)
$reflect = new ExtendedReflectionClass($this->className);
$useStatements = $reflect->getUseStatements();
$this->namespaceName = $reflect->getNamespaceName();
- if(isset($useStatements) && is_array($useStatements))
+ if($this->isArray($useStatements))
{
foreach($useStatements as $val)
{
@@ -2620,7 +2905,7 @@ private function getJoinData($classNameJoin, $joinKey)
* @param PicoTableInfo $info Table information
* @return object
*/
- private function join($data, $row, $info)
+ public function join($data, $row, $info)
{
if(!empty($info->getJoinColumns()))
{
@@ -2698,15 +2983,17 @@ private function notNullAndNotEmptyAndNotSpace($value)
* @param PicoTableInfo $info Table information
* @return array
*/
- private function fixDataType($data, $info)
+ public function fixDataType($data, $info)
{
$result = array();
$typeMap = $this->createTypeMap($info);
- foreach($data as $columnName=>$value)
+ foreach($info->getColumns() as $prop=>$column)
{
+ $columnName = $column[self::KEY_NAME];
+ $value = $data[$columnName];
if(isset($typeMap[$columnName]))
{
- $result[$columnName] = $this->fixData($value, $typeMap[$columnName]);
+ $result[$prop] = $this->fixData($value, $typeMap[$columnName]);
}
}
return $result;
@@ -2960,7 +3247,7 @@ private function _select($info = null, $queryBuilder = null, $where = null, $spe
$data = null;
$sqlQuery = $queryBuilder
->newQuery()
- ->select($info->getTableName().".*")
+ ->select($this->getAllColumns($info))
->from($info->getTableName());
if($this->isRequireJoin($specification, $pageable, $sortable, $info))
@@ -3021,7 +3308,7 @@ private function _selectAll($info = null, $queryBuilder = null, $where = null, $
$data = null;
$sqlQuery = $queryBuilder
->newQuery()
- ->select($info->getTableName().".*")
+ ->select($this->getAllColumns($info))
->from($info->getTableName());
if($this->isRequireJoin($specification, $pageable, $sortable, $info))
@@ -3034,8 +3321,7 @@ private function _selectAll($info = null, $queryBuilder = null, $where = null, $
$stmt = $this->database->executeQuery($sqlQuery);
if($this->matchRow($stmt))
{
- $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
- foreach($rows as $row)
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT))
{
$data = $this->fixDataType($row, $info);
$data = $this->join($data, $row, $info);
@@ -3083,7 +3369,7 @@ private function _selectQuery($info = null, $queryBuilder = null, $where = null)
}
return $queryBuilder
->newQuery()
- ->select($info->getTableName().".*")
+ ->select($this->getAllColumns($info))
->from($info->getTableName())
->where($where);
}
@@ -3275,4 +3561,15 @@ public function whereWithSpecification($specification)
return $persist;
}
-}
\ No newline at end of file
+
+ /**
+ * Check if parameter is array
+ *
+ * @param mixed $array
+ * @return boolean
+ */
+ public function isArray($array)
+ {
+ return isset($array) && is_array($array);
+ }
+}
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabasePersistenceExtended.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabasePersistenceExtended.php
index 9b83f6f7..51f45316 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabasePersistenceExtended.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoDatabasePersistenceExtended.php
@@ -2,10 +2,8 @@
namespace MagicObject\Database;
-use MagicObject\Exceptions\EntityException;
use MagicObject\Exceptions\NoRecordFoundException;
use MagicObject\MagicObject;
-use PDOStatement;
class PicoDatabasePersistenceExtended extends PicoDatabasePersistence
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoEntityField.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoEntityField.php
index 33dd82fd..dc971af3 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoEntityField.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoEntityField.php
@@ -10,6 +10,13 @@ class PicoEntityField
* @var string
*/
private $entity = null;
+
+ /**
+ * Object name
+ *
+ * @var string
+ */
+ private $objectName = null;
/**
* Field
@@ -76,16 +83,26 @@ public function getFunctionFormat()
* Constructor
*
* @param string $fieldRaw
+ * @param PicoTableInfo|null $info
*/
- public function __construct($fieldRaw)
+ public function __construct($fieldRaw, $info = null)
{
$field = $this->extractField($fieldRaw);
if(strpos($field, "."))
{
$arr = explode(".", $field, 2);
$this->field = $arr[1];
- $this->entity = $arr[0];
- $this->parentField = $arr[0];
+ $this->objectName = $arr[0];
+ $this->parentField = $arr[0];
+
+ if($info != null && $info->getJoinColumns() != null)
+ {
+ $columns = $info->getJoinColumns();
+ if(isset($columns[$this->objectName]) && isset($columns[$this->objectName]['propertyType']))
+ {
+ $this->entity = $columns[$this->objectName]['propertyType'];
+ }
+ }
}
else
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoJoinMap.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoJoinMap.php
index ad3c1b72..58cb56ea 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoJoinMap.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoJoinMap.php
@@ -42,11 +42,11 @@ class PicoJoinMap
/**
* Constructor
*
- * @param string $propertyName
- * @param string $columnName
- * @param string $entity
- * @param string $joinTable
- * @param string $joinTableAlias
+ * @param string $propertyName Property name
+ * @param string $columnName Column name
+ * @param string $entity Entity name
+ * @param string $joinTable Join table name
+ * @param string $joinTableAlias Join table alias
*/
public function __construct($propertyName, $columnName, $entity, $joinTable, $joinTableAlias)
{
@@ -116,11 +116,11 @@ public function __toString()
{
return json_encode(
array(
- 'propertyName'=>$this->propertyName,
- 'columnName'=>$this->columnName,
- 'entity'=>$this->entity,
- 'joinTable'=>$this->joinTable,
- 'joinTableAlias'=>$this->joinTableAlias
+ 'propertyName' => $this->propertyName,
+ 'columnName' => $this->columnName,
+ 'entity' => $this->entity,
+ 'joinTable' => $this->joinTable,
+ 'joinTableAlias' => $this->joinTableAlias
)
);
}
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoLimit.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoLimit.php
index 6f293caf..e25b1732 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoLimit.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoLimit.php
@@ -86,6 +86,11 @@ public function setOffset($offset)
*/
public function __toString()
{
- return json_encode(array('limit'=>$this->limit, 'offset'=>$this->offset));
+ return json_encode(
+ array(
+ 'limit' => $this->limit,
+ 'offset' => $this->offset
+ )
+ );
}
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPage.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPage.php
index 66b417cd..fdcc9be0 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPage.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPage.php
@@ -84,9 +84,11 @@ public function setPageSize($pageSize)
*/
public function __toString()
{
- return json_encode(array(
- 'pageNumber'=>$this->pageNumber,
- 'pageSize'=>$this->pageSize
- ));
+ return json_encode(
+ array(
+ 'pageNumber' => $this->pageNumber,
+ 'pageSize' => $this->pageSize
+ )
+ );
}
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageControl.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageControl.php
new file mode 100644
index 00000000..0ce8731d
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageControl.php
@@ -0,0 +1,143 @@
+pageData = $pageData;
+ if(isset($parameterName))
+ {
+ $this->parameterName = $parameterName;
+ }
+ if(isset($path))
+ {
+ $this->path = $path;
+ }
+ }
+
+ /**
+ * Set navigation
+ *
+ * @param string $prev
+ * @param string $next
+ * @param string $first
+ * @param string $last
+ * @return self
+ */
+ public function setNavigation($prev = null, $next = null, $first = null, $last = null)
+ {
+ $this->prev = $prev;
+ $this->next = $next;
+ $this->first = $first;
+ $this->last = $last;
+ return $this;
+ }
+
+ /**
+ * To HTML
+ *
+ * @return string
+ */
+ public function toHTML()
+ {
+ return $this->__toString();
+ }
+
+ public function __toString()
+ {
+ $lines = array();
+ $format = '%s';
+ $lastNavPg = 1;
+
+ if(isset($this->first) && $this->pageData->getPageNumber() > 2)
+ {
+ $lines[] = sprintf($format, '', 1, PicoPagination::getPageUrl(1, $this->parameterName, $this->path), $this->first);
+ }
+
+ if(isset($this->prev) && $this->pageData->getPageNumber() > 1)
+ {
+ $prevPg = $this->pageData->getPageNumber() - 1;
+ $lines[] = sprintf($format, '', $prevPg, PicoPagination::getPageUrl($prevPg, $this->parameterName, $this->path), $this->prev);
+ }
+
+ foreach($this->pageData->getPagination() as $pg)
+ {
+ $lastNavPg = $pg['page'];
+ $selected = $pg['selected'] ? ' page-selected' : '';
+ $lines[] = sprintf($format, $selected, $lastNavPg, PicoPagination::getPageUrl($lastNavPg, $this->parameterName, $this->path), $lastNavPg);
+ }
+
+ if(isset($this->next) && $this->pageData->getPageNumber() < ($this->pageData->getTotalPage()))
+ {
+ $nextPg = $this->pageData->getPageNumber() + 1;
+ $lines[] = sprintf($format, '', $nextPg, PicoPagination::getPageUrl($nextPg, $this->parameterName, $this->path), $this->next);
+ }
+
+ if(isset($this->last) && $this->pageData->getPageNumber() < ($this->pageData->getTotalPage() - 1))
+ {
+ $lastPg = $this->pageData->getTotalPage();
+ $lines[] = sprintf($format, '', $lastPg, PicoPagination::getPageUrl($lastPg, $this->parameterName, $this->path), $this->last);
+ }
+
+ return implode('', $lines);
+ }
+}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageData.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageData.php
index 9796a8b1..78c3f249 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageData.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageData.php
@@ -2,7 +2,10 @@
namespace MagicObject\Database;
+use MagicObject\Exceptions\FindOptionException;
use MagicObject\MagicObject;
+use PDO;
+use PDOStatement;
use stdClass;
class PicoPageData
@@ -48,6 +51,13 @@ class PicoPageData
* @var integer
*/
private $pageSize = 0;
+
+ /**
+ * Data offset
+ *
+ * @var integer
+ */
+ private $dataOffset = 0;
/**
* Start time
@@ -77,6 +87,41 @@ class PicoPageData
*/
private $pagination = array();
+ /**
+ * PDO statement
+ *
+ * @var PDOStatement
+ */
+ private $stmt = null;
+
+ /**
+ * Class name
+ *
+ * @var string
+ */
+ private $className;
+
+ /**
+ * Subquery info
+ *
+ * @var array
+ */
+ private $subqueryMap;
+
+ /**
+ * By count result
+ *
+ * @var boolean
+ */
+ private $byCountResult = false;
+
+ /**
+ * Entity
+ *
+ * @var MagicObject
+ */
+ private $entity;
+
/**
* Constructor
*
@@ -85,17 +130,18 @@ class PicoPageData
* @param integer $totalResult
* @param PicoPageable $pageable
*/
- public function __construct($result, $startTime, $totalResult = 0, $pageable = null)
+ public function __construct($result, $startTime, $totalResult = 0, $pageable = null, $stmt = null, $entity = null, $subqueryMap = null)
{
$this->startTime = $startTime;
$this->result = $result;
- $countResult = count($result);
+ $countResult = $this->countData($result);
if($totalResult != 0)
{
$this->totalResult = $totalResult;
}
else
{
+ $this->byCountResult = true;
$this->totalResult = $countResult;
}
if($pageable != null && $pageable instanceof PicoPageable)
@@ -108,9 +154,38 @@ public function __construct($result, $startTime, $totalResult = 0, $pageable = n
$this->pageNumber = 1;
$this->totalPage = 1;
$this->pageSize = $countResult;
+ $this->dataOffset = 0;
}
$this->endTime = microtime(true);
$this->executionTime = $this->endTime - $this->startTime;
+ if($stmt != null)
+ {
+ $this->stmt = $stmt;
+ }
+ if($entity != null)
+ {
+ $this->entity = $entity;
+ $this->className = get_class($entity);
+ }
+ if($subqueryMap != null)
+ {
+ $this->subqueryMap = $subqueryMap;
+ }
+ }
+
+ /**
+ * Count data
+ *
+ * @param array $result
+ * @return integer
+ */
+ private function countData($result)
+ {
+ if(isset($result) && is_array($result))
+ {
+ return count($result);
+ }
+ return 0;
}
@@ -123,7 +198,9 @@ private function calculateContent()
{
$this->pageNumber = $this->pageable->getPage()->getPageNumber();
$this->totalPage = ceil($this->totalResult / $this->pageable->getPage()->getPageSize());
+
$this->pageSize = $this->pageable->getPage()->getPageSize();
+ $this->dataOffset = ($this->pageNumber - 1) * $this->pageSize;
$curPage = $this->pageNumber;
$totalPage = $this->totalPage;
@@ -134,12 +211,12 @@ private function calculateContent()
$minPage = 1;
}
$maxPage = $curPage + 3;
- if($maxPage > $totalPage)
+ if(!$this->byCountResult && $maxPage > $totalPage)
{
$maxPage = $totalPage;
}
$this->pagination = array();
- for($i = $minPage; $i<=$maxPage; $i++)
+ for($i = $minPage; $i <= $maxPage; $i++)
{
$this->pagination[] = array('page'=>$i, 'selected'=>$i == $curPage);
}
@@ -193,9 +270,21 @@ public function getPageSize()
public function __toString()
{
$obj = new stdClass;
+ $exposedProps = array(
+ "pageable",
+ "totalResult",
+ "totalPage",
+ "pageNumber",
+ "pageSize",
+ "dataOffset",
+ "startTime",
+ "endTime",
+ "executionTime",
+ "pagination"
+ );
foreach($this as $key=>$value)
{
- if($key != self::RESULT && $key != self::PAGABLE)
+ if($key != self::RESULT && $key != self::PAGABLE && in_array($key, $exposedProps))
{
$obj->{$key} = $value;
}
@@ -221,6 +310,18 @@ public function getPagination()
return $this->pagination;
}
+ /**
+ * Get page control
+ *
+ * @param string $parameterName
+ * @param string $path
+ * @return PicoPageControl
+ */
+ public function getPageControl($parameterName = 'page', $path = null)
+ {
+ return new PicoPageControl($this, $parameterName, $path);
+ }
+
/**
* Get total match
*
@@ -240,4 +341,85 @@ public function getPagable()
{
return $this->pageable;
}
+
+ /**
+ * Get data offset
+ *
+ * @return integer
+ */
+ public function getDataOffset()
+ {
+ return $this->dataOffset;
+ }
+
+ /**
+ * Get PDO statement
+ *
+ * @return PDOStatement
+ */
+ public function getPDOStatement()
+ {
+ if($this->stmt == null)
+ {
+ throw new FindOptionException("Statement is null. See MagicObject::FIND_OPTION_NO_FETCH_DATA option");
+ }
+ return $this->stmt;
+ }
+
+ /**
+ * Fetch data
+ *
+ * @return MagicObject|mixed
+ */
+ public function fetch()
+ {
+ if($this->stmt == null)
+ {
+ throw new FindOptionException("Statement is null. See MagicObject::FIND_OPTION_NO_FETCH_DATA option");
+ }
+ $result = $this->stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT);
+ if($result === false)
+ {
+ return false;
+ }
+ return $this->applySubqueryResult($result);
+ }
+
+ /**
+ * Apply subquery result
+ *
+ * @param array $row
+ * @return MagicObject
+ */
+ public function applySubqueryResult($row)
+ {
+ $data = $row;
+ if(isset($this->subqueryMap) && is_array($this->subqueryMap))
+ {
+ foreach($this->subqueryMap as $info)
+ {
+ $objectName = $info['objectName'];
+ $objectNameSub = $info['objectName'];
+ if(isset($row[$objectNameSub]))
+ {
+ $data[$objectName] = (new MagicObject())
+ ->set($info['primaryKey'], $row[$info['columnName']])
+ ->set($info['propertyName'], $row[$objectNameSub])
+ ;
+ }
+ else
+ {
+ $data[$objectName] = new MagicObject();
+ }
+ }
+ }
+ else
+ {
+ $persist = new PicoDatabasePersistence($this->entity->currentDatabase(), $this->entity);
+ $info = $this->entity->tableInfo();
+ $data = $persist->fixDataType($row, $info);
+ $data = $persist->join($data, $row, $info);
+ }
+ return new $this->className($data);
+ }
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageable.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageable.php
index 44a2efb9..aefe1764 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageable.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPageable.php
@@ -98,8 +98,8 @@ public function setSortable(PicoSortable $sortable)
/**
* Add sortable
*
- * @param string $sortBy
- * @param string $sortType
+ * @param string $sortBy Sort by
+ * @param string $sortType Sort type
* @return self
*/
public function addSortable($sortBy, $sortType)
@@ -115,7 +115,7 @@ public function addSortable($sortBy, $sortType)
/**
* Create sort by
*
- * @param PicoTableInfo $tableInfo
+ * @param PicoTableInfo $tableInfo Table information
* @return string|null
*/
public function createOrderBy($tableInfo)
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPredicate.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPredicate.php
index 8e84a53d..aff58def 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPredicate.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoPredicate.php
@@ -314,6 +314,17 @@ public static function getInstance()
return new PicoPredicate();
}
+ /**
+ * Function lower
+ *
+ * @param string $value
+ * @return string
+ */
+ public static function functionLower($value)
+ {
+ return "lower($value)";
+ }
+
/**
* Magic method to debug object
*
@@ -322,13 +333,13 @@ public static function getInstance()
public function __toString()
{
return json_encode(array(
- 'field'=>$this->field,
- 'value'=>$this->value,
- 'comparation'=>
+ 'field' => $this->field,
+ 'value' => $this->value,
+ 'comparation' =>
array(
$this->comparation->getComparison()
),
- 'filterLogic'=>$this->filterLogic
+ 'filterLogic' => $this->filterLogic
));
}
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSort.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSort.php
index 9deeead8..d840a736 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSort.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSort.php
@@ -6,6 +6,7 @@ class PicoSort
{
const ORDER_TYPE_ASC = "asc";
const ORDER_TYPE_DESC = "desc";
+ const SORT_BY = "sortBy";
/**
* Sort by
*
@@ -77,13 +78,13 @@ public function setSortType($sortType)
/**
* Magic method
*
- * @param string $method
- * @param array $params
+ * @param string $method Method name
+ * @param array $params Parameters
* @return self|mixed|null
*/
public function __call($method, $params)
{
- if (strncasecmp($method, "sortBy", 6) === 0 && isset($params) && isset($params[0])){
+ if (strncasecmp($method, self::SORT_BY, 6) === 0 && isset($params) && isset($params[0])){
$field = lcfirst(substr($method, 6));
$value = $params[0];
$this->setSortBy($field);
@@ -110,7 +111,7 @@ public static function getInstance()
*/
public static function fixSortType($type)
{
- return strtolower($type) == 'desc' ? self::ORDER_TYPE_DESC : self::ORDER_TYPE_ASC;
+ return strcasecmp($type, self::ORDER_TYPE_DESC) == 0 ? self::ORDER_TYPE_DESC : self::ORDER_TYPE_ASC;
}
/**
@@ -121,8 +122,8 @@ public static function fixSortType($type)
public function __toString()
{
return json_encode(array(
- 'sortBy'=>$this->sortBy,
- 'sortType'=>$this->sortType
+ 'sortBy' => $this->sortBy,
+ 'sortType' => $this->sortType
));
}
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSortable.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSortable.php
index e8c5019f..ce3b2334 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSortable.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSortable.php
@@ -3,6 +3,7 @@
namespace MagicObject\Database;
use MagicObject\Request\PicoRequestBase;
+use MagicObject\Util\PicoStringUtil;
class PicoSortable
{
@@ -32,6 +33,7 @@ public function __construct()
$this->initSortable($argc, $params);
}
}
+
/**
* Initialize sortable
*
@@ -117,7 +119,7 @@ public function createSortable($sortBy, $sortType)
/**
* Create sort by
*
- * @param PicoTableInfo $tableInfo
+ * @param PicoTableInfo $tableInfo Table information
* @return string
*/
public function createOrderBy($tableInfo = null)
@@ -168,7 +170,7 @@ private function createWithoutMapping()
/**
* Create sort with mapping
*
- * @param PicoTableInfo $tableInfo
+ * @param PicoTableInfo $tableInfo Table information
* @return string
*/
private function createWithMapping($tableInfo)
@@ -204,6 +206,16 @@ private function createWithMapping($tableInfo)
return $ret;
}
+ /**
+ * Check id specification is empty or not
+ *
+ * @return boolean
+ */
+ public function isEmpty()
+ {
+ return empty($this->sortable);
+ }
+
/**
* Get sortable
*
@@ -238,22 +250,45 @@ public function __toString()
* Get sortable from user input
*
* @param PicoRequestBase $request
- * @param string[] $map
+ * @param string[]|null $map
+ * @param array|null $defaultSortable
* @return PicoSortable
*/
- public static function fromUserInput($request, $map)
+ public static function fromUserInput($request, $map = null, $defaultSortable = null)
{
$sortable = new PicoSortable();
- if($map != null && is_array($map))
+ if(self::isArray($map))
{
foreach($map as $key=>$value)
{
- if($request->getOrderby() == $key)
+ if(PicoStringUtil::camelize($request->getOrderby()) == PicoStringUtil::camelize($key))
{
$sortable->add(new PicoSort($value, PicoSort::fixSortType($request->getOrdertype())));
}
}
}
+ if($sortable->isEmpty() && self::isArray($defaultSortable))
+ {
+ // no filter from user input
+ foreach($defaultSortable as $filter)
+ {
+ if(isset($filter['sortBy']) && isset($filter['sortType']))
+ {
+ $sortable->add(new PicoSort($filter['sortBy'], $filter['sortType']));
+ }
+ }
+ }
return $sortable;
}
+
+ /**
+ * Check if input is array
+ *
+ * @param mixed $array
+ * @return boolean
+ */
+ public static function isArray($array)
+ {
+ return isset($array) && is_array($array);
+ }
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSpecification.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSpecification.php
index e3b2d9c6..8df2af00 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSpecification.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSpecification.php
@@ -2,6 +2,7 @@
namespace MagicObject\Database;
+use MagicObject\Request\PicoRequestBase;
use MagicObject\Util\Database\PicoDatabaseUtil;
class PicoSpecification
@@ -147,7 +148,6 @@ private function addSubFilter($predicate, $logic)
return $this;
}
-
/**
* Check id specification is empty or not
*
@@ -158,7 +158,6 @@ public function isEmpty()
return empty($this->specifications);
}
-
/**
* Get predicate
*
@@ -200,6 +199,7 @@ public function setParentFilterLogic($parentFilterLogic)
*/
private function getWhere($specifications)
{
+ $arr = array();
foreach($specifications as $spec)
{
if($spec instanceof PicoPredicate)
@@ -237,14 +237,34 @@ private function createWhereFromSpecification($specification)
{
$entityField = new PicoEntityField($spec->getField());
$field = $entityField->getField();
+ $functionFormat = $entityField->getFunctionFormat();
+
$entityName = $entityField->getEntity();
$column = ($entityName == null) ? $field : $entityName.".".$field;
- $arr[] = $spec->getFilterLogic() . " " . $column . " " . $spec->getComparation()->getComparison() . " " . PicoDatabaseUtil::escapeValue($spec->getValue());
+ $columnFinal = $this->formatColumn($column, $functionFormat);
+
+ $arr[] = $spec->getFilterLogic() . " " . $columnFinal . " " . $spec->getComparation()->getComparison() . " " . PicoDatabaseUtil::escapeValue($spec->getValue());
}
}
return PicoDatabaseUtil::trimWhere(implode(" ", $arr));
}
+ /**
+ * Format column
+ *
+ * @param string $column Column name
+ * @param string $format Format
+ * @return string
+ */
+ private function formatColumn($column, $format)
+ {
+ if($format == null || strpos($format, "%s") === false)
+ {
+ return $column;
+ }
+ return sprintf($format, $column);
+ }
+
/**
* Get instance of PicoSpecification
*
@@ -274,22 +294,67 @@ public function __toString()
* Get specification from user input
*
* @param PicoRequestBase $request
- * @param string[] $map
+ * @param PicoSpecificationFilter[]|null $map
* @return PicoSpecification
*/
- public static function fromUserInput($request, $map)
+ public static function fromUserInput($request, $map = null)
{
$specification = new PicoSpecification();
- if($map != null && is_array($map))
+ if(isset($map) && is_array($map))
{
- foreach($map as $key=>$value)
+ foreach($map as $key=>$filter)
{
- if($request->get($key) !== null)
+ $filterValue = $request->get($key);
+ if($filterValue != null && trim($filterValue) != "" && $filter instanceof PicoSpecificationFilter)
{
- $specification->addAnd(new PicoPredicate($value, $request->get($key)));
+ if($filter->isNumber() || $filter->isBoolean())
+ {
+ $specification->addAnd(PicoPredicate::getInstance()->equals($filter->getColumnName(), $filter->valueOf($filterValue)));
+ }
+ else if($filter->isFulltext())
+ {
+ $specification->addAnd(self::fullTextSearch($filter->getColumnName(), $filterValue));
+ }
+ else
+ {
+ $specification->addAnd(PicoPredicate::getInstance()->like(PicoPredicate::functionLower($filter->getColumnName()), PicoPredicate::generateCenterLike(strtolower($filterValue))));
+ }
}
}
}
return $specification;
}
+
+ /**
+ * Create full text search
+ *
+ * @param string $columnName
+ * @param string $keywords
+ * @return self
+ */
+ public static function fullTextSearch($columnName, $keywords)
+ {
+ $specification = new self;
+ $arr = explode(" ", $keywords);
+ foreach($arr as $word)
+ {
+ if(!empty($word))
+ {
+ $specification->addAnd(PicoPredicate::getInstance()->like(PicoPredicate::functionLower($columnName), PicoPredicate::generateCenterLike(strtolower($word))));
+ }
+ }
+ return $specification;
+ }
+
+ /**
+ * Filter
+ *
+ * @param string $columnName
+ * @param string $dataType
+ * @return PicoSpecificationFilter
+ */
+ public static function filter($columnName, $dataType)
+ {
+ return new PicoSpecificationFilter($columnName, $dataType);
+ }
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSpecificationFilter.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSpecificationFilter.php
new file mode 100644
index 00000000..9f89ad93
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoSpecificationFilter.php
@@ -0,0 +1,144 @@
+columnName = $columnName;
+ $this->dataType = $dataType;
+ }
+
+ /**
+ * Get value
+ *
+ * @return mixed
+ */
+ public function valueOf($stringValue)
+ {
+ if($this->isNumber())
+ {
+ return $this->getNumber($stringValue);
+ }
+ else if($this->isBoolean())
+ {
+ return $this->getBoolean($stringValue);
+ }
+ else
+ {
+ return $stringValue;
+ }
+ }
+
+ /**
+ * Get number value
+ *
+ * @return float|integer
+ */
+ private function getNumber($stringValue)
+ {
+ if(strpos($stringValue, ".") !== false)
+ {
+ return floatval($stringValue);
+ }
+ else
+ {
+ return intval($stringValue);
+ }
+ }
+
+ /**
+ * Get boolean value
+ *
+ * @return boolean
+ */
+ private function getBoolean($stringValue)
+ {
+ return strcasecmp($stringValue, "yes") === 0
+ || strcasecmp($stringValue, "true") === 0
+ || $stringValue === "1"
+ || $stringValue === 1
+ ;
+ }
+
+ /**
+ * Check if data type is a number
+ *
+ * @return boolean
+ */
+ public function isNumber()
+ {
+ return $this->dataType == "number";
+ }
+
+ /**
+ * Check if data type is full text
+ *
+ * @return boolean
+ */
+ public function isFulltext()
+ {
+ return $this->dataType == "fulltext";
+ }
+
+ /**
+ * Check if data type is a string
+ *
+ * @return boolean
+ */
+ public function isString()
+ {
+ return $this->dataType == "string";
+ }
+
+ /**
+ * Check if data type is a boolean
+ *
+ * @return boolean
+ */
+ public function isBoolean()
+ {
+ return $this->dataType == "boolean";
+ }
+
+ /**
+ * Get column name
+ *
+ * @return string
+ */
+ public function getColumnName()
+ {
+ return $this->columnName;
+ }
+
+ /**
+ * Get data type
+ *
+ * @return string
+ */
+ public function getDataType()
+ {
+ return $this->dataType;
+ }
+}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoTableInfo.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoTableInfo.php
index 0da9946a..90ededc8 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoTableInfo.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoTableInfo.php
@@ -2,8 +2,6 @@
namespace MagicObject\Database;
-use Exception;
-use ReflectionProperty;
use stdClass;
class PicoTableInfo
@@ -13,64 +11,74 @@ class PicoTableInfo
*
* @var string
*/
- private $tableName = null;
+ protected $tableName = null;
/**
* Columns
*
* @var array
*/
- private $columns = array();
+ protected $columns = array();
/**
* Join columns
*
* @var array
*/
- private $joinColumns = array();
+ protected $joinColumns = array();
/**
* Primary keys
*
* @var array
*/
- private $primaryKeys = array();
+ protected $primaryKeys = array();
/**
* Auto increment keys
*
* @var array
*/
- private $autoIncrementKeys = array();
+ protected $autoIncrementKeys = array();
/**
* Default value keys
*
* @var array
*/
- private $defaultValue = array();
+ protected $defaultValue = array();
/**
* Not null columns
*
* @var array
*/
- private $notNullColumns = array();
+ protected $notNullColumns = array();
+
+ /**
+ * Get instance
+ *
+ * @return self
+ */
+ public static function getInstance()
+ {
+ return new self(null, array(), array(), array(), array(), array(), array());
+ }
/**
* Constructor
*
- * @param string $picoTableName
- * @param array $columns
- * @param array $joinColumns
- * @param array $primaryKeys
- * @param array $autoIncrementKeys
- * @param array $defaultValue
- * @param array $notNullColumns
+ * @param string $tableName Table name
+ * @param array $columns Columns
+ * @param array $joinColumns Join columns
+ * @param array $primaryKeys Primary keys
+ * @param array $autoIncrementKeys Auto increment keys
+ * @param array $defaultValue Columns with default value
+ * @param array $notNullColumns Columns with not null
*/
- public function __construct($picoTableName, $columns, $joinColumns, $primaryKeys, $autoIncrementKeys, $defaultValue, $notNullColumns)
+ public function __construct($tableName, $columns, $joinColumns, $primaryKeys, $autoIncrementKeys, $defaultValue, $notNullColumns)
{
- $this->tableName = $picoTableName;
+ $this->tableName = $tableName;
$this->columns = $columns;
$this->joinColumns = $joinColumns;
$this->primaryKeys = $primaryKeys;
@@ -78,6 +86,25 @@ public function __construct($picoTableName, $columns, $joinColumns, $primaryKeys
$this->defaultValue = $defaultValue;
$this->notNullColumns = $notNullColumns;
}
+
+ /**
+ * Magic method to debug object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ // create new object because all properties are private
+ $stdClass = new stdClass;
+ $stdClass->tableName = $this->tableName;
+ $stdClass->columns = $this->columns;
+ $stdClass->joinColumns = $this->joinColumns;
+ $stdClass->primaryKeys = $this->primaryKeys;
+ $stdClass->autoIncrementKeys = $this->autoIncrementKeys;
+ $stdClass->defaultValue = $this->defaultValue;
+ $stdClass->notNullColumns = $this->notNullColumns;
+ return json_encode($stdClass);
+ }
/**
* Get table name
@@ -96,7 +123,7 @@ public function getTableName()
*
* @return self
*/
- public function setTableName(string $tableName)
+ public function setTableName($tableName)
{
$this->tableName = $tableName;
@@ -120,7 +147,7 @@ public function getColumns()
*
* @return self
*/
- public function setColumns(array $columns)
+ public function setColumns($columns)
{
$this->columns = $columns;
@@ -144,7 +171,7 @@ public function getJoinColumns()
*
* @return self
*/
- public function setJoinColumns(array $joinColumns)
+ public function setJoinColumns($joinColumns)
{
$this->joinColumns = $joinColumns;
@@ -168,7 +195,7 @@ public function getPrimaryKeys()
*
* @return self
*/
- public function setPrimaryKeys(array $primaryKeys)
+ public function setPrimaryKeys($primaryKeys)
{
$this->primaryKeys = $primaryKeys;
@@ -192,7 +219,7 @@ public function getAutoIncrementKeys()
*
* @return self
*/
- public function setAutoIncrementKeys(array $autoIncrementKeys)
+ public function setAutoIncrementKeys($autoIncrementKeys)
{
$this->autoIncrementKeys = $autoIncrementKeys;
@@ -216,7 +243,7 @@ public function getDefaultValue()
*
* @return self
*/
- public function setDefaultValue(array $defaultValue)
+ public function setDefaultValue($defaultValue)
{
$this->defaultValue = $defaultValue;
@@ -240,29 +267,10 @@ public function getNotNullColumns()
*
* @return self
*/
- public function setNotNullColumns(array $notNullColumns)
+ public function setNotNullColumns($notNullColumns)
{
$this->notNullColumns = $notNullColumns;
return $this;
}
-
- /**
- * Magic method to debug object
- *
- * @return string
- */
- public function __toString()
- {
- // create new object because all properties are private
- $stdClass = new stdClass;
- $stdClass->tableName = $this->tableName;
- $stdClass->columns = $this->columns;
- $stdClass->joinColumns = $this->joinColumns;
- $stdClass->primaryKeys = $this->primaryKeys;
- $stdClass->autoIncrementKeys = $this->autoIncrementKeys;
- $stdClass->defaultValue = $this->defaultValue;
- $stdClass->notNullColumns = $this->notNullColumns;
- return json_encode($stdClass);
- }
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoTableInfoExtended.php b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoTableInfoExtended.php
new file mode 100644
index 00000000..79630965
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Database/PicoTableInfoExtended.php
@@ -0,0 +1,307 @@
+columns as $elem)
+ {
+ if(!in_array($elem[self::NAME], $test))
+ {
+ $tmp[] = $elem;
+ $test[] = $elem[self::NAME];
+ }
+ }
+ $this->columns = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique join column
+ *
+ * @return self
+ */
+ public function uniqueJoinColumns()
+ {
+ $tmp = array();
+ $test = array();
+ foreach($this->joinColumns as $elem)
+ {
+ if(!in_array($elem[self::NAME], $test))
+ {
+ $tmp[] = $elem;
+ $test[] = $elem[self::NAME];
+ }
+ }
+ $this->joinColumns = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique primary key
+ *
+ * @return self
+ */
+ public function uniquePrimaryKeys()
+ {
+ $tmp = array();
+ $test = array();
+ foreach($this->primaryKeys as $elem)
+ {
+ if(!in_array($elem[self::NAME], $test))
+ {
+ $tmp[] = $elem;
+ $test[] = $elem[self::NAME];
+ }
+ }
+ $this->primaryKeys = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique auto increment
+ *
+ * @return self
+ */
+ public function uniqueAutoIncrementKeys()
+ {
+ $tmp = array();
+ $test = array();
+ foreach($this->autoIncrementKeys as $elem)
+ {
+ if(!in_array($elem[self::NAME], $test))
+ {
+ $tmp[] = $elem;
+ $test[] = $elem[self::NAME];
+ }
+ }
+ $this->autoIncrementKeys = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique default value
+ *
+ * @return self
+ */
+ public function uniqueDefaultValue()
+ {
+ $tmp = array();
+ $test = array();
+ foreach($this->defaultValue as $elem)
+ {
+ if(!in_array($elem[self::NAME], $test))
+ {
+ $tmp[] = $elem;
+ $test[] = $elem[self::NAME];
+ }
+ }
+ $this->defaultValue = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique not null column
+ *
+ * @return self
+ */
+ public function uniqueNotNullColumns()
+ {
+ $tmp = array();
+ $test = array();
+ foreach($this->notNullColumns as $elem)
+ {
+ if(!in_array($elem[self::NAME], $test))
+ {
+ $tmp[] = $elem;
+ $test[] = $elem[self::NAME];
+ }
+ }
+ $this->notNullColumns = $tmp;
+ return $this;
+ }
+
+ /**
+ * Merge list
+ *
+ * @param array $tmp
+ * @param array $oldListCheck
+ * @param array $newList
+ * @return array
+ */
+ private function mergeList($tmp, $oldListCheck, $newList)
+ {
+ $prevColumName = "";
+ $listToInsert = array();
+ foreach($newList as $prop=>$elem)
+ {
+ if(!in_array($elem[self::NAME], $oldListCheck))
+ {
+ $listToInsert[$prop] = array(self::ELEMENT=>$elem, self::PREV_NAME=>$prevColumName);
+ }
+ $prevColumName = $elem[self::NAME];
+ }
+ foreach($listToInsert as $prop=>$toInsert)
+ {
+ if(empty($toInsert[self::PREV_NAME]))
+ {
+ // insert to the end of table
+ $tmp[$prop] = $toInsert[self::ELEMENT];
+ }
+ else
+ {
+ $tmp2 = array();
+ foreach($tmp as $prop2=>$elem2)
+ {
+ $tmp2[$prop2] = $elem2;
+ if($elem2[self::NAME] == $toInsert[self::PREV_NAME])
+ {
+ // insert after prevColumnName
+ $tmp2[$prop] = $toInsert[self::ELEMENT];
+ }
+ }
+ // update temporary list
+ $tmp = $tmp2;
+ }
+ }
+ return $tmp;
+ }
+
+ /**
+ * Get oldlist check
+ *
+ * @param array $oldList
+ * @return array
+ */
+ private function getOldListCheck($oldList)
+ {
+ $oldListCheck = array();
+ foreach($oldList as $elem)
+ {
+ $oldListCheck[] = $elem[self::NAME];
+ }
+ return $oldListCheck;
+ }
+
+ /**
+ * Unique column
+ *
+ * @param array $newList
+ * @return self
+ */
+ public function mergeColumns($newList)
+ {
+ $tmp = $this->columns;
+ $oldListCheck = $this->getOldListCheck($this->columns);
+ $tmp = $this->mergeList($tmp, $oldListCheck, $newList);
+ $this->columns = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique join column
+ *
+ * @param array $newList
+ * @return self
+ */
+ public function mergeJoinColumns($newList)
+ {
+ $tmp = $this->joinColumns;
+ $oldListCheck = $this->getOldListCheck($this->joinColumns);
+ $tmp = $this->mergeList($tmp, $oldListCheck, $newList);
+ $this->joinColumns = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique primary key
+ *
+ * @param array $newList
+ * @return self
+ */
+ public function mergePrimaryKeys($newList)
+ {
+ $tmp = $this->primaryKeys;
+ $oldListCheck = $this->getOldListCheck($this->primaryKeys);
+ $tmp = $this->mergeList($tmp, $oldListCheck, $newList);
+ $this->primaryKeys = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique auto increment
+ *
+ * @param array $newList
+ * @return self
+ */
+ public function mergeAutoIncrementKeys($newList)
+ {
+ $tmp = $this->autoIncrementKeys;
+ $oldListCheck = $this->getOldListCheck($this->autoIncrementKeys);
+ $tmp = $this->mergeList($tmp, $oldListCheck, $newList);
+ $this->autoIncrementKeys = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique default value
+ *
+ * @param array $newList
+ * @return self
+ */
+ public function mergeDefaultValue($newList)
+ {
+ $tmp = $this->defaultValue;
+ $oldListCheck = $this->getOldListCheck($this->defaultValue);
+ $tmp = $this->mergeList($tmp, $oldListCheck, $newList);
+ $this->defaultValue = $tmp;
+ return $this;
+ }
+
+ /**
+ * Unique not null column
+ *
+ * @param array $newList
+ * @return self
+ */
+ public function mergeNotNullColumns($newList)
+ {
+ $tmp = $this->notNullColumns;
+ $oldListCheck = $this->getOldListCheck($this->notNullColumns);
+ $prevColumName = "";
+ $listToInsert = array();
+ foreach($newList as $elem)
+ {
+ if(!in_array($elem[self::NAME], $oldListCheck))
+ {
+ $listToInsert[] = array(self::ELEMENT=>$elem, self::PREV_NAME=>$prevColumName);
+ }
+ $prevColumName = $elem[self::NAME];
+ }
+ $this->notNullColumns = $tmp;
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Exceptions/FindOptionException.php b/inc.lib/vendor/planetbiru/magic-object/src/Exceptions/FindOptionException.php
new file mode 100644
index 00000000..853ed192
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Exceptions/FindOptionException.php
@@ -0,0 +1,28 @@
+previous = $previous;
+ }
+ }
+}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Exceptions/InvalidInputFormatException.php b/inc.lib/vendor/planetbiru/magic-object/src/Exceptions/InvalidInputFormatException.php
new file mode 100644
index 00000000..6786744c
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Exceptions/InvalidInputFormatException.php
@@ -0,0 +1,28 @@
+previous = $previous;
+ }
+ }
+}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoColumnGenerator.php b/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoColumnGenerator.php
index 2c6ebd4e..653c33eb 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoColumnGenerator.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoColumnGenerator.php
@@ -11,8 +11,8 @@ class PicoColumnGenerator
/**
* Get column list
*
- * @param PicoDatabase $database
- * @param string $picoTableName
+ * @param PicoDatabase $database Database connection
+ * @param string $picoTableName Database name
* @return array
*/
public static function getColumnList($database, $picoTableName)
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoDatabaseDump.php b/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoDatabaseDump.php
index d3943b13..15e99b21 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoDatabaseDump.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoDatabaseDump.php
@@ -2,10 +2,12 @@
namespace MagicObject\Generator;
+use MagicObject\Database\PicoDatabase;
use MagicObject\Database\PicoDatabasePersistence;
use MagicObject\Database\PicoDatabaseType;
use MagicObject\Database\PicoPageData;
use MagicObject\Database\PicoTableInfo;
+use MagicObject\Database\PicoTableInfoExtended;
use MagicObject\MagicObject;
use MagicObject\Util\Database\PicoDatabaseUtil;
use MagicObject\Util\Database\PicoDatabaseUtilMySql;
@@ -26,7 +28,6 @@ class PicoDatabaseDump
*/
protected $picoTableName = "";
-
/**
* Columns
*
@@ -41,7 +42,7 @@ class PicoDatabaseDump
* @param string $databaseType Target database type
* @param boolean $createIfNotExists Add DROP TABLE IF EXISTS before create table
* @param boolean $dropIfExists Add IF NOT EXISTS on create table
- * @param string $engine Storage engine
+ * @param string $engine Storage engine (for MariaDB and MySQL)
* @param string $charset Default charset
* @return string
*/
@@ -60,10 +61,36 @@ public function dumpStructure($entity, $databaseType, $createIfNotExists = false
return "";
}
}
+
+ /**
+ * Dump strcuture of table
+ *
+ * @param PicoTableInfo $tableInfo
+ * @param string $databaseType
+ * @param boolean $createIfNotExists
+ * @param boolean $dropIfExists
+ * @param string $engine
+ * @param string $charset
+ * @return string
+ */
+ public function dumpStructureTable($tableInfo, $databaseType, $createIfNotExists = false, $dropIfExists = false, $engine = 'InnoDB', $charset = 'utf8mb4')
+ {
+ $picoTableName = $tableInfo->getTableName();
+
+ if($databaseType == PicoDatabaseType::DATABASE_TYPE_MARIADB || $databaseType == PicoDatabaseType::DATABASE_TYPE_MYSQL)
+ {
+ return PicoDatabaseUtilMySql::dumpStructure($tableInfo, $picoTableName, $createIfNotExists, $dropIfExists, $engine, $charset);
+ }
+ else
+ {
+ return "";
+ }
+ }
+
/**
* Get entity table info
*
- * @param MagicObject $entity
+ * @param MagicObject $entity ENtity
* @return PicoTableInfo|null
*/
public function getTableInfo($entity)
@@ -81,9 +108,9 @@ public function getTableInfo($entity)
/**
* Update query alter table add column
*
- * @param string $query
- * @param string $lastColumn
- * @param string $databaseType
+ * @param string $query Query string
+ * @param string $lastColumn Last column
+ * @param string $databaseType Database type
* @return string
*/
public function updateQueryAlterTableAddColumn($query, $lastColumn, $databaseType)
@@ -98,8 +125,8 @@ public function updateQueryAlterTableAddColumn($query, $lastColumn, $databaseTyp
/**
* Update query alter table nullable
*
- * @param string $query
- * @param array $entityColumn
+ * @param string $query Query string
+ * @param array $entityColumn Entity name
* @return string
*/
public function updateQueryAlterTableNullable($query, $entityColumn)
@@ -114,15 +141,22 @@ public function updateQueryAlterTableNullable($query, $entityColumn)
/**
* Update query alter table default value
*
- * @param string $query
- * @param array $entityColumn
+ * @param string $query Query string
+ * @param array $entityColumn Entity column
* @return string
*/
public function updateQueryAlterTableDefaultValue($query, $entityColumn)
{
if(isset($entityColumn['default_value']))
{
- $query .= " DEFAULT ".PicoDatabaseUtil::escapeValue($entityColumn['default_value'], true);
+ if($entityColumn['default_value'] == 'NULL' || $entityColumn['default_value'] == 'null')
+ {
+ $query .= " DEFAULT NULL";
+ }
+ else
+ {
+ $query .= " DEFAULT ".PicoDatabaseUtil::escapeValue($entityColumn['default_value'], true);
+ }
}
return $query;
}
@@ -130,49 +164,345 @@ public function updateQueryAlterTableDefaultValue($query, $entityColumn)
/**
* Create query ALTER TABLE ADD COLUMN
*
- * @param MagicObject $entity
+ * @param MagicObject|MagicObject[] $entity Entity
+ * @param PicoDatabase $database
+ * @return string[]
+ */
+ public function createAlterTableAdd($entity, $database = null)
+ {
+ if(is_array($entity))
+ {
+ return $this->createAlterTableAddFromEntities($entity, $database);
+ }
+ else
+ {
+ return $this->createAlterTableAddFromEntity($entity);
+ }
+ }
+
+ /**
+ * Get database
+ *
+ * @param PicoDatabase $database
+ * @param MagicObject[] $entities
+ * @return PicoDatabase
+ */
+ private function getDatabase($database, $entities)
+ {
+ if(!isset($database))
+ {
+ $database = $entities[0]->currentDatabase();
+ }
+ return $database;
+ }
+
+ /**
+ *
+ * Get database type
+ * @param PicoDatabase $database
+ * @return string
+ */
+ private function getDatabaseType($database)
+ {
+ if(isset($database))
+ {
+ $databaseType = $database->getDatabaseType();
+ }
+ else
+ {
+ $databaseType = PicoDatabaseType::DATABASE_TYPE_MYSQL;
+ }
+ return $databaseType;
+ }
+
+ /**
+ *
+ * Get table name
+ * @param string $tableName
+ * @param PicoTableInfo $tableInfo
+ * @return string
+ */
+ private function getTableName($tableName, $tableInfo)
+ {
+ if(!isset($tableName))
+ {
+ $tableName = $tableInfo->getTableName();
+ }
+ return $tableName;
+ }
+
+ /**
+ * Get create alter table query
+ *
+ * @param string $tableName
+ * @param string $columnName
+ * @param string $columnType
+ * @return string
+ */
+ public function createQueryAlterTable($tableName, $columnName, $columnType)
+ {
+ $format = "ALTER TABLE %s ADD COLUMN %s %s";
+ return sprintf($format, $tableName, $columnName, $columnType);
+ }
+
+ /**
+ * Create query ALTER TABLE ADD COLUMN
+ *
+ * @param MagicObject[] $entity Entity
+ * @param PicoDatabase $database
+ * @return string[]
+ */
+ public function createAlterTableAddFromEntities($entities, $tableName = null, $database = null)
+ {
+ $tableInfo = $this->getMergedTableInfo($entities);
+ $tableName = $this->getTableName($tableName, $tableInfo);
+ $database = $this->getDatabase($database, $entities);
+
+ $queryAlter = array();
+ $numberOfColumn = count($tableInfo->getColumns());
+ if(!empty($tableInfo->getColumns()))
+ {
+ $dbColumnNames = array();
+ $rows = PicoColumnGenerator::getColumnList($database, $tableInfo->getTableName());
+ $createdColumns = array();
+ if(is_array($rows) && !empty($rows))
+ {
+ foreach($rows as $row)
+ {
+ $columnName = $row['Field'];
+ $dbColumnNames[] = $columnName;
+ }
+ $lastColumn = null;
+ foreach($tableInfo->getColumns() as $entityColumn)
+ {
+ if(!in_array($entityColumn['name'], $dbColumnNames))
+ {
+ $createdColumns[] = $entityColumn['name'];
+ $query = $this->createQueryAlterTable($tableName, $entityColumn['name'], $entityColumn['type']);
+ $query = $this->updateQueryAlterTableNullable($query, $entityColumn);
+ $query = $this->updateQueryAlterTableDefaultValue($query, $entityColumn);
+ $query = $this->updateQueryAlterTableAddColumn($query, $lastColumn, $database->getDatabaseType());
+ $queryAlter[] = $query.";";
+ }
+ $lastColumn = $entityColumn['name'];
+ }
+ $queryAlter = $this->addPrimaryKey($queryAlter, $tableInfo, $tableName, $createdColumns);
+ $queryAlter = $this->addAutoIncrement($queryAlter, $tableInfo, $tableName, $createdColumns, $database->getDatabaseType());
+ }
+ else if($numberOfColumn > 0)
+ {
+ $queryAlter[] = $this->dumpStructureTable($tableInfo, $database->getDatabaseType());
+ }
+ }
+ return $queryAlter;
+ }
+
+ /**
+ * Create query ALTER TABLE ADD COLUMN
+ *
+ * @param MagicObject|MagicObject[] $entity Entity
+ * @param PicoDatabase $database
* @return string[]
*/
- public function createAlterTableAdd($entity)
+ public function createAlterTableAddFromEntity($entity)
{
$tableInfo = $this->getTableInfo($entity);
$tableName = $tableInfo->getTableName();
+ $database = $entity->currentDatabase();
+
$queryAlter = array();
- if($tableInfo != null)
+ $numberOfColumn = count($tableInfo->getColumns());
+ if(!empty($tableInfo->getColumns()))
{
- $dbColumnNames = array();
-
- $database = $entity->currentDatabase();
+ $dbColumnNames = array();
$rows = PicoColumnGenerator::getColumnList($database, $tableInfo->getTableName());
-
- if(is_array($rows))
+ $createdColumns = array();
+ if(is_array($rows) && !empty($rows))
{
foreach($rows as $row)
{
$columnName = $row['Field'];
$dbColumnNames[] = $columnName;
}
+ $lastColumn = null;
+ foreach($tableInfo->getColumns() as $entityColumn)
+ {
+ if(!in_array($entityColumn['name'], $dbColumnNames))
+ {
+ $createdColumns[] = $entityColumn['name'];
+ $query = $this->createQueryAlterTable($tableName, $entityColumn['name'], $entityColumn['type']);
+ $query = $this->updateQueryAlterTableNullable($query, $entityColumn);
+ $query = $this->updateQueryAlterTableDefaultValue($query, $entityColumn);
+ $query = $this->updateQueryAlterTableAddColumn($query, $lastColumn, $database->getDatabaseType());
+ $queryAlter[] = $query.";";
+ }
+ $lastColumn = $entityColumn['name'];
+ }
+ $queryAlter = $this->addPrimaryKey($queryAlter, $tableInfo, $tableName, $createdColumns);
+ $queryAlter = $this->addAutoIncrement($queryAlter, $tableInfo, $tableName, $createdColumns, $database->getDatabaseType());
}
- $lastColumn = null;
- foreach($tableInfo->getColumns() as $entityColumn)
+ else if($numberOfColumn > 0)
{
- if(!in_array($entityColumn['name'], $dbColumnNames))
+ $queryAlter[] = $this->dumpStructure($entity, $database->getDatabaseType());
+ }
+ }
+ return $queryAlter;
+ }
+
+ /**
+ * Add primary key
+ * @param string[] $queryAlter
+ * @param PicoTableInfoExtended $tableInfo
+ * @param string $tableName
+ * @param string[] $createdColumns
+ * @return string[]
+ */
+ private function addPrimaryKey($queryAlter, $tableInfo, $tableName, $createdColumns)
+ {
+ $pk = $tableInfo->getPrimaryKeys();
+ $queries = array();
+ if(isset($pk) && is_array($pk) && !empty($pk))
+ {
+
+ foreach($pk as $primaryKey)
+ {
+ if(in_array($primaryKey['name'], $createdColumns))
{
- $query = "ALTER TABLE $tableName ADD COLUMN ".$entityColumn['name']." ".$entityColumn['type'];
- $query = $this->updateQueryAlterTableNullable($query, $entityColumn);
- $query = $this->updateQueryAlterTableDefaultValue($query, $entityColumn);
- $query = $this->updateQueryAlterTableAddColumn($query, $lastColumn, $database->getDatabaseType());
- $queryAlter[] = $query;
- $lastColumn = $entityColumn['name'];
+ $queries[] = "";
+ $queries[] = "ALTER TABLE $tableName";
+ $queries[] = "\tADD PRIMARY KEY ($primaryKey[name])";
+ $queries[] = ";";
+ }
+ }
+ $queryAlter[] = implode("\r\n", $queries);
+ }
+ return $queryAlter;
+ }
+
+ /**
+ * Add auto increment
+ *
+ * @param string[] $queryAlter
+ * @param PicoTableInfoExtended $tableInfo
+ * @param string $tableName
+ * @param string[] $createdColumns
+ * @param string $databaseType
+ * @return string[]
+ */
+ private function addAutoIncrement($queryAlter, $tableInfo, $tableName, $createdColumns, $databaseType)
+ {
+ $queries = array();
+ $aik = $this->getAutoIncrementKey($tableInfo);
+ foreach($tableInfo->getColumns() as $entityColumn)
+ {
+ if(isset($aik) && is_array($aik) && in_array($entityColumn['name'], $aik) && in_array($entityColumn['name'], $createdColumns))
+ {
+ $query = sprintf("%s %s", $entityColumn['name'], $entityColumn['type']);
+ $query = $this->updateQueryAlterTableNullable($query, $entityColumn);
+ $query = $this->updateQueryAlterTableDefaultValue($query, $entityColumn);
+
+ if($databaseType == PicoDatabaseType::DATABASE_TYPE_POSTGRESQL)
+ {
+ $columnName = $entityColumn['name'];
+ $sequenceName = $tableName."_".$columnName;
+ $queries[] = "";
+ $queries[] = "DROP SEQUENCE IF EXISTS $sequenceName;";
+ $queries[] = "CREATE SEQUENCE $sequenceName MINVALUE 1;";
+ $queries[] = "ALTER TABLE $tableName \r\n\tALTER $columnName SET DEFAULT nextval('$sequenceName')";
+ $queries[] = ";";
}
else
{
- $lastColumn = $entityColumn['name'];
+ $queries[] = "";
+ $queries[] = "ALTER TABLE $tableName \r\n\tMODIFY $query AUTO_INCREMENT";
+ $queries[] = ";";
}
+
+ $queryAlter[] = implode("\r\n", $queries);
}
}
return $queryAlter;
}
+
+ /**
+ * Get auto increment keys
+ *
+ * @param PicoTableInfo $tableInfo Table information
+ * @return array
+ */
+ public function getAutoIncrementKey($tableInfo)
+ {
+ $autoIncrement = $tableInfo->getAutoIncrementKeys();
+ $autoIncrementKeys = array();
+ if(is_array($autoIncrement) && !empty($autoIncrement))
+ {
+ foreach($autoIncrement as $col)
+ {
+ if($col["strategy"] == 'GenerationType.IDENTITY')
+ {
+ $autoIncrementKeys[] = $col["name"];
+ }
+ }
+ }
+ return $autoIncrementKeys;
+ }
+
+ /**
+ * Merge entities
+ * @param mixed $entities
+ * @return PicoTableInfoExtended
+ * @deprecated deprecated since version 1.13
+ */
+ public function getMergedTableInfoOld($entities)
+ {
+ $mergedTableInfo = PicoTableInfoExtended::getInstance();
+ foreach($entities as $entity)
+ {
+ $tableInfo = $this->getTableInfo($entity);
+ $mergedTableInfo->setTableName($tableInfo->getTableName());
+
+ $mergedTableInfo->setColumns(array_merge($mergedTableInfo->getColumns(), $tableInfo->getColumns()));
+ $mergedTableInfo->setJoinColumns(array_merge($mergedTableInfo->getJoinColumns(), $tableInfo->getJoinColumns()));
+ $mergedTableInfo->setPrimaryKeys(array_merge($mergedTableInfo->getPrimaryKeys(), $tableInfo->getPrimaryKeys()));
+ $mergedTableInfo->setAutoIncrementKeys(array_merge($mergedTableInfo->getAutoIncrementKeys(), $tableInfo->getAutoIncrementKeys()));
+ $mergedTableInfo->setDefaultValue(array_merge($mergedTableInfo->getDefaultValue(), $tableInfo->getDefaultValue()));
+ $mergedTableInfo->setNotNullColumns(array_merge($mergedTableInfo->getNotNullColumns(), $tableInfo->getNotNullColumns()));
+ }
+
+ $mergedTableInfo->uniqueColumns();
+ $mergedTableInfo->uniqueJoinColumns();
+ $mergedTableInfo->uniquePrimaryKeys();
+ $mergedTableInfo->uniqueAutoIncrementKeys();
+ $mergedTableInfo->uniqueDefaultValue();
+ $mergedTableInfo->uniqueNotNullColumns();
+
+ return $mergedTableInfo;
+ }
+
+ /**
+ * Get merged table info
+ *
+ * @param MagicObject[] $entities
+ * @return PicoTableInfoExtended
+ */
+ public function getMergedTableInfo($entities)
+ {
+ $mergedTableInfo = PicoTableInfoExtended::getInstance();
+ foreach($entities as $entity)
+ {
+ $tableInfo = $this->getTableInfo($entity);
+ $mergedTableInfo->setTableName($tableInfo->getTableName());
+
+ $mergedTableInfo->mergeColumns($tableInfo->getColumns());
+ $mergedTableInfo->mergeJoinColumns($tableInfo->getJoinColumns());
+ $mergedTableInfo->mergePrimaryKeys($tableInfo->getPrimaryKeys());
+ $mergedTableInfo->mergeAutoIncrementKeys($tableInfo->getAutoIncrementKeys());
+ $mergedTableInfo->mergeDefaultValue($tableInfo->getDefaultValue());
+ $mergedTableInfo->mergeNotNullColumns($tableInfo->getNotNullColumns());
+ }
+
+ return $mergedTableInfo;
+ }
/**
* Dump data to SQL.
@@ -219,7 +549,4 @@ public function dumpData($data, $databaseType)
return "";
}
}
-
-
-
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoDtoGenerator.php b/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoDtoGenerator.php
index e83945f8..0029ca47 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoDtoGenerator.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoDtoGenerator.php
@@ -181,6 +181,7 @@ protected function createValueOf($picoTableName, $rows)
{
$dtoName = ucfirst(PicoStringUtil::camelize($picoTableName))."Dto";
}
+
$str = "";
$str .=" /**\r\n";
$str .=" * Construct $dtoName"." from $className and not copy other properties\r\n";
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoEntityGenerator.php b/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoEntityGenerator.php
index bf7ed3ab..f575c917 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoEntityGenerator.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Generator/PicoEntityGenerator.php
@@ -77,16 +77,19 @@ public function __construct($database, $baseDir, $tableName, $baseNamespace, $en
* Create property
*
* @param array $typeMap
- * @param string $columnName
- * @param string $columnType
- * @param string $columnKey
- * @param string $columnNull
- * @param string $columnDefault
- * @param string $columnExtra
+ * @param string $row
+ * @param string[] $nonupdatables
* @return string
*/
- protected function createProperty($typeMap, $columnName, $columnType, $columnKey, $columnNull, $columnDefault, $columnExtra)
+ protected function createProperty($typeMap, $row, $nonupdatables = null)
{
+ $columnName = $row['Field'];
+ $columnType = $row['Type'];
+ $columnKey = $row['Key'];
+ $columnNull = $row['Null'];
+ $columnDefault = $row['Default'];
+ $columnExtra = $row['Extra'];
+
$propertyName = PicoStringUtil::camelize($columnName);
$description = $this->getPropertyName($columnName);
$type = $this->getDataType($typeMap, $columnType);
@@ -137,7 +140,7 @@ protected function createProperty($typeMap, $columnName, $columnType, $columnKey
$attrs[] = "nullable=$val";
}
- if($columnName == "time_create" || $columnName == "admin_create" || $columnName == "ip_create")
+ if(is_array($nonupdatables) && in_array($columnName, $nonupdatables))
{
$attrs[] = "updatable=false";
}
@@ -153,7 +156,6 @@ protected function createProperty($typeMap, $columnName, $columnType, $columnKey
$docs[] = "\t * @DefaultColumn(value=\"".$columnDefault."\")";
}
-
$docs[] = "\t * @Label(content=\"$description\")";
$docs[] = "\t * @var $type";
$docs[] = $docEnd;
@@ -207,7 +209,7 @@ protected function getDataType($typeMap, $columnType)
/**
* Get column length
*
- * @param string $str
+ * @param string $str String contains column length
* @return integer
*/
protected function getDataLength($str)
@@ -264,9 +266,10 @@ protected function getTypeMap()
/**
* Generate entity
*
+ * @param string[] $nonupdatables
* @return string
*/
- public function generate()
+ public function generate($nonupdatables = null)
{
$typeMap = $this->getTypeMap();
$picoTableName = $this->tableName;
@@ -295,14 +298,7 @@ public function generate()
{
foreach($rows as $row)
{
- $columnName = $row['Field'];
- $columnType = $row['Type'];
- $columnKey = $row['Key'];
- $columnNull = $row['Null'];
- $columnDefault = $row['Default'];
- $columnExtra = $row['Extra'];
-
- $prop = $this->createProperty($typeMap, $columnName, $columnType, $columnKey, $columnNull, $columnDefault, $columnExtra);
+ $prop = $this->createProperty($typeMap, $row, $nonupdatables);
$attrs[] = $prop;
}
}
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Language/PicoEntityLanguage.php b/inc.lib/vendor/planetbiru/magic-object/src/Language/PicoEntityLanguage.php
index c60b4831..19421d6f 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Language/PicoEntityLanguage.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Language/PicoEntityLanguage.php
@@ -51,14 +51,14 @@ class PicoEntityLanguage
*
* @var string
*/
- private string $_entityClassName = "";
+ private $_entityClassName = ""; //NOSONAR
/**
* Entity language
*
* @var string
*/
- private string $_entityLanguage = "";
+ private $_entityLanguage = ""; //NOSONAR
/**
* Constructor
@@ -75,7 +75,7 @@ public function __construct($entity = null)
/**
* Load data to object
- * @param MagicObject $entity
+ * @param MagicObject $entity ENtity
* @return self
*/
public function loadEntityLabel($entity)
@@ -121,9 +121,9 @@ public function loadEntityLabel($entity)
/**
* Add language
*
- * @param string $code
- * @param object|stdClass|array $reference
- * @param boolean $use
+ * @param string $code Language code
+ * @param object|stdClass|array $reference Reference
+ * @param boolean $use Flag to use language
* @return self
*/
public function addLanguage($code, $reference, $use = false)
@@ -139,8 +139,7 @@ public function addLanguage($code, $reference, $use = false)
/**
* Remove language
*
- * @param string $code
- * @param stdClass|array $reference
+ * GoPro Rechargeable Battery for MAX 360
* @return self
*/
public function removeLanguage($code)
@@ -160,7 +159,7 @@ public function removeLanguage($code)
/**
* Set current language
*
- * @param string $code
+ * GoPro Rechargeable Battery for MAX 360
* @return self
*/
public function selectLanguage($code)
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Language/PicoLanguage.php b/inc.lib/vendor/planetbiru/magic-object/src/Language/PicoLanguage.php
index 41f311b6..bea6a131 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Language/PicoLanguage.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Language/PicoLanguage.php
@@ -63,18 +63,6 @@ public function get($propertyName)
return isset($this->$var) ? $this->$var : null;
}
- /**
- * Check if property value is set
- *
- * @param string $propertyName
- * @return boolean
- */
- public function isset($propertyName)
- {
- $var = PicoStringUtil::camelize($propertyName);
- return isset($this->$var);
- }
-
/**
* Stores datas in the property.
* Example: $instance->foo = 'bar';
@@ -125,4 +113,24 @@ public function __unset($name)
{
unset($this->$name);
}
+
+ /**
+ * Magic method called when user call any undefined method
+ *
+ * @param string $method
+ * @param string $params
+ * @return mixed|null
+ */
+ public function __call($method, $params) // NOSONAR
+ {
+ if (strncasecmp($method, "get", 3) === 0) {
+ $var = lcfirst(substr($method, 3));
+ return $this->get($var);
+ }
+ else if (strncasecmp($method, "equals", 6) === 0) {
+ $var = lcfirst(substr($method, 6));
+ $value = isset($this->$var) ? $this->$var : null;
+ return isset($params[0]) && $params[0] == $value;
+ }
+ }
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/MagicObject.php b/inc.lib/vendor/planetbiru/magic-object/src/MagicObject.php
index 76bee0bf..0c74deaf 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/MagicObject.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/MagicObject.php
@@ -15,6 +15,7 @@
use MagicObject\Database\PicoSortable;
use MagicObject\Database\PicoSpecification;
use MagicObject\Database\PicoTableInfo;
+use MagicObject\Exceptions\FindOptionException;
use MagicObject\Exceptions\InvalidAnnotationException;
use MagicObject\Exceptions\InvalidQueryInputException;
use MagicObject\Exceptions\NoDatabaseConnectionException;
@@ -49,6 +50,14 @@ class MagicObject extends stdClass // NOSONAR
const JSON = 'JSON';
const YAML = 'Yaml';
+ const ATTR_CHECKED = ' checked="checked"';
+ const ATTR_SELECTED = ' selected="selected"';
+
+
+ const FIND_OPTION_DEFAULT = 0;
+ const FIND_OPTION_NO_COUNT_DATA = 1;
+ const FIND_OPTION_NO_FETCH_DATA = 2;
+
/**
* Flag readonly
*
@@ -110,7 +119,7 @@ public function nullPropertiyList()
/**
* Constructor
*
- * @param self|array|object $data
+ * @param self|array|stdClass|object $data
* @param PicoDatabase $database
*/
public function __construct($data = null, $database = null)
@@ -126,7 +135,6 @@ public function __construct($data = null, $database = null)
}
catch(InvalidQueryInputException $e)
{
- echo $e->getMessage();
throw new InvalidAnnotationException("Invalid annotation @".$paramName);
}
}
@@ -479,7 +487,7 @@ public function removePropertyExcept($sourceData, $propertyNames)
*/
public function save($includeNull = false)
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
return $persist->save($includeNull);
@@ -517,7 +525,7 @@ public function saveQuery($includeNull = false)
*/
public function select()
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
$data = $persist->select();
@@ -542,7 +550,7 @@ public function select()
*/
public function selectAll()
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
$data = $persist->selectAll();
@@ -587,7 +595,7 @@ public function selectQuery()
*/
public function insert($includeNull = false)
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
return $persist->insert($includeNull);
@@ -627,7 +635,7 @@ public function insertQuery($includeNull = false)
*/
public function update($includeNull = false)
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
return $persist->update($includeNull);
@@ -666,7 +674,7 @@ public function updateQuery($includeNull = false)
*/
public function delete()
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
return $persist->delete();
@@ -1141,13 +1149,56 @@ function($property) use($class) {
*
* @param PicoSpecification $specification
* @param PicoPageable|string $pageable
+ * @param PicoSortable|string $sortable
+ * @param boolean $passive
+ * @param array $subqueryMap
* @return PicoPageData
* @throws NoRecordFoundException if no record found
* @throws NoDatabaseConnectionException if no database connection
*/
- public function listAll($specification = null, $pageable = null)
+ public function listAll($specification = null, $pageable = null, $sortable = null, $passive = false, $subqueryMap = null)
+ {
+ return $this->findAll($specification, $pageable, $sortable, $passive, $subqueryMap);
+ }
+
+ /**
+ * Check if database is connected or not
+ *
+ * @return boolean
+ */
+ private function _databaseConnected()
{
- return $this->findAll($specification, $pageable, true);
+ return $this->_database != null && $this->_database->isConnected();
+ }
+
+ /**
+ * Count data
+ *
+ * @param PicoDatabasePersistence $persist
+ * @param PicoSpecification $specification
+ * @param integer $findOption
+ * @param array $result
+ * @return integer
+ */
+ private function countData($persist, $specification, $findOption, $result)
+ {
+ if($findOption & self::FIND_OPTION_NO_COUNT_DATA)
+ {
+ if(isset($result) && is_array($result))
+ {
+ $match = count($result);
+ }
+ else
+ {
+ $match = 0;
+ }
+ }
+ else
+ {
+ $match = $persist->countAll($specification);
+ }
+
+ return $match;
}
/**
@@ -1157,47 +1208,60 @@ public function listAll($specification = null, $pageable = null)
* @param PicoPageable|string $pageable
* @param PicoSortable|string $sortable
* @param boolean $passive
+ * @param array $subqueryMap
+ * @param integer $findOption
* @return PicoPageData
* @throws NoRecordFoundException if no record found
* @throws NoDatabaseConnectionException if no database connection
*/
- public function findAll($specification = null, $pageable = null, $sortable = null, $passive = false)
+ public function findAll($specification = null, $pageable = null, $sortable = null, $passive = false, $subqueryMap = null, $findOption = self::FIND_OPTION_DEFAULT)
{
$startTime = microtime(true);
try
{
- $pageData = null;
- if($this->_database != null && $this->_database->isConnected())
+ $pageData = new PicoPageData(array(), $startTime);
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
- $result = $persist->findAll($specification, $pageable, $sortable);
+ if($findOption & self::FIND_OPTION_NO_FETCH_DATA)
+ {
+ $result = null;
+ $stmt = $persist->createPDOStatement($specification, $pageable, $sortable, $subqueryMap);
+ }
+ else
+ {
+
+ $result = $persist->findAll($specification, $pageable, $sortable, $subqueryMap);
+ $stmt = null;
+ }
- if($this->_notNullAndNotEmpty($result))
+ if($pageable != null && $pageable instanceof PicoPageable)
{
- if($pageable != null && $pageable instanceof PicoPageable)
- {
- $match = $persist->countAll($specification);
- $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime, $match, $pageable);
- }
- else
- {
- $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime);
- }
+ $match = $this->countData($persist, $specification, $findOption, $result);
+ $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime, $match, $pageable, $stmt, $this, $subqueryMap);
}
else
{
- $pageData = new PicoPageData(array(), $startTime);
+ $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime, 0, null, $stmt, $this, $subqueryMap);
}
+ return $pageData;
}
else
{
- $pageData = new PicoPageData(array(), $startTime);
- }
- return $pageData;
+ throw new NoDatabaseConnectionException(self::MESSAGE_NO_DATABASE_CONNECTION);
+ }
+ }
+ catch(FindOptionException $e)
+ {
+ throw new FindOptionException($e->getMessage());
+ }
+ catch(NoRecordFoundException $e)
+ {
+ throw new NoRecordFoundException($e->getMessage());
}
catch(Exception $e)
{
- return new PicoPageData(array(), $startTime);
+ throw new PDOException($e->getMessage(), intval($e->getCode()));
}
}
@@ -1209,48 +1273,97 @@ public function findAll($specification = null, $pageable = null, $sortable = nul
* @param PicoPageable|string $pageable
* @param PicoSortable|string $sortable
* @param boolean $passive
+ * @param array $subqueryMap
+ * @param integer $findOption
* @return PicoPageData
* @throws NoRecordFoundException if no record found
* @throws NoDatabaseConnectionException if no database connection
*/
- public function findSpecific($selected, $specification = null, $pageable = null, $sortable = null, $passive = false)
+ public function findSpecific($selected, $specification = null, $pageable = null, $sortable = null, $passive = false, $subqueryMap = null, $findOption = self::FIND_OPTION_DEFAULT)
{
$startTime = microtime(true);
try
{
- $pageData = null;
- if($this->_database != null && $this->_database->isConnected())
+ $pageData = new PicoPageData(array(), $startTime);
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
- $result = $persist->findSpecific($selected, $specification, $pageable, $sortable);
+ if($findOption & self::FIND_OPTION_NO_FETCH_DATA)
+ {
+ $result = null;
+ $stmt = $persist->createPDOStatement($specification, $pageable, $sortable, $subqueryMap, $selected);
+ }
+ else
+ {
+ $result = $persist->findSpecificWithSubquery($selected, $specification, $pageable, $sortable, $subqueryMap);
+ $stmt = null;
+ }
- if($this->_notNullAndNotEmpty($result))
+ if($pageable != null && $pageable instanceof PicoPageable)
{
- if($pageable != null && $pageable instanceof PicoPageable)
- {
- $match = $persist->countAll($specification);
- $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime, $match, $pageable);
- }
- else
- {
- $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime);
- }
+ $match = $this->countData($persist, $specification, $findOption, $result);
+ $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime, $match, $pageable, $stmt, $this, $subqueryMap);
}
else
{
- $pageData = new PicoPageData(array(), $startTime);
+ $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime, 0, null, $stmt, $this, $subqueryMap);
}
+ return $pageData;
}
else
{
- $pageData = new PicoPageData(array(), $startTime);
+ throw new NoDatabaseConnectionException(self::MESSAGE_NO_DATABASE_CONNECTION);
+ }
+ }
+ catch(FindOptionException $e)
+ {
+ throw new FindOptionException($e->getMessage());
+ }
+ catch(NoRecordFoundException $e)
+ {
+ throw new NoRecordFoundException($e->getMessage());
+ }
+ catch(Exception $e)
+ {
+ throw new PDOException($e->getMessage(), intval($e->getCode()));
+ }
+ }
+
+ /**
+ * Count all record
+ *
+ * @param PicoSpecification $specification
+ * @return integer|false
+ * @throws NoRecordFoundException if no record found
+ * @throws NoDatabaseConnectionException if no database connection
+ */
+ public function countAll($specification = null)
+ {
+ $result = false;
+ try
+ {
+ if($this->_databaseConnected())
+ {
+ $persist = new PicoDatabasePersistence($this->_database, $this);
+ if($specification != null && $specification instanceof PicoSpecification)
+ {
+ $result = $persist->countAll($specification);
+ }
+ else
+ {
+ $result = $persist->countAll(null);
+ }
+ }
+ else
+ {
+ throw new NoDatabaseConnectionException(self::MESSAGE_NO_DATABASE_CONNECTION);
}
- return $pageData;
}
catch(Exception $e)
{
- return new PicoPageData(array(), $startTime);
+ $result = false;
}
+ return $result;
}
/**
@@ -1259,18 +1372,16 @@ public function findSpecific($selected, $specification = null, $pageable = null,
* @param PicoSpecification $specification
* @param PicoPageable|string $pageable
* @param PicoSortable|string $sortable
- * @param boolean $passive
* @return PicoDatabaseQueryBuilder
* @throws NoRecordFoundException if no record found
* @throws NoDatabaseConnectionException if no database connection
*/
- public function findAllQuery($specification = null, $pageable = null, $sortable = null, $passive = false)
+ public function findAllQuery($specification = null, $pageable = null, $sortable = null)
{
try
{
- if($this->_database != null && $this->_database->isConnected())
- {
-
+ if($this->_databaseConnected())
+ {
$persist = new PicoDatabasePersistence($this->_database, $this);
$result = $persist->findAllQuery($specification, $pageable, $sortable);
}
@@ -1294,7 +1405,7 @@ public function findAllQuery($specification = null, $pageable = null, $sortable
*/
public function find($params)
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
$result = $persist->find($params);
@@ -1356,25 +1467,18 @@ private function findBy($method, $params, $pageable = null, $sortable = null, $p
try
{
$pageData = null;
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
$result = $persist->findBy($method, $params, $pageable, $sortable);
- if($this->_notNullAndNotEmpty($result))
+ if($pageable != null && $pageable instanceof PicoPageable)
{
- if($pageable != null && $pageable instanceof PicoPageable)
- {
- $match = $persist->countBy($method, $params);
- $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime, $match, $pageable);
- }
- else
- {
- $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime);
- }
+ $match = $persist->countBy($method, $params);
+ $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime, $match, $pageable);
}
else
{
- $pageData = new PicoPageData(array(), $startTime);
+ $pageData = new PicoPageData($this->toArrayObject($result, $passive), $startTime);
}
}
else
@@ -1398,7 +1502,7 @@ private function findBy($method, $params, $pageable = null, $sortable = null, $p
*/
private function countBy($method, $params)
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
return $persist->countBy($method, $params);
@@ -1418,7 +1522,7 @@ private function countBy($method, $params)
*/
private function deleteBy($method, $params)
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
return $persist->deleteBy($method, $params);
@@ -1428,6 +1532,35 @@ private function deleteBy($method, $params)
throw new NoDatabaseConnectionException(self::MESSAGE_NO_DATABASE_CONNECTION);
}
}
+
+ /**
+ * Find one with primary key value
+ *
+ * @param mixed $primaryKeyVal
+ * @param array $subqueryMap
+ * @return self
+ */
+ public function findOneWithPrimaryKeyValue($primaryKeyVal, $subqueryMap = null)
+ {
+ if($this->_databaseConnected())
+ {
+ $persist = new PicoDatabasePersistence($this->_database, $this);
+ $result = $persist->findOneWithPrimaryKeyValue($primaryKeyVal, $subqueryMap);
+ if($this->_notNullAndNotEmpty($result))
+ {
+ $this->loadData($result);
+ return $this;
+ }
+ else
+ {
+ throw new NoRecordFoundException(self::MESSAGE_NO_RECORD_FOUND);
+ }
+ }
+ else
+ {
+ throw new NoDatabaseConnectionException(self::MESSAGE_NO_DATABASE_CONNECTION);
+ }
+ }
/**
* Find one by params
@@ -1439,7 +1572,7 @@ private function deleteBy($method, $params)
*/
private function findOneBy($method, $params, $sortable = null)
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
$result = $persist->findOneBy($method, $params, $sortable);
@@ -1497,7 +1630,7 @@ private function findOneIfExistsBy($method, $params, $sortable = null)
*/
private function deleteOneBy($method, $params)
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
return $persist->deleteOneBy($method, $params);
@@ -1518,7 +1651,7 @@ private function deleteOneBy($method, $params)
*/
private function existsBy($method, $params)
{
- if($this->_database != null && $this->_database->isConnected())
+ if($this->_databaseConnected())
{
$persist = new PicoDatabasePersistence($this->_database, $this);
return $persist->existsBy($method, $params);
@@ -1561,11 +1694,14 @@ private function toArrayObject($result, $passive = false)
{
$instance = array();
$index = 0;
- foreach($result as $value)
+ if(isset($result) && is_array($result))
{
- $className = get_class($this);
- $instance[$index] = new $className($value, $passive ? null : $this->_database);
- $index++;
+ foreach($result as $value)
+ {
+ $className = get_class($this);
+ $instance[$index] = new $className($value, $passive ? null : $this->_database);
+ $index++;
+ }
}
return $instance;
}
@@ -1778,24 +1914,32 @@ public function __call($method, $params) // NOSONAR
}
else if (strncasecmp($method, "booleanToSelectedBy", 19) === 0) {
$prop = lcfirst(substr($method, 19));
- return $this->booleanToTextBy($prop, array(' selected="selected"', ''));
+ return $this->booleanToTextBy($prop, array(self::ATTR_SELECTED, ''));
}
else if (strncasecmp($method, "booleanToCheckedBy", 18) === 0) {
$prop = lcfirst(substr($method, 18));
- return $this->booleanToTextBy($prop, array(' cheked="checked"', ''));
+ return $this->booleanToTextBy($prop, array(self::ATTR_CHECKED, ''));
}
else if (strncasecmp($method, "createSelected", 14) === 0) {
$var = lcfirst(substr($method, 14));
- if(isset($this->$var))
+ if(isset($params) && isset($params[0]))
+ {
+ return isset($this->$var) && $this->$var == $params[0] ? self::ATTR_SELECTED : '';
+ }
+ else
{
- return $this->$var == $params[0] ? ' selected="selected"' : '';
+ return isset($this->$var) && $this->$var == 1 ? self::ATTR_SELECTED : '';
}
}
else if (strncasecmp($method, "createChecked", 13) === 0) {
$var = lcfirst(substr($method, 13));
- if(isset($this->$var))
+ if(isset($params) && isset($params[0]))
+ {
+ return isset($this->$var) && $this->$var == $params[0] ? self::ATTR_CHECKED : '';
+ }
+ else
{
- return $this->$var == $params[0] ? ' checked="checked"' : '';
+ return isset($this->$var) && $this->$var == 1 ? self::ATTR_CHECKED : '';
}
}
else if (strncasecmp($method, "startsWith", 10) === 0) {
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Pagination/PicoPagination.php b/inc.lib/vendor/planetbiru/magic-object/src/Pagination/PicoPagination.php
index 411eb492..2f7520d1 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Pagination/PicoPagination.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Pagination/PicoPagination.php
@@ -42,26 +42,39 @@ class PicoPagination
*/
private $orderType = "";
- public function __construct($pageSize = 20)
+ /**
+ * Constructor
+ *
+ * @param integer $pageSize
+ * @param string $orderby
+ * @param string $ordertype
+ */
+ public function __construct($pageSize = 20, $orderby = 'orderby', $ordertype = 'ordertype')
{
$this->pageSize = $pageSize;
$this->currentPage = $this->parseCurrentPage();
$this->offset = $this->pageSize * ($this->currentPage - 1);
- $this->orderBy = @$_GET['orderby'];
- $this->orderType = @$_GET['ordertype'];
+ if(isset($_GET[$orderby]))
+ {
+ $this->orderBy = @$_GET[$orderby];
+ }
+ if(isset($_GET[$ordertype]))
+ {
+ $this->orderType = @$_GET[$ordertype];
+ }
}
/**
* Parse offset
*
- * @param string $paramName
+ * @param string $parameterName Parameter name
* @return integer
*/
- private function parseCurrentPage($paramName = 'page')
+ private function parseCurrentPage($parameterName = 'page')
{
- if(isset($_GET[$paramName]))
+ if(isset($_GET[$parameterName]))
{
- $pageStr = preg_replace("/\D/", "", $_GET[$paramName]);
+ $pageStr = preg_replace("/\D/", "", $_GET[$parameterName]);
if($pageStr == "")
{
$page = 0;
@@ -82,9 +95,9 @@ private function parseCurrentPage($paramName = 'page')
/**
* Create order
*
- * @param array $map
- * @param array $filter
- * @param string $defaultOrderBy
+ * @param array $map ORDER BY map
+ * @param array $filter ORDER BY filter
+ * @param string $defaultOrderBy Default ORDER BY
* @return string
*/
public function createOrder($map = null, $filter = null, $defaultOrderBy = null)
@@ -106,8 +119,8 @@ public function createOrder($map = null, $filter = null, $defaultOrderBy = null)
/**
* Get order by
*
- * @var array $filter
- * @var string $defaultOrderBy
+ * @var array $filter ORDER BY filter
+ * @var string $defaultOrderBy Default ORDER BY
* @return string
*/
public function getOrderBy($filter = null, $defaultOrderBy = null)
@@ -138,17 +151,17 @@ public function getOrderBy($filter = null, $defaultOrderBy = null)
/**
* Get order type
*
- * @var string $defaultOrderType
+ * @var string $defaultOrderType Default order type
* @return string
*/
public function getOrderType($defaultOrderType = null)
{
$orderType = $this->orderType;
- if(strcasecmp($orderType, 'desc') == 0)
+ if(strcasecmp($orderType, PicoSort::ORDER_TYPE_DESC) == 0)
{
$orderType = PicoSort::ORDER_TYPE_DESC;
}
- else if(strcasecmp($orderType, 'asc') == 0)
+ else if(strcasecmp($orderType, PicoSort::ORDER_TYPE_ASC) == 0)
{
$orderType = PicoSort::ORDER_TYPE_ASC;
}
@@ -196,29 +209,34 @@ public function getOffset()
/**
* Get page URL
*
- * @param integer $page
+ * @param integer $page Page number
+ * @param string $parameterName Parameter name for page number
+ * @param string $path Path
* @return string
*/
- public static function getPageUrl($page)
+ public static function getPageUrl($page, $parameterName = 'page', $path = null)
{
$urls = array();
- $params = array();
- $urls[] = $_SERVER['PHP_SELF'];
-
- $urlParameters = isset($_GET) ? $_GET : null;
-
- if($urlParameters != null && is_array($urlParameters))
+ $paths = explode("?", $_SERVER['REQUEST_URI']);
+ if($path === null)
+ {
+ $path = trim($paths[0]);
+ }
+ $urls[] = $path;
+ $urlParameters = isset($_GET) ? $_GET : array();
+ foreach($urlParameters as $paramName=>$paramValue)
{
- $urlParameters['page'] = $page;
- foreach($urlParameters as $paramName=>$paramValue)
+ if($paramName == $parameterName)
{
- $params[] = urlencode($paramName)."=".urlencode($paramValue);
+ $urlParameters[$paramName] = $page;
}
}
- if(!empty($params))
+ // replace value
+ $urlParameters[$parameterName] = $page;
+ if(!empty($urlParameters))
{
- $urls[] = implode("&", $params);
+ $urls[] = http_build_query($urlParameters);
}
return implode("?", $urls);
}
-}
\ No newline at end of file
+}
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputCookie.php b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputCookie.php
index 48584aa3..7a496213 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputCookie.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputCookie.php
@@ -16,10 +16,11 @@ class InputCookie extends PicoRequestBase {
* Constructor
* @param boolean $recursive
* @param boolean $parseNullAndBool
+ * @param boolean $forceScalar
*/
- public function __construct($recursive = false, $parseNullAndBool = false)
+ public function __construct($recursive = false, $parseNullAndBool = false, $forceScalar = false)
{
- parent::__construct();
+ parent::__construct($forceScalar);
$this->_recursive = $recursive;
if($parseNullAndBool)
{
@@ -47,7 +48,7 @@ public static function requestCookie()
* @param array $data
* @return self
*/
- public function loadData($data)
+ public function loadData($data, $tolower = false)
{
if($this->_recursive)
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputEnv.php b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputEnv.php
index f249bdb4..36e086fe 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputEnv.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputEnv.php
@@ -16,10 +16,11 @@ class InputEnv extends PicoRequestBase {
* Constructor
* @param boolean $recursive
* @param boolean $parseNullAndBool
+ * @param boolean $forceScalar
*/
- public function __construct($recursive = false, $parseNullAndBool = false)
+ public function __construct($recursive = false, $parseNullAndBool = false, $forceScalar = false)
{
- parent::__construct();
+ parent::__construct($forceScalar);
$this->_recursive = $recursive;
if($parseNullAndBool)
{
@@ -37,7 +38,7 @@ public function __construct($recursive = false, $parseNullAndBool = false)
* @param array $data
* @return self
*/
- public function loadData($data)
+ public function loadData($data, $tolower = false)
{
if($this->_recursive)
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputGet.php b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputGet.php
index b32fb366..c8863308 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputGet.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputGet.php
@@ -16,10 +16,11 @@ class InputGet extends PicoRequestBase {
* Constructor
* @param boolean $recursive
* @param boolean $parseNullAndBool
+ * @param boolean $forceScalar
*/
- public function __construct($recursive = false, $parseNullAndBool = false)
+ public function __construct($recursive = false, $parseNullAndBool = false, $forceScalar = false)
{
- parent::__construct();
+ parent::__construct($forceScalar);
$this->_recursive = $recursive;
if($parseNullAndBool)
{
@@ -47,7 +48,7 @@ public static function requestGet()
* @param array $data
* @return self
*/
- public function loadData($data)
+ public function loadData($data, $tolower = false)
{
if($this->_recursive)
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputPost.php b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputPost.php
index 30cb1c25..a3503bdb 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputPost.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputPost.php
@@ -16,10 +16,11 @@ class InputPost extends PicoRequestBase {
* Constructor
* @param boolean $recursive
* @param boolean $parseNullAndBool
+ * @param boolean $forceScalar
*/
- public function __construct($recursive = false, $parseNullAndBool = false)
+ public function __construct($recursive = false, $parseNullAndBool = false, $forceScalar = false)
{
- parent::__construct();
+ parent::__construct($forceScalar);
$this->_recursive = $recursive;
if($parseNullAndBool)
{
@@ -47,7 +48,7 @@ public static function requestPost()
* @param array $data
* @return self
*/
- public function loadData($data)
+ public function loadData($data, $tolower = false)
{
if($this->_recursive)
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputRequest.php b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputRequest.php
index ef64c1df..e8277b1e 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputRequest.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputRequest.php
@@ -16,10 +16,11 @@ class InputRequest extends PicoRequestBase {
* Constructor
* @param boolean $recursive
* @param boolean $parseNullAndBool
+ * @param boolean $forceScalar
*/
- public function __construct($recursive = false, $parseNullAndBool = false)
+ public function __construct($recursive = false, $parseNullAndBool = false, $forceScalar = false)
{
- parent::__construct();
+ parent::__construct($forceScalar);
$this->_recursive = $recursive;
if($parseNullAndBool)
{
@@ -37,7 +38,7 @@ public function __construct($recursive = false, $parseNullAndBool = false)
* @param array $data
* @return self
*/
- public function loadData($data)
+ public function loadData($data, $tolower = false)
{
if($this->_recursive)
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputServer.php b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputServer.php
index 4598837b..11ad5102 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Request/InputServer.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Request/InputServer.php
@@ -45,7 +45,7 @@ class InputServer extends PicoRequestBase {
public function __construct()
{
parent::__construct();
- $this->loadData($_SERVER);
+ $this->loadData($_SERVER, true);
}
/**
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Request/PicoRequest.php b/inc.lib/vendor/planetbiru/magic-object/src/Request/PicoRequest.php
index fcd0d1bc..db05ba6f 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Request/PicoRequest.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Request/PicoRequest.php
@@ -12,10 +12,11 @@ class PicoRequest extends PicoRequestBase
* Constructor
*
* @param integer $inputType
+ * @param boolean $forceScalar
*/
- public function __construct($inputType = INPUT_GET)
+ public function __construct($inputType = INPUT_GET, $forceScalar = false)
{
- parent::__construct();
+ parent::__construct($forceScalar);
if($inputType == INPUT_GET && isset($_GET))
{
$this->loadData($_GET);
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Request/PicoRequestBase.php b/inc.lib/vendor/planetbiru/magic-object/src/Request/PicoRequestBase.php
index e77186a2..5cda0d2d 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Request/PicoRequestBase.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Request/PicoRequestBase.php
@@ -17,12 +17,20 @@ class PicoRequestBase extends stdClass //NOSONAR
* @var array
*/
private $classParams = array();
+ /**
+ * Force input object as scalar
+ *
+ * @var boolean
+ */
+ protected $forceScalar = false;
/**
* Constructor
+ * @param boolean $forceScalar
*/
- public function __construct()
+ public function __construct($forceScalar = false)
{
+ $this->forceScalar = $forceScalar;
$jsonAnnot = new PicoAnnotationParser(get_class($this));
$params = $jsonAnnot->getParameters();
foreach($params as $paramName=>$paramValue)
@@ -39,11 +47,16 @@ public function __construct()
/**
* Load data to object
* @param mixed $data
+ * @param boolean $tolower
*/
- public function loadData($data)
+ public function loadData($data, $tolower = false)
{
if (is_array($data) || is_object($data)) {
foreach ($data as $key => $value) {
+ if($tolower)
+ {
+ $key = strtolower($key);
+ }
$key2 = PicoStringUtil::camelize(str_replace("-", "_", $key));
$this->{$key2} = $value;
}
@@ -78,7 +91,19 @@ public function get($propertyName, $params = null)
if(isset($params) && !empty($params))
{
$filter = $params[0];
- return $this->filterValue($value, $filter);
+ if(!isset($params[1]))
+ {
+ $params[1] = false;
+ }
+ if(!isset($params[2]))
+ {
+ $params[2] = false;
+ }
+ if(!isset($params[3]))
+ {
+ $params[3] = false;
+ }
+ return $this->filterValue($value, $filter, $params[1], $params[2], $params[3]);
}
else
{
@@ -193,12 +218,20 @@ public function filterInput($type, $variable_name, $filter = PicoFilterConstant:
* @param integer $filter
* @param boolean $escapeSQL
* @param boolean $nullIfEmpty
+ * @param boolean $requireScalar
* @return mixed|null
*/
- public function filterValue($val, $filter = PicoFilterConstant::FILTER_DEFAULT, $escapeSQL = false, $nullIfEmpty = false)
+ public function filterValue($val, $filter = PicoFilterConstant::FILTER_DEFAULT, $escapeSQL = false, $nullIfEmpty = false, $requireScalar = false)
{
$ret = null;
- if(is_scalar($val))
+
+ if(($requireScalar || $this->forceScalar) && (isset($val) && !is_scalar($val)))
+ {
+ // If application require scalar but user give non-scalar, MagicObject will return null
+ // It mean that application will not process invalid input type
+ return null;
+ }
+ if(!isset($val) || is_scalar($val))
{
return $this->filterValueSingle($val, $filter, $escapeSQL, $nullIfEmpty);
}
@@ -414,18 +447,6 @@ public function _getValue($cfg, $input)
return $output * 1;
}
- /**
- * Get value from formated number
- *
- * @param stdClass|MagicObject $cfg
- * @param mixed $input
- * @return float
- */
- public function getValue($cfg, $input)
- {
- return $this->_getValue($cfg, $input);
- }
-
/**
* Magic method called when user call any undefined method
*
@@ -434,12 +455,11 @@ public function getValue($cfg, $input)
* @return mixed|null
*/
public function __call($method, $params) //NOSONAR
- {
-
+ {
if (strncasecmp($method, "countable", 9) === 0)
{
$var = lcfirst(substr($method, 9));
- return is_array($this->$var);
+ return isset($this->$var) && is_array($this->$var);
}
else if (strncasecmp($method, "isset", 5) === 0)
{
@@ -500,6 +520,14 @@ public function __call($method, $params) //NOSONAR
return $this;
}
}
+
+ /**
+ * Apply filter
+ *
+ * @param string $value
+ * @param string $filterType
+ * @return string|null
+ */
private function applyFilter($value, $filterType)
{
if(isset($value))
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/SecretObject.php b/inc.lib/vendor/planetbiru/magic-object/src/SecretObject.php
index 303d3680..29691984 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/SecretObject.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/SecretObject.php
@@ -156,7 +156,6 @@ private function _objectInfo()
}
}
}
-
}
/**
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Session/PicoSession.php b/inc.lib/vendor/planetbiru/magic-object/src/Session/PicoSession.php
index d07fb130..bb81bd1c 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Session/PicoSession.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Session/PicoSession.php
@@ -288,4 +288,25 @@ public function saveToFiles($path)
ini_set("session.save_path ", $path);
return $this;
}
+
+ /**
+ * Get session ID
+ *
+ * @return string
+ */
+ public function getSessionId()
+ {
+ return @session_id();
+ }
+
+ /**
+ * Get session ID
+ *
+ * @return self
+ */
+ public function setSessionId($id)
+ {
+ @session_id($id);
+ return $this;
+ }
}
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/SetterGetter.php b/inc.lib/vendor/planetbiru/magic-object/src/SetterGetter.php
index 07478c26..d5a6a71c 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/SetterGetter.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/SetterGetter.php
@@ -5,11 +5,12 @@
use MagicObject\Exceptions\InvalidAnnotationException;
use MagicObject\Exceptions\InvalidQueryInputException;
use MagicObject\Util\ClassUtil\PicoAnnotationParser;
+use MagicObject\Util\PicoArrayUtil;
use MagicObject\Util\PicoStringUtil;
use ReflectionClass;
use stdClass;
-class SetterGetter
+class SetterGetter extends stdClass
{
const JSON = 'JSON';
@@ -22,8 +23,10 @@ class SetterGetter
/**
* Constructor
+ *
+ * @param self|array|stdClass|object $data
*/
- public function __construct()
+ public function __construct($data = null)
{
$jsonAnnot = new PicoAnnotationParser(get_class($this));
$params = $jsonAnnot->getParameters();
@@ -39,6 +42,41 @@ public function __construct()
throw new InvalidAnnotationException("Invalid annotation @".$paramName);
}
}
+ if($data != null)
+ {
+ if(is_array($data))
+ {
+ $data = PicoArrayUtil::camelize($data);
+ }
+ $this->loadData($data);
+ }
+ }
+
+ /**
+ * Load data to object
+ * @param mixed $data
+ * @return self
+ */
+ public function loadData($data)
+ {
+ if($data != null)
+ {
+ if($data instanceof self)
+ {
+ $values = $data->value();
+ foreach ($values as $key => $value) {
+ $key2 = PicoStringUtil::camelize($key);
+ $this->set($key2, $value);
+ }
+ }
+ else if (is_array($data) || is_object($data)) {
+ foreach ($data as $key => $value) {
+ $key2 = PicoStringUtil::camelize($key);
+ $this->set($key2, $value);
+ }
+ }
+ }
+ return $this;
}
/**
@@ -85,8 +123,8 @@ public function __set($name, $value)
* Gets datas from the property.
* Example: echo $instance->foo;
*
- * @param string $name Name of the property to get.
- * @return mixed Datas stored in property.
+ * @param string $name Property name
+ * @return mixed Data stored in property.
**/
public function __get($name)
{
@@ -99,7 +137,7 @@ public function __get($name)
/**
* Check if property has been set or not or has null value
*
- * @param string $name
+ * @param string $name Property name
* @return boolean
*/
public function __isset($name)
@@ -110,7 +148,7 @@ public function __isset($name)
/**
* Unset property value
*
- * @param string $name
+ * @param string $name Property name
* @return void
*/
public function __unset($name)
@@ -187,8 +225,8 @@ function($property) use($class)
/**
* Magic method called when user call any undefined method
*
- * @param string $method
- * @param string $params
+ * @param string $method Called method
+ * @param string $params Parameters given
* @return mixed|null
*/
public function __call($method, $params) //NOSONAR
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Util/Database/PicoDatabaseUtil.php b/inc.lib/vendor/planetbiru/magic-object/src/Util/Database/PicoDatabaseUtil.php
index 043bdca4..7c46c3fd 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Util/Database/PicoDatabaseUtil.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Util/Database/PicoDatabaseUtil.php
@@ -15,7 +15,7 @@ class PicoDatabaseUtil
*/
public static function specificationFromParams($params)
{
- if(isset($params) && is_array($params))
+ if(self::isArray($params))
{
foreach($params as $param)
{
@@ -35,7 +35,7 @@ public static function specificationFromParams($params)
*/
public static function pagableFromParams($params)
{
- if(isset($params) && is_array($params))
+ if(self::isArray($params))
{
foreach($params as $param)
{
@@ -55,7 +55,7 @@ public static function pagableFromParams($params)
*/
public static function sortableFromParams($params)
{
- if(isset($params) && is_array($params))
+ if(self::isArray($params))
{
foreach($params as $param)
{
@@ -76,7 +76,7 @@ public static function sortableFromParams($params)
public static function valuesFromParams($params)
{
$ret = array();
- if(isset($params) && is_array($params))
+ if(self::isArray($params))
{
foreach($params as $param)
{
@@ -237,4 +237,117 @@ public static function uuid()
$random = sprintf('%06x', mt_rand(0, 16777215));
return sprintf('%s%s', $uuid, $random);
}
+
+ /**
+ * Split SQL
+ *
+ * @param string $sqlText
+ * @return string[]
+ */
+ public function splitSql($sqlText) //NOSONAR
+ {
+ $sqlText = str_replace("\n", "\r\n", $sqlText);
+ $sqlText = str_replace("\r\r\n", "\r\n", $sqlText);
+ $arr = explode("\r\n", $sqlText);
+ $arr2 = array();
+ foreach($arr as $key=>$val)
+ {
+ $arr[$key] = ltrim($val);
+ if(stripos($arr[$key], "-- ") !== 0 && $arr[$key] != "--" && $arr[$key] != "")
+ {
+ $arr2[] = $arr[$key];
+ }
+ }
+ $arr = $arr2;
+ unset($arr2);
+
+ $append = 0;
+ $skip = 0;
+ $start = 1;
+ $nquery = -1;
+ $delimiter = ";";
+ $queryArray = array();
+ $delimiterArray = array();
+
+ foreach($arr as $line=>$text)
+ {
+ if($text == "" && $append == 1)
+ {
+ $queryArray[$nquery] .= "\r\n";
+ }
+ if($append == 0)
+ {
+ if(stripos(ltrim($text, " \t "), "--") === 0)
+ {
+ $skip = 1;
+ $nquery++;
+ $start = 1;
+ $append = 0;
+ }
+ else
+ {
+ $skip = 0;
+ }
+ }
+ if($skip == 0)
+ {
+ if($start == 1)
+ {
+ $nquery++;
+ $queryArray[$nquery] = "";
+ $delimiterArray[$nquery] = $delimiter;
+ $start = 0;
+ }
+ $queryArray[$nquery] .= $text."\r\n";
+ $delimiterArray[$nquery] = $delimiter;
+ $text = ltrim($text, " \t ");
+ $start = strlen($text)-strlen($delimiter)-1;
+ if(stripos(substr($text, $start), $delimiter) !== false || $text == $delimiter)
+ {
+ $nquery++;
+ $start = 1;
+ $append = 0;
+ }
+ else
+ {
+ $start = 0;
+ $append = 1;
+ }
+ $delimiterArray[$nquery] = $delimiter;
+ if(stripos($text, "delimiter ") !== false)
+ {
+ $text = trim(preg_replace("/\s+/"," ",$text));
+ $arr2 = explode(" ", $text);
+ $delimiter = $arr2[1];
+ $nquery++;
+ $delimiterArray[$nquery] = $delimiter;
+ $start = 1;
+ $append = 0;
+ }
+ }
+ }
+ $result = array();
+ foreach($queryArray as $line=>$sql)
+ {
+ $delimiter = $delimiterArray[$line];
+ if(stripos($sql, "delimiter ") !== 0)
+ {
+ $sql = rtrim($sql, " \r\n\t ");
+ $sql = substr($sql, 0, strlen($sql)-strlen($delimiter));
+ $result[] = array("query"=> $sql, "delimiter"=>$delimiter);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Check if parameter os array
+ *
+ * @param mixed $params
+ * @return boolean
+ */
+ private static function isArray($params)
+ {
+ return isset($params) && is_array($params);
+ }
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Util/Database/PicoDatabaseUtilMySql.php b/inc.lib/vendor/planetbiru/magic-object/src/Util/Database/PicoDatabaseUtilMySql.php
index 2231ad0d..97249017 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Util/Database/PicoDatabaseUtilMySql.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Util/Database/PicoDatabaseUtilMySql.php
@@ -23,11 +23,34 @@ public static function getColumnList($database, $picoTableName)
$sql = "SHOW COLUMNS FROM $picoTableName";
return $database->fetchAll($sql);
}
+
+ /**
+ * Get auto increment keys
+ *
+ * @param PicoTableInfo $tableInfo Table information
+ * @return array
+ */
+ public static function getAutoIncrementKey($tableInfo)
+ {
+ $autoIncrement = $tableInfo->getAutoIncrementKeys();
+ $autoIncrementKeys = array();
+ if(is_array($autoIncrement) && !empty($autoIncrement))
+ {
+ foreach($autoIncrement as $col)
+ {
+ if($col["strategy"] == 'GenerationType.IDENTITY')
+ {
+ $autoIncrementKeys[] = $col["name"];
+ }
+ }
+ }
+ return $autoIncrementKeys;
+ }
/**
* Dump database structure
*
- * @param PicoTableInfo $tableInfo
+ * @param PicoTableInfo $tableInfo Table information
* @param string $picoTableName
* @return string
*/
@@ -41,14 +64,15 @@ public static function dumpStructure($tableInfo, $picoTableName, $createIfNotExi
$query[] = "";
}
$createStatement = "";
+
+ $createStatement = "CREATE TABLE";
if($createIfNotExists)
{
- $createStatement = "CREATE TABLE IF NOT EXISTS";
- }
- else
- {
- $createStatement = "CREATE TABLE";
+ $createStatement .= " IF NOT EXISTS";
}
+
+ $autoIncrementKeys = self::getAutoIncrementKey($tableInfo);
+
$query[] = "$createStatement `$picoTableName` (";
foreach($tableInfo->getColumns() as $column)
@@ -70,6 +94,15 @@ public static function dumpStructure($tableInfo, $picoTableName, $createIfNotExi
$query[] = ";";
}
+ foreach($tableInfo->getColumns() as $column)
+ {
+ if(isset($autoIncrementKeys) && is_array($autoIncrementKeys) && in_array($column['name'], $autoIncrementKeys))
+ {
+ $query[] = "";
+ $query[] = "ALTER TABLE `$picoTableName` \r\n\tMODIFY ".trim(self::createColumn($column), " \r\n\t ")." AUTO_INCREMENT";
+ $query[] = ";";
+ }
+ }
return implode("\r\n", $query);
}
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Util/File/FileUtil.php b/inc.lib/vendor/planetbiru/magic-object/src/Util/File/FileUtil.php
new file mode 100644
index 00000000..3358b6bb
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Util/File/FileUtil.php
@@ -0,0 +1,27 @@
+ 0)
+ {
+ $file2add = substr($fullPath, strlen($origin) + 1);
+ }
+ is_dir($fullPath) ? array_push($allFiles, ...self::getFiles($fullPath, $level + 1, $origin)) : array_push($allFiles, $file2add);
+ }
+ return $allFiles;
+ }
+}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoArrayUtil.php b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoArrayUtil.php
index c114075e..b571ef37 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoArrayUtil.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoArrayUtil.php
@@ -2,6 +2,8 @@
namespace MagicObject\Util;
+use stdClass;
+
class PicoArrayUtil
{
/**
@@ -45,13 +47,14 @@ public static function snakeize($input)
return $array;
}
}
+
/**
* Camelize array keys
*
* @param array $array
* @return array
*/
- private static function _camelize(&$array)
+ private static function _camelize(&$array) //NOSONAR
{
foreach (array_keys($array) as $key)
{
@@ -84,7 +87,7 @@ private static function _camelize(&$array)
* @param array $array
* @return array
*/
- private static function _snakeize(&$array)
+ private static function _snakeize(&$array) //NOSONAR
{
foreach (array_keys($array) as $key)
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoEnvironmentVariable.php b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoEnvironmentVariable.php
index 50fdb5f6..f97ebbde 100644
--- a/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoEnvironmentVariable.php
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoEnvironmentVariable.php
@@ -2,6 +2,8 @@
namespace MagicObject\Util;
+use stdClass;
+
class PicoEnvironmentVariable
{
/**
@@ -63,7 +65,7 @@ public static function replaceValueAllArray($values, $collection, $recursive = f
* @param stdClass|object $values
* @param array $collection
* @param boolean $recursive
- * @return array
+ * @return array|stdClass|object
*/
public static function replaceValueAllObject($values, $collection, $recursive = false)
{
@@ -102,8 +104,7 @@ public static function replaceWithOtherProperties($value, $collection)
{
$result = $value;
$regex = '/\$\\{([^}]+)\\}/m';
- preg_match_all($regex, $value, $matches);
-
+ preg_match_all($regex, $value, $matches);
$pair = array_combine($matches[0], $matches[1]);
if(!empty($pair))
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoIniUtil.php b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoIniUtil.php
new file mode 100644
index 00000000..7cf8d044
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoIniUtil.php
@@ -0,0 +1,165 @@
+ 3) {
+ file_put_contents($path, $content);
+ }
+ return true;
+ }
+
+ /**
+ * Get INI content
+ *
+ * @param string $content
+ * @param array $array
+ * @return string
+ */
+ private static function getContent($content, $array)
+ {
+ foreach ($array as $key2 => $elem2) {
+ if (is_array($elem2)) {
+ for ($i = 0; $i < count($elem2); $i++) {
+ $content .= $key2 . "[] = \"" . $elem2[$i] . "\"\n";
+ }
+ } else if ($elem2 == "") {
+ $content .= $key2 . " = \n";
+ } else {
+ $content .= $key2 . " = \"" . $elem2 . "\"\n";
+ }
+ }
+ return $content;
+ }
+
+ /**
+ * Get INI content from multiple
+ *
+ * @param string $content
+ * @param array $array
+ * @return string
+ */
+ private static function getContentMulti($content, $array)
+ {
+ foreach ($array as $key => $elem) {
+ $content .= "[" . $key . "]\n";
+ foreach ($elem as $key2 => $elem2) {
+ if (is_array($elem2)) {
+ for ($i = 0; $i < count($elem2); $i++) {
+ $content .= $key2 . "[] = \"" . $elem2[$i] . "\"\n";
+ }
+ } else if ($elem2 == "") {
+ $content .= $key2 . " = \n";
+ } else {
+ $content .= $key2 . " = \"" . $elem2 . "\"\n";
+ }
+ }
+ }
+ return $content;
+ }
+
+ /**
+ * Parse ini file
+ *
+ * @param string $path
+ * @return array|false
+ */
+ public static function parseIniFile($path) // NOSONAR
+ {
+ if (!file_exists($path)) {
+ return false;
+ }
+ $str = file_get_contents($path);
+ if (empty($str)) {
+ return false;
+ }
+
+ $lines = explode("\n", $str);
+ $ret = array();
+ $inside_section = false;
+
+ foreach ($lines as $line) {
+
+ $line = trim($line);
+
+ if (!$line || $line[0] == "#" || $line[0] == ";") {
+ continue;
+ }
+
+ if ($line[0] == "[" && $endIdx = strpos($line, "]")) {
+ $inside_section = substr($line, 1, $endIdx - 1);
+ continue;
+ }
+
+ if (!strpos($line, '=')) {
+ continue;
+ }
+
+ $tmp = explode("=", $line, 2);
+
+ if ($inside_section) {
+
+ $key = rtrim($tmp[0]);
+ $value = ltrim($tmp[1]);
+ if (
+ PicoStringUtil::startsWith($value, '"') && PicoStringUtil::endsWith($value, '"')
+ || PicoStringUtil::startsWith($value, "'") && PicoStringUtil::endsWith($value, "'")
+ ) {
+ $value = substr($value, 1, strlen($value) - 2);
+ }
+
+ if (preg_match("/^\".*\"$/", $value) || preg_match("/^'.*'$/", $value)) {
+ $value = mb_substr($value, 1, mb_strlen($value) - 2);
+ }
+
+ preg_match("^\[(.*?)\]^", $key, $matches);
+ if (!empty($matches) && isset($matches[0])) {
+
+ $arr_name = preg_replace('#\[(.*?)\]#is', '', $key);
+
+ if (!isset($ret[$inside_section][$arr_name]) || !is_array($ret[$inside_section][$arr_name])) {
+ $ret[$inside_section][$arr_name] = array();
+ }
+
+ if (isset($matches[1]) && !empty($matches[1])) {
+ $ret[$inside_section][$arr_name][$matches[1]] = $value;
+ } else {
+ $ret[$inside_section][$arr_name][] = $value;
+ }
+ } else {
+ $ret[$inside_section][trim($tmp[0])] = $value;
+ }
+ } else {
+ $value = ltrim($tmp[1]);
+ if (
+ PicoStringUtil::startsWith($value, '"') && PicoStringUtil::endsWith($value, '"')
+ || PicoStringUtil::startsWith($value, "'") && PicoStringUtil::endsWith($value, "'")
+ ) {
+ $value = substr($value, 1, strlen($value) - 2);
+ }
+ $ret[trim($tmp[0])] = $value;
+ }
+ }
+ return $ret;
+ }
+}
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoLocale.php b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoLocale.php
new file mode 100644
index 00000000..ca4f608c
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoLocale.php
@@ -0,0 +1,635 @@
+DefinitionData = array();
+ $this->definitionData = array();
# standardize line breaks
$text = str_replace(array("\r\n", "\r"), "\n", $text);
@@ -107,7 +107,7 @@ public function setSafeMode($safeMode)
# Lines
#
- protected $BlockTypes = array(
+ protected $blockTypes = array(
'#' => array('Header'),
'*' => array('Rule', 'List'),
'+' => array('List'),
@@ -181,15 +181,15 @@ protected function lines(array $lines)
# ~
- $Line = array('body' => $line, 'indent' => $indent, 'text' => $text);
+ $line = array('body' => $line, 'indent' => $indent, 'text' => $text);
# ~
if (isset($CurrentBlock['continuable'])) {
- $Block = $this->{'block' . $CurrentBlock['type'] . 'Continue'}($Line, $CurrentBlock);
+ $block = $this->{'block' . $CurrentBlock['type'] . 'Continue'}($line, $CurrentBlock);
- if (isset($Block)) {
- $CurrentBlock = $Block;
+ if (isset($block)) {
+ $CurrentBlock = $block;
continue;
} else {
@@ -207,8 +207,8 @@ protected function lines(array $lines)
$blockTypes = $this->unmarkedBlockTypes;
- if (isset($this->BlockTypes[$marker])) {
- foreach ($this->BlockTypes[$marker] as $blockType) {
+ if (isset($this->blockTypes[$marker])) {
+ foreach ($this->blockTypes[$marker] as $blockType) {
$blockTypes[] = $blockType;
}
}
@@ -217,22 +217,22 @@ protected function lines(array $lines)
# ~
foreach ($blockTypes as $blockType) {
- $Block = $this->{'block' . $blockType}($Line, $CurrentBlock);
+ $block = $this->{'block' . $blockType}($line, $CurrentBlock);
- if (isset($Block)) {
- $Block['type'] = $blockType;
+ if (isset($block)) {
+ $block['type'] = $blockType;
- if (!isset($Block['identified'])) {
+ if (!isset($block['identified'])) {
$Blocks[] = $CurrentBlock;
- $Block['identified'] = true;
+ $block['identified'] = true;
}
if ($this->isBlockContinuable($blockType)) {
- $Block['continuable'] = true;
+ $block['continuable'] = true;
}
- $CurrentBlock = $Block;
+ $CurrentBlock = $block;
continue 2;
}
@@ -245,7 +245,7 @@ protected function lines(array $lines)
} else {
$Blocks[] = $CurrentBlock;
- $CurrentBlock = $this->paragraph($Line);
+ $CurrentBlock = $this->paragraph($line);
$CurrentBlock['identified'] = true;
}
@@ -267,13 +267,13 @@ protected function lines(array $lines)
$markup = '';
- foreach ($Blocks as $Block) {
- if (isset($Block['hidden'])) {
+ foreach ($Blocks as $block) {
+ if (isset($block['hidden'])) {
continue;
}
$markup .= "\n";
- $markup .= isset($Block['markup']) ? $Block['markup'] : $this->element($Block['element']);
+ $markup .= isset($block['markup']) ? $block['markup'] : $this->element($block['element']);
}
$markup .= "\n";
@@ -296,16 +296,16 @@ protected function isBlockCompletable($Type)
#
# Code
- protected function blockCode($Line, $Block = null)
+ protected function blockCode($line, $block = null)
{
- if (isset($Block) && !isset($Block['type']) && !isset($Block['interrupted'])) {
+ if (isset($block) && !isset($block['type']) && !isset($block['interrupted'])) {
return;
}
- if ($Line['indent'] >= 4) {
- $text = substr($Line['body'], 4);
+ if ($line['indent'] >= 4) {
+ $text = substr($line['body'], 4);
- $Block = array(
+ $block = array(
'element' => array(
'name' => 'pre',
'handler' => 'element',
@@ -316,82 +316,82 @@ protected function blockCode($Line, $Block = null)
),
);
- return $Block;
+ return $block;
}
}
- protected function blockCodeContinue($Line, $Block)
+ protected function blockCodeContinue($line, $block)
{
- if ($Line['indent'] >= 4) {
- if (isset($Block['interrupted'])) {
- $Block['element']['text']['text'] .= "\n";
+ if ($line['indent'] >= 4) {
+ if (isset($block['interrupted'])) {
+ $block['element']['text']['text'] .= "\n";
- unset($Block['interrupted']);
+ unset($block['interrupted']);
}
- $Block['element']['text']['text'] .= "\n";
+ $block['element']['text']['text'] .= "\n";
- $text = substr($Line['body'], 4);
+ $text = substr($line['body'], 4);
- $Block['element']['text']['text'] .= $text;
+ $block['element']['text']['text'] .= $text;
- return $Block;
+ return $block;
}
}
- protected function blockCodeComplete($Block)
+ protected function blockCodeComplete($block)
{
- $text = $Block['element']['text']['text'];
+ $text = $block['element']['text']['text'];
- $Block['element']['text']['text'] = $text;
+ $block['element']['text']['text'] = $text;
- return $Block;
+ return $block;
}
#
# Comment
- protected function blockComment($Line)
+ protected function blockComment($line)
{
if ($this->markupEscaped || $this->safeMode) {
return;
}
- if (isset($Line['text'][3]) && $Line['text'][3] === '-' && $Line['text'][2] === '-' && $Line['text'][1] === '!') {
- $Block = array(
- 'markup' => $Line['body'],
+ if (isset($line['text'][3]) && $line['text'][3] === '-' && $line['text'][2] === '-' && $line['text'][1] === '!') {
+ $block = array(
+ 'markup' => $line['body'],
);
- if (preg_match('/-->$/', $Line['text'])) {
- $Block['closed'] = true;
+ if (preg_match('/-->$/', $line['text'])) {
+ $block['closed'] = true;
}
- return $Block;
+ return $block;
}
}
- protected function blockCommentContinue($Line, array $Block)
+ protected function blockCommentContinue($line, array $block)
{
- if (isset($Block['closed'])) {
+ if (isset($block['closed'])) {
return;
}
- $Block['markup'] .= "\n" . $Line['body'];
+ $block['markup'] .= "\n" . $line['body'];
- if (preg_match('/-->$/', $Line['text'])) {
- $Block['closed'] = true;
+ if (preg_match('/-->$/', $line['text'])) {
+ $block['closed'] = true;
}
- return $Block;
+ return $block;
}
#
# Fenced Code
- protected function blockFencedCode($Line)
+ protected function blockFencedCode($line)
{
- if (preg_match('/^[' . $Line['text'][0] . ']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) {
- $Element = array(
+ if (preg_match('/^[' . $line['text'][0] . ']{3,}[ ]*([^`]+)?[ ]*$/', $line['text'], $matches)) {
+ $element = array(
'name' => 'code',
'text' => '',
);
@@ -413,67 +413,67 @@ protected function blockFencedCode($Line)
$class = 'language-' . $language;
- $Element['attributes'] = array(
+ $element['attributes'] = array(
'class' => $class,
);
}
- $Block = array(
- 'char' => $Line['text'][0],
+ $block = array(
+ 'char' => $line['text'][0],
'element' => array(
'name' => 'pre',
'handler' => 'element',
- 'text' => $Element,
+ 'text' => $element,
),
);
- return $Block;
+ return $block;
}
}
- protected function blockFencedCodeContinue($Line, $Block)
+ protected function blockFencedCodeContinue($line, $block)
{
- if (isset($Block['complete'])) {
+ if (isset($block['complete'])) {
return;
}
- if (isset($Block['interrupted'])) {
- $Block['element']['text']['text'] .= "\n";
+ if (isset($block['interrupted'])) {
+ $block['element']['text']['text'] .= "\n";
- unset($Block['interrupted']);
+ unset($block['interrupted']);
}
- if (preg_match('/^' . $Block['char'] . '{3,}[ ]*$/', $Line['text'])) {
- $Block['element']['text']['text'] = substr($Block['element']['text']['text'], 1);
+ if (preg_match('/^' . $block['char'] . '{3,}[ ]*$/', $line['text'])) {
+ $block['element']['text']['text'] = substr($block['element']['text']['text'], 1);
- $Block['complete'] = true;
+ $block['complete'] = true;
- return $Block;
+ return $block;
}
- $Block['element']['text']['text'] .= "\n" . $Line['body'];
+ $block['element']['text']['text'] .= "\n" . $line['body'];
- return $Block;
+ return $block;
}
- protected function blockFencedCodeComplete($Block)
+ protected function blockFencedCodeComplete($block)
{
- $text = $Block['element']['text']['text'];
+ $text = $block['element']['text']['text'];
- $Block['element']['text']['text'] = $text;
+ $block['element']['text']['text'] = $text;
- return $Block;
+ return $block;
}
#
# Header
- protected function blockHeader($Line)
+ protected function blockHeader($line)
{
- if (isset($Line['text'][1])) {
+ if (isset($line['text'][1])) {
$level = 1;
- while (isset($Line['text'][$level]) && $Line['text'][$level] === '#') {
+ while (isset($line['text'][$level]) && $line['text'][$level] === '#') {
$level++;
}
@@ -481,9 +481,9 @@ protected function blockHeader($Line)
return;
}
- $text = trim($Line['text'], '# ');
+ $text = trim($line['text'], '# ');
- $Block = array(
+ $block = array(
'element' => array(
'name' => 'h' . min(6, $level),
'text' => $text,
@@ -491,20 +491,20 @@ protected function blockHeader($Line)
),
);
- return $Block;
+ return $block;
}
}
#
# List
- protected function blockList($Line)
+ protected function blockList($line)
{
- list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]');
+ list($name, $pattern) = $line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]');
- if (preg_match('/^(' . $pattern . '[ ]+)(.*)/', $Line['text'], $matches)) {
- $Block = array(
- 'indent' => $Line['indent'],
+ if (preg_match('/^(' . $pattern . '[ ]+)(.*)/', $line['text'], $matches)) {
+ $block = array(
+ 'indent' => $line['indent'],
'pattern' => $pattern,
'element' => array(
'name' => $name,
@@ -516,11 +516,11 @@ protected function blockList($Line)
$listStart = stristr($matches[0], '.', true);
if ($listStart !== '1') {
- $Block['element']['attributes'] = array('start' => $listStart);
+ $block['element']['attributes'] = array('start' => $listStart);
}
}
- $Block['li'] = array(
+ $block['li'] = array(
'name' => 'li',
'handler' => 'li',
'text' => array(
@@ -528,28 +528,28 @@ protected function blockList($Line)
),
);
- $Block['element']['text'][] = &$Block['li'];
+ $block['element']['text'][] = &$block['li'];
- return $Block;
+ return $block;
}
}
- protected function blockListContinue($Line, array $Block)
+ protected function blockListContinue($line, array $block)
{
- if ($Block['indent'] === $Line['indent'] && preg_match('/^' . $Block['pattern'] . '(?:[ ]+(.*)|$)/', $Line['text'], $matches)) {
- if (isset($Block['interrupted'])) {
- $Block['li']['text'][] = '';
+ if ($block['indent'] === $line['indent'] && preg_match('/^' . $block['pattern'] . '(?:[ ]+(.*)|$)/', $line['text'], $matches)) {
+ if (isset($block['interrupted'])) {
+ $block['li']['text'][] = '';
- $Block['loose'] = true;
+ $block['loose'] = true;
- unset($Block['interrupted']);
+ unset($block['interrupted']);
}
- unset($Block['li']);
+ unset($block['li']);
$text = isset($matches[1]) ? $matches[1] : '';
- $Block['li'] = array(
+ $block['li'] = array(
'name' => 'li',
'handler' => 'li',
'text' => array(
@@ -557,56 +557,56 @@ protected function blockListContinue($Line, array $Block)
),
);
- $Block['element']['text'][] = &$Block['li'];
+ $block['element']['text'][] = &$block['li'];
- return $Block;
+ return $block;
}
- if ($Line['text'][0] === '[' && $this->blockReference($Line)) {
- return $Block;
+ if ($line['text'][0] === '[' && $this->blockReference($line)) {
+ return $block;
}
- if (!isset($Block['interrupted'])) {
- $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']);
+ if (!isset($block['interrupted'])) {
+ $text = preg_replace('/^[ ]{0,4}/', '', $line['body']);
- $Block['li']['text'][] = $text;
+ $block['li']['text'][] = $text;
- return $Block;
+ return $block;
}
- if ($Line['indent'] > 0) {
- $Block['li']['text'][] = '';
+ if ($line['indent'] > 0) {
+ $block['li']['text'][] = '';
- $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']);
+ $text = preg_replace('/^[ ]{0,4}/', '', $line['body']);
- $Block['li']['text'][] = $text;
+ $block['li']['text'][] = $text;
- unset($Block['interrupted']);
+ unset($block['interrupted']);
- return $Block;
+ return $block;
}
}
- protected function blockListComplete(array $Block)
+ protected function blockListComplete(array $block)
{
- if (isset($Block['loose'])) {
- foreach ($Block['element']['text'] as &$li) {
+ if (isset($block['loose'])) {
+ foreach ($block['element']['text'] as &$li) {
if (end($li['text']) !== '') {
$li['text'][] = '';
}
}
}
- return $Block;
+ return $block;
}
#
# Quote
- protected function blockQuote($Line)
+ protected function blockQuote($line)
{
- if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) {
- $Block = array(
+ if (preg_match('/^>[ ]?(.*)/', $line['text'], $matches)) {
+ $block = array(
'element' => array(
'name' => 'blockquote',
'handler' => 'lines',
@@ -614,94 +614,94 @@ protected function blockQuote($Line)
),
);
- return $Block;
+ return $block;
}
}
- protected function blockQuoteContinue($Line, array $Block)
+ protected function blockQuoteContinue($line, array $block)
{
- if ($Line['text'][0] === '>' && preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) {
- if (isset($Block['interrupted'])) {
- $Block['element']['text'][] = '';
+ if ($line['text'][0] === '>' && preg_match('/^>[ ]?(.*)/', $line['text'], $matches)) {
+ if (isset($block['interrupted'])) {
+ $block['element']['text'][] = '';
- unset($Block['interrupted']);
+ unset($block['interrupted']);
}
- $Block['element']['text'][] = $matches[1];
+ $block['element']['text'][] = $matches[1];
- return $Block;
+ return $block;
}
- if (!isset($Block['interrupted'])) {
- $Block['element']['text'][] = $Line['text'];
+ if (!isset($block['interrupted'])) {
+ $block['element']['text'][] = $line['text'];
- return $Block;
+ return $block;
}
}
#
# Rule
- protected function blockRule($Line)
+ protected function blockRule($line)
{
- if (preg_match('/^([' . $Line['text'][0] . '])([ ]*\1){2,}[ ]*$/', $Line['text'])) {
- $Block = array(
+ if (preg_match('/^([' . $line['text'][0] . '])([ ]*\1){2,}[ ]*$/', $line['text'])) {
+ $block = array(
'element' => array(
'name' => 'hr'
),
);
- return $Block;
+ return $block;
}
}
#
# Setext
- protected function blockSetextHeader($Line, array $Block = null)
+ protected function blockSetextHeader($line, array $block = null)
{
- if (!isset($Block) || isset($Block['type']) || isset($Block['interrupted'])) {
+ if (!isset($block) || isset($block['type']) || isset($block['interrupted'])) {
return;
}
- if (chop($Line['text'], $Line['text'][0]) === '') {
- $Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2';
+ if (chop($line['text'], $line['text'][0]) === '') {
+ $block['element']['name'] = $line['text'][0] === '=' ? 'h1' : 'h2';
- return $Block;
+ return $block;
}
}
#
# Markup
- protected function blockMarkup($Line)
+ protected function blockMarkup($line)
{
if ($this->markupEscaped || $this->safeMode) {
return;
}
- if (preg_match('/^<(\w[\w-]*)(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*(\/)?>/', $Line['text'], $matches)) {
+ if (preg_match('/^<(\w[\w-]*)(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*(\/)?>/', $line['text'], $matches)) {
$element = strtolower($matches[1]);
if (in_array($element, $this->textLevelElements)) {
return;
}
- $Block = array(
+ $block = array(
'name' => $matches[1],
'depth' => 0,
- 'markup' => $Line['text'],
+ 'markup' => $line['text'],
);
$length = strlen($matches[0]);
- $remainder = substr($Line['text'], $length);
+ $remainder = substr($line['text'], $length);
if (trim($remainder) === '') {
if (isset($matches[2]) || in_array($matches[1], $this->voidElements)) {
- $Block['closed'] = true;
+ $block['closed'] = true;
- $Block['void'] = true;
+ $block['void'] = true;
}
} else {
if (isset($matches[2]) || in_array($matches[1], $this->voidElements)) {
@@ -709,51 +709,51 @@ protected function blockMarkup($Line)
}
if (preg_match('/<\/' . $matches[1] . '>[ ]*$/i', $remainder)) {
- $Block['closed'] = true;
+ $block['closed'] = true;
}
}
- return $Block;
+ return $block;
}
}
- protected function blockMarkupContinue($Line, array $Block)
+ protected function blockMarkupContinue($line, array $block)
{
- if (isset($Block['closed'])) {
+ if (isset($block['closed'])) {
return;
}
- if (preg_match('/^<' . $Block['name'] . '(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*>/i', $Line['text'])) # open
+ if (preg_match('/^<' . $block['name'] . '(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*>/i', $line['text'])) # open
{
- $Block['depth']++;
+ $block['depth']++;
}
- if (preg_match('/(.*?)<\/' . $Block['name'] . '>[ ]*$/i', $Line['text'], $matches)) # close
+ if (preg_match('/(.*?)<\/' . $block['name'] . '>[ ]*$/i', $line['text'], $matches)) # close
{
- if ($Block['depth'] > 0) {
- $Block['depth']--;
+ if ($block['depth'] > 0) {
+ $block['depth']--;
} else {
- $Block['closed'] = true;
+ $block['closed'] = true;
}
}
- if (isset($Block['interrupted'])) {
- $Block['markup'] .= "\n";
+ if (isset($block['interrupted'])) {
+ $block['markup'] .= "\n";
- unset($Block['interrupted']);
+ unset($block['interrupted']);
}
- $Block['markup'] .= "\n" . $Line['body'];
+ $block['markup'] .= "\n" . $line['body'];
- return $Block;
+ return $block;
}
#
# Reference
- protected function blockReference($Line)
+ protected function blockReference($line)
{
- if (preg_match('/^\[(.+?)\]:[ ]*(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $Line['text'], $matches)) {
+ if (preg_match('/^\[(.+?)\]:[ ]*(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $line['text'], $matches)) {
$id = strtolower($matches[1]);
$Data = array(
@@ -765,29 +765,29 @@ protected function blockReference($Line)
$Data['title'] = $matches[3];
}
- $this->DefinitionData['Reference'][$id] = $Data;
+ $this->definitionData['Reference'][$id] = $Data;
- $Block = array(
+ $block = array(
'hidden' => true,
);
- return $Block;
+ return $block;
}
}
#
# Table
- protected function blockTable($Line, array $Block = null)
+ protected function blockTable($line, array $block = null)
{
- if (!isset($Block) || isset($Block['type']) || isset($Block['interrupted'])) {
+ if (!isset($block) || isset($block['type']) || isset($block['interrupted'])) {
return;
}
- if (strpos($Block['element']['text'], '|') !== false && chop($Line['text'], ' -:|') === '') {
+ if (strpos($block['element']['text'], '|') !== false && chop($line['text'], ' -:|') === '') {
$alignments = array();
- $divider = $Line['text'];
+ $divider = $line['text'];
$divider = trim($divider);
$divider = trim($divider, '|');
@@ -818,7 +818,7 @@ protected function blockTable($Line, array $Block = null)
$HeaderElements = array();
- $header = $Block['element']['text'];
+ $header = $block['element']['text'];
$header = trim($header);
$header = trim($header, '|');
@@ -847,7 +847,7 @@ protected function blockTable($Line, array $Block = null)
# ~
- $Block = array(
+ $block = array(
'alignments' => $alignments,
'identified' => true,
'element' => array(
@@ -856,37 +856,37 @@ protected function blockTable($Line, array $Block = null)
),
);
- $Block['element']['text'][] = array(
+ $block['element']['text'][] = array(
'name' => 'thead',
'handler' => 'elements',
);
- $Block['element']['text'][] = array(
+ $block['element']['text'][] = array(
'name' => 'tbody',
'handler' => 'elements',
'text' => array(),
);
- $Block['element']['text'][0]['text'][] = array(
+ $block['element']['text'][0]['text'][] = array(
'name' => 'tr',
'handler' => 'elements',
'text' => $HeaderElements,
);
- return $Block;
+ return $block;
}
}
- protected function blockTableContinue($Line, array $Block)
+ protected function blockTableContinue($line, array $block)
{
- if (isset($Block['interrupted'])) {
+ if (isset($block['interrupted'])) {
return;
}
- if ($Line['text'][0] === '|' || strpos($Line['text'], '|')) {
+ if ($line['text'][0] === '|' || strpos($line['text'], '|')) {
$Elements = array();
- $row = $Line['text'];
+ $row = $line['text'];
$row = trim($row);
$row = trim($row, '|');
@@ -896,30 +896,30 @@ protected function blockTableContinue($Line, array $Block)
foreach ($matches[0] as $index => $cell) {
$cell = trim($cell);
- $Element = array(
+ $element = array(
'name' => 'td',
'handler' => 'line',
'text' => $cell,
);
- if (isset($Block['alignments'][$index])) {
- $Element['attributes'] = array(
- 'style' => 'text-align: ' . $Block['alignments'][$index] . ';',
+ if (isset($block['alignments'][$index])) {
+ $element['attributes'] = array(
+ 'style' => 'text-align: ' . $block['alignments'][$index] . ';',
);
}
- $Elements[] = $Element;
+ $Elements[] = $element;
}
- $Element = array(
+ $element = array(
'name' => 'tr',
'handler' => 'elements',
'text' => $Elements,
);
- $Block['element']['text'][1]['text'][] = $Element;
+ $block['element']['text'][1]['text'][] = $element;
- return $Block;
+ return $block;
}
}
@@ -927,17 +927,17 @@ protected function blockTableContinue($Line, array $Block)
# ~
#
- protected function paragraph($Line)
+ protected function paragraph($line)
{
- $Block = array(
+ $block = array(
'element' => array(
'name' => 'p',
- 'text' => $Line['text'],
+ 'text' => $line['text'],
'handler' => 'line',
),
);
- return $Block;
+ return $block;
}
#
@@ -1154,7 +1154,7 @@ protected function inlineImage($Excerpt)
protected function inlineLink($Excerpt)
{
- $Element = array(
+ $element = array(
'name' => 'a',
'handler' => 'line',
'nonNestables' => array('Url', 'Link'),
@@ -1170,7 +1170,7 @@ protected function inlineLink($Excerpt)
$remainder = $Excerpt['text'];
if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches)) {
- $Element['text'] = $matches[1];
+ $element['text'] = $matches[1];
$extent += strlen($matches[0]);
@@ -1180,36 +1180,36 @@ protected function inlineLink($Excerpt)
}
if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches)) {
- $Element['attributes']['href'] = $matches[1];
+ $element['attributes']['href'] = $matches[1];
if (isset($matches[2])) {
- $Element['attributes']['title'] = substr($matches[2], 1, -1);
+ $element['attributes']['title'] = substr($matches[2], 1, -1);
}
$extent += strlen($matches[0]);
} else {
if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) {
- $definition = strlen($matches[1]) ? $matches[1] : $Element['text'];
+ $definition = strlen($matches[1]) ? $matches[1] : $element['text'];
$definition = strtolower($definition);
$extent += strlen($matches[0]);
} else {
- $definition = strtolower($Element['text']);
+ $definition = strtolower($element['text']);
}
- if (!isset($this->DefinitionData['Reference'][$definition])) {
+ if (!isset($this->definitionData['Reference'][$definition])) {
return;
}
- $Definition = $this->DefinitionData['Reference'][$definition];
+ $Definition = $this->definitionData['Reference'][$definition];
- $Element['attributes']['href'] = $Definition['url'];
- $Element['attributes']['title'] = $Definition['title'];
+ $element['attributes']['href'] = $Definition['url'];
+ $element['attributes']['title'] = $Definition['title'];
}
return array(
'extent' => $extent,
- 'element' => $Element,
+ 'element' => $element,
);
}
@@ -1339,16 +1339,16 @@ protected function unmarkedText($text)
# Handlers
#
- protected function element(array $Element)
+ protected function element(array $element)
{
if ($this->safeMode) {
- $Element = $this->sanitiseElement($Element);
+ $element = $this->sanitiseElement($element);
}
- $markup = '<' . $Element['name'];
+ $markup = '<' . $element['name'];
- if (isset($Element['attributes'])) {
- foreach ($Element['attributes'] as $name => $value) {
+ if (isset($element['attributes'])) {
+ foreach ($element['attributes'] as $name => $value) {
if ($value === null) {
continue;
}
@@ -1359,33 +1359,33 @@ protected function element(array $Element)
$permitRawHtml = false;
- if (isset($Element['text'])) {
- $text = $Element['text'];
+ if (isset($element['text'])) {
+ $text = $element['text'];
}
// very strongly consider an alternative if you're writing an
// extension
- elseif (isset($Element['rawHtml'])) {
- $text = $Element['rawHtml'];
- $allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];
+ elseif (isset($element['rawHtml'])) {
+ $text = $element['rawHtml'];
+ $allowRawHtmlInSafeMode = isset($element['allowRawHtmlInSafeMode']) && $element['allowRawHtmlInSafeMode'];
$permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;
}
if (isset($text)) {
$markup .= '>';
- if (!isset($Element['nonNestables'])) {
- $Element['nonNestables'] = array();
+ if (!isset($element['nonNestables'])) {
+ $element['nonNestables'] = array();
}
- if (isset($Element['handler'])) {
- $markup .= $this->{$Element['handler']}($text, $Element['nonNestables']);
+ if (isset($element['handler'])) {
+ $markup .= $this->{$element['handler']}($text, $element['nonNestables']);
} elseif (!$permitRawHtml) {
$markup .= self::escape($text, true);
} else {
$markup .= $text;
}
- $markup .= '' . $Element['name'] . '>';
+ $markup .= '' . $element['name'] . '>';
} else {
$markup .= ' />';
}
@@ -1397,8 +1397,8 @@ protected function elements(array $Elements)
{
$markup = '';
- foreach ($Elements as $Element) {
- $markup .= "\n" . $this->element($Element);
+ foreach ($Elements as $element) {
+ $markup .= "\n" . $this->element($element);
}
$markup .= "\n";
@@ -1437,7 +1437,7 @@ public function parse($text)
return $markup;
}
- protected function sanitiseElement(array $Element)
+ protected function sanitiseElement(array $element)
{
static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/';
static $safeUrlNameToAtt = array(
@@ -1445,37 +1445,37 @@ protected function sanitiseElement(array $Element)
'img' => 'src',
);
- if (isset($safeUrlNameToAtt[$Element['name']])) {
- $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]);
+ if (isset($safeUrlNameToAtt[$element['name']])) {
+ $element = $this->filterUnsafeUrlInAttribute($element, $safeUrlNameToAtt[$element['name']]);
}
- if (!empty($Element['attributes'])) {
- foreach ($Element['attributes'] as $att => $val) {
+ if (!empty($element['attributes'])) {
+ foreach ($element['attributes'] as $att => $val) {
# filter out badly parsed attribute
if (!preg_match($goodAttribute, $att)) {
- unset($Element['attributes'][$att]);
+ unset($element['attributes'][$att]);
}
# dump onevent attribute
elseif (self::striAtStart($att, 'on')) {
- unset($Element['attributes'][$att]);
+ unset($element['attributes'][$att]);
}
}
}
- return $Element;
+ return $element;
}
- protected function filterUnsafeUrlInAttribute(array $Element, $attribute)
+ protected function filterUnsafeUrlInAttribute(array $element, $attribute)
{
foreach ($this->safeLinksWhitelist as $scheme) {
- if (self::striAtStart($Element['attributes'][$attribute], $scheme)) {
- return $Element;
+ if (self::striAtStart($element['attributes'][$attribute], $scheme)) {
+ return $element;
}
}
- $Element['attributes'][$attribute] = str_replace(':', '%3A', $Element['attributes'][$attribute]);
+ $element['attributes'][$attribute] = str_replace(':', '%3A', $element['attributes'][$attribute]);
- return $Element;
+ return $element;
}
#
@@ -1517,7 +1517,7 @@ public static function instance($name = 'default')
# Fields
#
- protected $DefinitionData;
+ protected $definitionData;
#
# Read-Only
diff --git a/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoPasswordUtil.php b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoPasswordUtil.php
new file mode 100644
index 00000000..18fc1064
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/src/Util/PicoPasswordUtil.php
@@ -0,0 +1,145 @@
+hashAlgorithm = $hashAlgorithm;
+ $this->minLength = $minLength;
+ $this->regex = $regex;
+ }
+
+ /**
+ * Get regular expression
+ *
+ * @return string
+ */
+ private function getRegexString()
+ {
+ if(stripos($this->regex, '%d') !== false)
+ {
+ return sprintf($this->regex, $this->minLength);
+ }
+ return $this->regex;
+ }
+
+ /**
+ * Validate password
+ *
+ * @param string $password
+ * @return true
+ * @throws InvalidInputFormatException
+ */
+ public function validate($password)
+ {
+ if(strlen($password) < $this->minLength)
+ {
+ throw new InvalidInputFormatException("Invalid password length");
+ }
+ if(!preg_match($this->getRegexString(), $password))
+ {
+ throw new InvalidInputFormatException("Invalid password format");
+ }
+ return true;
+ }
+
+ /**
+ * Get password hash
+ *
+ * @param string $password
+ * @param boolean $binary
+ * @return string
+ */
+ public function getHash($password, $binary = false)
+ {
+ $this->validate($password);
+ return hash($this->hashAlgorithm, $password, $binary);
+ }
+
+ /**
+ * Get regular expression format
+ *
+ * @return string
+ */
+ public function getRegex()
+ {
+ return $this->regex;
+ }
+
+ /**
+ * Set regular expression format
+ *
+ * @param string $regex Regular expression format
+ *
+ * @return self
+ */
+ public function setRegex($regex)
+ {
+ $this->regex = $regex;
+
+ return $this;
+ }
+
+ /**
+ * Get minimum length of the password
+ *
+ * @return integer
+ */
+ public function getMinLength()
+ {
+ return $this->minLength;
+ }
+
+ /**
+ * Set minimum length of the password
+ *
+ * @param integer $minLength Minimum length of the password
+ *
+ * @return self
+ */
+ public function setMinLength($minLength)
+ {
+ $this->minLength = $minLength;
+
+ return $this;
+ }
+
+ /**
+ * Get the value of hashAlgorithm
+ */
+ public function getHashAlgorithm()
+ {
+ return $this->hashAlgorithm;
+ }
+
+ /**
+ * Set the value of hashAlgorithm
+ *
+ * @return self
+ */
+ public function setHashAlgorithm($hashAlgorithm)
+ {
+ $this->hashAlgorithm = $hashAlgorithm;
+
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/tests/entity.php b/inc.lib/vendor/planetbiru/magic-object/tests/entity.php
index 12f230ec..79b2d7eb 100644
--- a/inc.lib/vendor/planetbiru/magic-object/tests/entity.php
+++ b/inc.lib/vendor/planetbiru/magic-object/tests/entity.php
@@ -169,26 +169,6 @@ class EntityAlbum extends MagicObject
* @var string
*/
protected $ipEdit;
-
- /**
- * Blocked
- *
- * @Column(name="blocked", type="tinyint(1)", length=1, default_value="1", nullable=true)
- * @DefaultColumn(value="1")
- * @Label(content="Blocked")
- * @var boolean
- */
- protected $blocked;
-
- /**
- * Hacked
- *
- * @Column(name="hacked", type="tinyint(1)", length=1, default_value="null", nullable=true)
- * @DefaultColumn(value="1")
- * @Label(content="Hacked")
- * @var boolean
- */
- protected $hacked;
/**
* Active
@@ -643,7 +623,9 @@ class Artist extends MagicObject
$databaseCredential = new SecretObject();
$databaseCredential->loadYamlFile(dirname(dirname(__DIR__))."/test.yml", false, true, true);
-$database = new PicoDatabase($databaseCredential);
+$database = new PicoDatabase($databaseCredential->getDatabase(), function(){}, function($sql){
+ // echo $sql;
+});
$database->connect();
$album = new EntityAlbum(null, $database);
@@ -716,10 +698,49 @@ class Artist extends MagicObject
echo "\r\n-----\r\n";
*/
- $dumper = new PicoDatabaseDump();
+ //$dumper = new PicoDatabaseDump();
+
+ //$sql = $dumper->createAlterTableAdd($album);
+ //print_r($sql);
+
+
+ $subqueryMap = array(
+ 'producer'=>array(
+ 'entityName'=>'Producer',
+ 'tableName'=>'producer',
+ 'primaryKey'=>'producer_id',
+ 'columnName'=>'producer_id',
+ 'objectName'=>'producer',
+ 'propertyName'=>'name'
+ )
+ );
+
+ /*
+
+ $result = $album->findAll(null, null, null, true, $subqueryMap, MagicObject::FIND_OPTION_NO_COUNT_DATA | MagicObject::FIND_OPTION_NO_FETCH_DATA);
+
+ while($data = $result->fetch())
+ {
+ echo $data;
+ }
+ */
+
+
+ //echo $r;
+
+
+
+ $result = $album->findAll(null, null, null, true, $subqueryMap);
+
+ foreach($result->getResult() as $row)
+ {
+ echo $row;
+ }
+
+
- $sql = $dumper->createAlterTableAdd($album);
- print_r($sql);
+ //$album->findOneWithPrimaryKeyValue('0648d495ade4515811f2', $arr);
+ //echo $album;
}
catch(Exception $e)
{
diff --git a/inc.lib/vendor/planetbiru/magic-object/tests/entity/Music/Entity/EntitySong.php b/inc.lib/vendor/planetbiru/magic-object/tests/entity/Music/Entity/EntitySong.php
index b8a187ed..b5cd2d24 100644
--- a/inc.lib/vendor/planetbiru/magic-object/tests/entity/Music/Entity/EntitySong.php
+++ b/inc.lib/vendor/planetbiru/magic-object/tests/entity/Music/Entity/EntitySong.php
@@ -14,440 +14,5 @@
*/
class EntitySong extends MagicObject
{
- /**
- * Song ID
- *
- * @Id
- * @GeneratedValue(strategy=GenerationType.UUID)
- * @NotNull
- * @Column(name="song_id", type="varchar(50)", length=50, nullable=false)
- * @Label(content="Song ID")
- * @var string
- */
- protected $songId;
-
- /**
- * Random Song ID
- *
- * @Column(name="random_song_id", type="varchar(50)", length=50, nullable=true)
- * @Label(content="Random Song ID")
- * @var string
- */
- protected $randomSongId;
-
- /**
- * Name
- *
- * @Column(name="name", type="varchar(100)", length=100, nullable=true)
- * @Label(content="Name")
- * @var string
- */
- protected $name;
-
- /**
- * Title
- *
- * @Column(name="title", type="text", nullable=true)
- * @Label(content="Title")
- * @var string
- */
- protected $title;
-
- /**
- * Album ID
- *
- * @Column(name="album_id", type="varchar(50)", length=50, nullable=true)
- * @Label(content="Album ID")
- * @var string
- */
- protected $albumId;
-
- /**
- * Track Number
- *
- * @Column(name="track_number", type="int(11)", length=11, nullable=true)
- * @Label(content="Track Number")
- * @var integer
- */
- protected $trackNumber;
-
- /**
- * Producer ID
- *
- * @Column(name="producer_id", type="varchar(40)", length=40, nullable=true)
- * @Label(content="Producer ID")
- * @var string
- */
- protected $producerId;
-
- /**
- * Artist Vocalist
- *
- * @Column(name="artist_vocalist", type="varchar(50)", length=50, nullable=true)
- * @Label(content="Artist Vocalist")
- * @var string
- */
- protected $artistVocalist;
-
- /**
- * Artist Composer
- *
- * @Column(name="artist_composer", type="varchar(50)", length=50, nullable=true)
- * @Label(content="Artist Composer")
- * @var string
- */
- protected $artistComposer;
-
- /**
- * Artist Arranger
- *
- * @Column(name="artist_arranger", type="varchar(50)", length=50, nullable=true)
- * @Label(content="Artist Arranger")
- * @var string
- */
- protected $artistArranger;
-
- /**
- * File Path
- *
- * @Column(name="file_path", type="text", nullable=true)
- * @Label(content="File Path")
- * @var string
- */
- protected $filePath;
-
- /**
- * File Name
- *
- * @Column(name="file_name", type="varchar(100)", length=100, nullable=true)
- * @Label(content="File Name")
- * @var string
- */
- protected $fileName;
-
- /**
- * File Type
- *
- * @Column(name="file_type", type="varchar(100)", length=100, nullable=true)
- * @Label(content="File Type")
- * @var string
- */
- protected $fileType;
-
- /**
- * File Extension
- *
- * @Column(name="file_extension", type="varchar(20)", length=20, nullable=true)
- * @Label(content="File Extension")
- * @var string
- */
- protected $fileExtension;
-
- /**
- * File Size
- *
- * @Column(name="file_size", type="bigint(20)", length=20, nullable=true)
- * @Label(content="File Size")
- * @var integer
- */
- protected $fileSize;
-
- /**
- * File Md5
- *
- * @Column(name="file_md5", type="varchar(32)", length=32, nullable=true)
- * @Label(content="File Md5")
- * @var string
- */
- protected $fileMd5;
-
- /**
- * File Upload Time
- *
- * @Column(name="file_upload_time", type="timestamp", length=19, nullable=true)
- * @Label(content="File Upload Time")
- * @var string
- */
- protected $fileUploadTime;
-
- /**
- * First Upload Time
- *
- * @Column(name="first_upload_time", type="timestamp", length=19, nullable=true)
- * @Label(content="First Upload Time")
- * @var string
- */
- protected $firstUploadTime;
-
- /**
- * Last Upload Time
- *
- * @Column(name="last_upload_time", type="timestamp", length=19, nullable=true)
- * @Label(content="Last Upload Time")
- * @var string
- */
- protected $lastUploadTime;
-
- /**
- * File Path Midi
- *
- * @Column(name="file_path_midi", type="text", nullable=true)
- * @Label(content="File Path Midi")
- * @var string
- */
- protected $filePathMidi;
-
- /**
- * Last Upload Time Midi
- *
- * @Column(name="last_upload_time_midi", type="timestamp", length=19, nullable=true)
- * @Label(content="Last Upload Time Midi")
- * @var string
- */
- protected $lastUploadTimeMidi;
-
- /**
- * File Path Xml
- *
- * @Column(name="file_path_xml", type="text", nullable=true)
- * @Label(content="File Path Xml")
- * @var string
- */
- protected $filePathXml;
-
- /**
- * Last Upload Time Xml
- *
- * @Column(name="last_upload_time_xml", type="timestamp", length=19, nullable=true)
- * @Label(content="Last Upload Time Xml")
- * @var string
- */
- protected $lastUploadTimeXml;
-
- /**
- * File Path Pdf
- *
- * @Column(name="file_path_pdf", type="text", nullable=true)
- * @Label(content="File Path Pdf")
- * @var string
- */
- protected $filePathPdf;
-
- /**
- * Last Upload Time Pdf
- *
- * @Column(name="last_upload_time_pdf", type="timestamp", length=19, nullable=true)
- * @Label(content="Last Upload Time Pdf")
- * @var string
- */
- protected $lastUploadTimePdf;
-
- /**
- * Duration
- *
- * @Column(name="duration", type="float", nullable=true)
- * @Label(content="Duration")
- * @var double
- */
- protected $duration;
-
- /**
- * Genre ID
- *
- * @Column(name="genre_id", type="varchar(50)", length=50, nullable=true)
- * @Label(content="Genre ID")
- * @var string
- */
- protected $genreId;
-
- /**
- * Bpm
- *
- * @Column(name="bpm", type="float", nullable=true)
- * @Label(content="Bpm")
- * @var double
- */
- protected $bpm;
-
- /**
- * Time Signature
- *
- * @Column(name="time_signature", type="varchar(40)", length=40, nullable=true)
- * @Label(content="Time Signature")
- * @var string
- */
- protected $timeSignature;
-
- /**
- * Subtitle
- *
- * @Column(name="subtitle", type="longtext", nullable=true)
- * @Label(content="Subtitle")
- * @var string
- */
- protected $subtitle;
-
- /**
- * Subtitle Complete
- *
- * @Column(name="subtitle_complete", type="tinyint(1)", length=1, nullable=true)
- * @Label(content="Subtitle Complete")
- * @var boolean
- */
- protected $subtitleComplete;
-
- /**
- * Lyric Midi
- *
- * @Column(name="lyric_midi", type="longtext", nullable=true)
- * @Label(content="Lyric Midi")
- * @var string
- */
- protected $lyricMidi;
-
- /**
- * Lyric Midi Raw
- *
- * @Column(name="lyric_midi_raw", type="longtext", nullable=true)
- * @Label(content="Lyric Midi Raw")
- * @var string
- */
- protected $lyricMidiRaw;
-
- /**
- * Vocal Guide
- *
- * @Column(name="vocal_guide", type="longtext", nullable=true)
- * @Label(content="Vocal Guide")
- * @var string
- */
- protected $vocalGuide;
-
- /**
- * Vocal
- *
- * @Column(name="vocal", type="tinyint(1)", length=1, nullable=true)
- * @Label(content="Vocal")
- * @var boolean
- */
- protected $vocal;
-
- /**
- * Instrument
- *
- * @Column(name="instrument", type="longtext", nullable=true)
- * @Label(content="Instrument")
- * @var string
- */
- protected $instrument;
-
- /**
- * Midi Vocal Channel
- *
- * @Column(name="midi_vocal_channel", type="int(11)", length=11, nullable=true)
- * @Label(content="Midi Vocal Channel")
- * @var integer
- */
- protected $midiVocalChannel;
-
- /**
- * Rating
- *
- * @Column(name="rating", type="float", nullable=true)
- * @Label(content="Rating")
- * @var double
- */
- protected $rating;
-
- /**
- * Comment
- *
- * @Column(name="comment", type="longtext", nullable=true)
- * @Label(content="Comment")
- * @var string
- */
- protected $comment;
-
- /**
- * Image Path
- *
- * @Column(name="image_path", type="text", nullable=true)
- * @Label(content="Image Path")
- * @var string
- */
- protected $imagePath;
-
- /**
- * Last Upload Time Image
- *
- * @Column(name="last_upload_time_image", type="timestamp", length=19, nullable=true)
- * @Label(content="Last Upload Time Image")
- * @var string
- */
- protected $lastUploadTimeImage;
-
- /**
- * Time Create
- *
- * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
- * @Label(content="Time Create")
- * @var string
- */
- protected $timeCreate;
-
- /**
- * Time Edit
- *
- * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
- * @Label(content="Time Edit")
- * @var string
- */
- protected $timeEdit;
-
- /**
- * IP Create
- *
- * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
- * @Label(content="IP Create")
- * @var string
- */
- protected $ipCreate;
-
- /**
- * IP Edit
- *
- * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
- * @Label(content="IP Edit")
- * @var string
- */
- protected $ipEdit;
-
- /**
- * Admin Create
- *
- * @Column(name="admin_create", type="varchar(50)", length=50, nullable=true, updatable=false)
- * @Label(content="Admin Create")
- * @var string
- */
- protected $adminCreate;
-
- /**
- * Admin Edit
- *
- * @Column(name="admin_edit", type="varchar(50)", length=50, nullable=true)
- * @Label(content="Admin Edit")
- * @var string
- */
- protected $adminEdit;
-
- /**
- * Active
- *
- * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
- * @DefaultColumn(value="1")
- * @Label(content="Active")
- * @var boolean
- */
- protected $active;
}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/tests/insert.php b/inc.lib/vendor/planetbiru/magic-object/tests/insert.php
new file mode 100644
index 00000000..25171e48
--- /dev/null
+++ b/inc.lib/vendor/planetbiru/magic-object/tests/insert.php
@@ -0,0 +1,205 @@
+loadYamlFile(dirname(dirname(__DIR__))."/test.yml", false, true, true);
+$database = new PicoDatabase($databaseCredential->getDatabase(), function(){}, function($sql){
+ //echo $sql;
+});
+$database->connect();
+
+$album = new EntityAlbum(null, $database);
+try
+{
+ $album->setName("Test");
+
+ $album->insert();
+
+}
+catch(Exception $e)
+{
+ echo $e->getMessage();
+}
\ No newline at end of file
diff --git a/inc.lib/vendor/planetbiru/magic-object/tests/test.php b/inc.lib/vendor/planetbiru/magic-object/tests/test.php
index 72616751..93b3faca 100644
--- a/inc.lib/vendor/planetbiru/magic-object/tests/test.php
+++ b/inc.lib/vendor/planetbiru/magic-object/tests/test.php
@@ -4,6 +4,5 @@
require_once dirname(__DIR__) . "/vendor/autoload.php";
-
echo (new PicoTestValueUtil())->doReturnAttributeChecked()->whenEquals(1, 1);
diff --git a/inc.lib/vendor/planetbiru/magic-object/tutorial.md b/inc.lib/vendor/planetbiru/magic-object/tutorial.md
index a01b6d8e..76ab3f29 100644
--- a/inc.lib/vendor/planetbiru/magic-object/tutorial.md
+++ b/inc.lib/vendor/planetbiru/magic-object/tutorial.md
@@ -1416,6 +1416,18 @@ $sessions->startSession();
Entity is class to access database. Entity is derived from MagicObject. Some annotations required to activated all entity features.
+**Constructor**
+
+Parameters:
+
+1. array|stdClass|object $data
+
+Initial data
+
+2. PicoDatabase $database
+
+Database connection
+
```php
addAnd($spec2);
$album = new Album(null, $database);
$album->where($specfification)->delete();
+```
+
+### Subquery
+
+For large data with a very large number of records, using joins, whether inner joins, outer joins, left joins or right joins, will require a lot of resources, which will reduce application and database performance. MagicObject version 1.10 introduces searches using subqueries instead of joins so that the data search process becomes faster.
+
+Using subqueries is not without its drawbacks. The unavoidable disadvantages of subqueries are as follows:
+
+1. just take one column from the reference table
+2. Cannot use columns in the reference table either for filter (where) or for sorting (order by).
+
+Users must be aware of these two shortcomings before deciding to use a subquery.
+
+Example:
+
+```php
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="album")
+ */
+class EntityAlbum extends MagicObject
+{
+ /**
+ * Album ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="album_id", type="varchar(50)", length=50, nullable=false)
+ * @Label(content="Album ID")
+ * @var string
+ */
+ protected $albumId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Title
+ *
+ * @Column(name="title", type="text", nullable=true)
+ * @Label(content="Title")
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * Description
+ *
+ * @Column(name="description", type="longtext", nullable=true)
+ * @Label(content="Description")
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * Producer ID
+ *
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Producer
+ *
+ * @JoinColumn(name="producer_id")
+ * @Label(content="Producer")
+ * @var Producer
+ */
+ protected $producer;
+
+ /**
+ * Release Date
+ *
+ * @Column(name="release_date", type="date", nullable=true)
+ * @Label(content="Release Date")
+ * @var string
+ */
+ protected $releaseDate;
+
+ /**
+ * Number Of Song
+ *
+ * @Column(name="number_of_song", type="int(11)", length=11, nullable=true)
+ * @Label(content="Number Of Song")
+ * @var integer
+ */
+ protected $numberOfSong;
+
+ /**
+ * Duration
+ *
+ * @Column(name="duration", type="float", nullable=true)
+ * @Label(content="Duration")
+ * @var double
+ */
+ protected $duration;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Sort Order
+ *
+ * @Column(name="sort_order", type="int(11)", length=11, nullable=true)
+ * @Label(content="Sort Order")
+ * @var integer
+ */
+ protected $sortOrder;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+ /**
+ * As Draft
+ *
+ * @Column(name="as_draft", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @var boolean
+ */
+ protected $asDraft;
+
+}
+
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="producer")
+ */
+class Producer extends MagicObject
+{
+ /**
+ * Producer ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=false)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Gender
+ *
+ * @Column(name="gender", type="varchar(2)", length=2, nullable=true)
+ * @Label(content="Gender")
+ * @var string
+ */
+ protected $gender;
+
+ /**
+ * Birth Day
+ *
+ * @Column(name="birth_day", type="date", nullable=true)
+ * @Label(content="Birth Day")
+ * @var string
+ */
+ protected $birthDay;
+
+ /**
+ * Phone
+ *
+ * @Column(name="phone", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone")
+ * @var string
+ */
+ protected $phone;
+
+ /**
+ * Phone2
+ *
+ * @Column(name="phone2", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone2")
+ * @var string
+ */
+ protected $phone2;
+
+ /**
+ * Phone3
+ *
+ * @Column(name="phone3", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone3")
+ * @var string
+ */
+ protected $phone3;
+
+ /**
+ * Email
+ *
+ * @Column(name="email", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email")
+ * @var string
+ */
+ protected $email;
+
+ /**
+ * Email2
+ *
+ * @Column(name="email2", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email2")
+ * @var string
+ */
+ protected $email2;
+
+ /**
+ * Email3
+ *
+ * @Column(name="email3", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email3")
+ * @var string
+ */
+ protected $email3;
+
+ /**
+ * Website
+ *
+ * @Column(name="website", type="text", nullable=true)
+ * @Label(content="Website")
+ * @var string
+ */
+ protected $website;
+
+ /**
+ * Address
+ *
+ * @Column(name="address", type="text", nullable=true)
+ * @Label(content="Address")
+ * @var string
+ */
+ protected $address;
+
+ /**
+ * Picture
+ *
+ * @Column(name="picture", type="tinyint(1)", length=1, nullable=true)
+ * @var boolean
+ */
+ protected $picture;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Image Update
+ *
+ * @Column(name="image_update", type="timestamp", length=19, nullable=true)
+ * @Label(content="Image Update")
+ * @var string
+ */
+ protected $imageUpdate;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+}
+
+$album = new EntityAlbum(null, $database);
+
+$subqueryMap = array(
+ 'producer'=>array(
+ 'entityName'=>'Producer',
+ 'tableName'=>'producer',
+ 'primaryKey'=>'producer_id',
+ 'columnName'=>'producer_id',
+ 'objectName'=>'producer',
+ 'propertyName'=>'name'
+ )
+);
+
+$result = $album->findAll(null, null, null, true, $subqueryMap);
+
+foreach($result->getResult() as $row)
+{
+ echo $row;
+}
+```
+
+### Find All with Option
+
+1. MagicObject::FIND_OPTION_NO_COUNT_DATA
+2. MagicObject::FIND_OPTION_NO_FETCH_DATA
+
+If the `MagicObject::FIND_OPTION_NO_COUNT_DATA` option is provided, the MagicObject will not count data even if a PicoPageable is provided. This will reduce data processing time but the user does not know how much data actually is. This option can be selected when dealing with very large data.
+
+If the `MagicObject::FIND_OPTION_NO_FETCH_DATA` option is given, MagicObject will not directly fetch data and store it in the object. Users must retrieve data one by one using the fetch method. This option can be selected when handling very large data so that it does not consume much memory.
+
+Example:
+
+```php
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="album")
+ */
+class EntityAlbum extends MagicObject
+{
+ /**
+ * Album ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="album_id", type="varchar(50)", length=50, nullable=false)
+ * @Label(content="Album ID")
+ * @var string
+ */
+ protected $albumId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Title
+ *
+ * @Column(name="title", type="text", nullable=true)
+ * @Label(content="Title")
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * Description
+ *
+ * @Column(name="description", type="longtext", nullable=true)
+ * @Label(content="Description")
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * Producer ID
+ *
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Producer
+ *
+ * @JoinColumn(name="producer_id")
+ * @Label(content="Producer")
+ * @var Producer
+ */
+ protected $producer;
+
+ /**
+ * Release Date
+ *
+ * @Column(name="release_date", type="date", nullable=true)
+ * @Label(content="Release Date")
+ * @var string
+ */
+ protected $releaseDate;
+
+ /**
+ * Number Of Song
+ *
+ * @Column(name="number_of_song", type="int(11)", length=11, nullable=true)
+ * @Label(content="Number Of Song")
+ * @var integer
+ */
+ protected $numberOfSong;
+
+ /**
+ * Duration
+ *
+ * @Column(name="duration", type="float", nullable=true)
+ * @Label(content="Duration")
+ * @var double
+ */
+ protected $duration;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Sort Order
+ *
+ * @Column(name="sort_order", type="int(11)", length=11, nullable=true)
+ * @Label(content="Sort Order")
+ * @var integer
+ */
+ protected $sortOrder;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+ /**
+ * As Draft
+ *
+ * @Column(name="as_draft", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @var boolean
+ */
+ protected $asDraft;
+
+}
+
+/**
+ * @Entity
+ * @JSON(property-naming-strategy=SNAKE_CASE, prettify=true)
+ * @Table(name="producer")
+ */
+class Producer extends MagicObject
+{
+ /**
+ * Producer ID
+ *
+ * @Id
+ * @GeneratedValue(strategy=GenerationType.UUID)
+ * @NotNull
+ * @Column(name="producer_id", type="varchar(40)", length=40, nullable=false)
+ * @Label(content="Producer ID")
+ * @var string
+ */
+ protected $producerId;
+
+ /**
+ * Name
+ *
+ * @Column(name="name", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Name")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Gender
+ *
+ * @Column(name="gender", type="varchar(2)", length=2, nullable=true)
+ * @Label(content="Gender")
+ * @var string
+ */
+ protected $gender;
+
+ /**
+ * Birth Day
+ *
+ * @Column(name="birth_day", type="date", nullable=true)
+ * @Label(content="Birth Day")
+ * @var string
+ */
+ protected $birthDay;
+
+ /**
+ * Phone
+ *
+ * @Column(name="phone", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone")
+ * @var string
+ */
+ protected $phone;
+
+ /**
+ * Phone2
+ *
+ * @Column(name="phone2", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone2")
+ * @var string
+ */
+ protected $phone2;
+
+ /**
+ * Phone3
+ *
+ * @Column(name="phone3", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="Phone3")
+ * @var string
+ */
+ protected $phone3;
+
+ /**
+ * Email
+ *
+ * @Column(name="email", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email")
+ * @var string
+ */
+ protected $email;
+
+ /**
+ * Email2
+ *
+ * @Column(name="email2", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email2")
+ * @var string
+ */
+ protected $email2;
+
+ /**
+ * Email3
+ *
+ * @Column(name="email3", type="varchar(100)", length=100, nullable=true)
+ * @Label(content="Email3")
+ * @var string
+ */
+ protected $email3;
+
+ /**
+ * Website
+ *
+ * @Column(name="website", type="text", nullable=true)
+ * @Label(content="Website")
+ * @var string
+ */
+ protected $website;
+
+ /**
+ * Address
+ *
+ * @Column(name="address", type="text", nullable=true)
+ * @Label(content="Address")
+ * @var string
+ */
+ protected $address;
+
+ /**
+ * Picture
+ *
+ * @Column(name="picture", type="tinyint(1)", length=1, nullable=true)
+ * @var boolean
+ */
+ protected $picture;
+
+ /**
+ * Image Path
+ *
+ * @Column(name="image_path", type="text", nullable=true)
+ * @Label(content="Image Path")
+ * @var string
+ */
+ protected $imagePath;
+
+ /**
+ * Image Update
+ *
+ * @Column(name="image_update", type="timestamp", length=19, nullable=true)
+ * @Label(content="Image Update")
+ * @var string
+ */
+ protected $imageUpdate;
+
+ /**
+ * Time Create
+ *
+ * @Column(name="time_create", type="timestamp", length=19, nullable=true, updatable=false)
+ * @Label(content="Time Create")
+ * @var string
+ */
+ protected $timeCreate;
+
+ /**
+ * Time Edit
+ *
+ * @Column(name="time_edit", type="timestamp", length=19, nullable=true)
+ * @Label(content="Time Edit")
+ * @var string
+ */
+ protected $timeEdit;
+
+ /**
+ * Admin Create
+ *
+ * @Column(name="admin_create", type="varchar(40)", length=40, nullable=true, updatable=false)
+ * @Label(content="Admin Create")
+ * @var string
+ */
+ protected $adminCreate;
+
+ /**
+ * Admin Edit
+ *
+ * @Column(name="admin_edit", type="varchar(40)", length=40, nullable=true)
+ * @Label(content="Admin Edit")
+ * @var string
+ */
+ protected $adminEdit;
+
+ /**
+ * IP Create
+ *
+ * @Column(name="ip_create", type="varchar(50)", length=50, nullable=true, updatable=false)
+ * @Label(content="IP Create")
+ * @var string
+ */
+ protected $ipCreate;
+
+ /**
+ * IP Edit
+ *
+ * @Column(name="ip_edit", type="varchar(50)", length=50, nullable=true)
+ * @Label(content="IP Edit")
+ * @var string
+ */
+ protected $ipEdit;
+
+ /**
+ * Active
+ *
+ * @Column(name="active", type="tinyint(1)", length=1, default_value="1", nullable=true)
+ * @DefaultColumn(value="1")
+ * @Label(content="Active")
+ * @var boolean
+ */
+ protected $active;
+
+}
+
+$album = new EntityAlbum(null, $database);
+
+$subqueryMap = array(
+ 'producer'=>array(
+ 'entityName'=>'Producer',
+ 'tableName'=>'producer',
+ 'primaryKey'=>'producer_id',
+ 'columnName'=>'producer_id',
+ 'objectName'=>'producer',
+ 'propertyName'=>'name'
+ )
+);
+
+$result = $album->findAll(null, null, null, true, null, MagicObject::FIND_OPTION_NO_COUNT_DATA | MagicObject::FIND_OPTION_NO_FETCH_DATA);
+
+while($data = $result->fetch())
+{
+ echo $data;
+}
```
## Filtering, Ordering and Pagination
diff --git a/inc.lib/vendor/symfony/yaml/CHANGELOG.md b/inc.lib/vendor/symfony/yaml/CHANGELOG.md
index fd41c9dd..1b07b239 100644
--- a/inc.lib/vendor/symfony/yaml/CHANGELOG.md
+++ b/inc.lib/vendor/symfony/yaml/CHANGELOG.md
@@ -113,7 +113,7 @@ CHANGELOG
* Added support for customizing the dumped YAML string through an optional bit field:
```php
- Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT);
+ Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT);
```
3.0.0
diff --git a/inc.lib/vendor/symfony/yaml/Command/LintCommand.php b/inc.lib/vendor/symfony/yaml/Command/LintCommand.php
index fb8e3e65..4f2dc637 100644
--- a/inc.lib/vendor/symfony/yaml/Command/LintCommand.php
+++ b/inc.lib/vendor/symfony/yaml/Command/LintCommand.php
@@ -12,8 +12,6 @@
namespace Symfony\Component\Yaml\Command;
use Symfony\Component\Console\Command\Command;
-use Symfony\Component\Console\Exception\InvalidArgumentException;
-use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -88,17 +86,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!$filename) {
if (!$stdin = $this->getStdin()) {
- throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
+ throw new \RuntimeException('Please provide a filename or pipe file content to STDIN.');
}
- return $this->display($io, [$this->validate($stdin, $flags)]);
+ return $this->display($io, array($this->validate($stdin, $flags)));
}
if (!$this->isReadable($filename)) {
- throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
+ throw new \RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
}
- $filesInfo = [];
+ $filesInfo = array();
foreach ($this->getFiles($filename) as $file) {
$filesInfo[] = $this->validate(file_get_contents($file), $flags, $file);
}
@@ -109,7 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
private function validate($content, $flags, $file = null)
{
$prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) {
- if (\E_USER_DEPRECATED === $level) {
+ if (E_USER_DEPRECATED === $level) {
throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1);
}
@@ -119,12 +117,12 @@ private function validate($content, $flags, $file = null)
try {
$this->getParser()->parse($content, Yaml::PARSE_CONSTANT | $flags);
} catch (ParseException $e) {
- return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage()];
+ return array('file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage());
} finally {
restore_error_handler();
}
- return ['file' => $file, 'valid' => true];
+ return array('file' => $file, 'valid' => true);
}
private function display(SymfonyStyle $io, array $files)
@@ -135,13 +133,13 @@ private function display(SymfonyStyle $io, array $files)
case 'json':
return $this->displayJson($io, $files);
default:
- throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
+ throw new \InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
}
}
private function displayTxt(SymfonyStyle $io, array $filesInfo)
{
- $countFiles = \count($filesInfo);
+ $countFiles = count($filesInfo);
$erroredFiles = 0;
foreach ($filesInfo as $info) {
@@ -174,7 +172,7 @@ private function displayJson(SymfonyStyle $io, array $filesInfo)
}
});
- $io->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
+ $io->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
return min($errors, 1);
}
@@ -188,7 +186,7 @@ private function getFiles($fileOrDirectory)
}
foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
- if (!\in_array($file->getExtension(), ['yml', 'yaml'])) {
+ if (!in_array($file->getExtension(), array('yml', 'yaml'))) {
continue;
}
@@ -196,18 +194,15 @@ private function getFiles($fileOrDirectory)
}
}
- /**
- * @return string|null
- */
private function getStdin()
{
- if (0 !== ftell(\STDIN)) {
- return null;
+ if (0 !== ftell(STDIN)) {
+ return;
}
$inputs = '';
- while (!feof(\STDIN)) {
- $inputs .= fread(\STDIN, 1024);
+ while (!feof(STDIN)) {
+ $inputs .= fread(STDIN, 1024);
}
return $inputs;
@@ -232,7 +227,7 @@ private function getDirectoryIterator($directory)
};
if (null !== $this->directoryIteratorProvider) {
- return \call_user_func($this->directoryIteratorProvider, $directory, $default);
+ return call_user_func($this->directoryIteratorProvider, $directory, $default);
}
return $default($directory);
@@ -245,7 +240,7 @@ private function isReadable($fileOrDirectory)
};
if (null !== $this->isReadableProvider) {
- return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
+ return call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
}
return $default($fileOrDirectory);
diff --git a/inc.lib/vendor/symfony/yaml/Dumper.php b/inc.lib/vendor/symfony/yaml/Dumper.php
index 336e39c9..427f1a7b 100644
--- a/inc.lib/vendor/symfony/yaml/Dumper.php
+++ b/inc.lib/vendor/symfony/yaml/Dumper.php
@@ -11,8 +11,6 @@
namespace Symfony\Component\Yaml;
-use Symfony\Component\Yaml\Tag\TaggedValue;
-
/**
* Dumper dumps PHP variables to YAML strings.
*
@@ -50,7 +48,7 @@ public function __construct($indentation = 4)
*/
public function setIndentation($num)
{
- @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 3.1 and will be removed in 4.0. Pass the indentation to the constructor instead.', \E_USER_DEPRECATED);
+ @trigger_error('The '.__METHOD__.' method is deprecated since version 3.1 and will be removed in 4.0. Pass the indentation to the constructor instead.', E_USER_DEPRECATED);
$this->indentation = (int) $num;
}
@@ -67,8 +65,8 @@ public function setIndentation($num)
*/
public function dump($input, $inline = 0, $indent = 0, $flags = 0)
{
- if (\is_bool($flags)) {
- @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED);
+ if (is_bool($flags)) {
+ @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
if ($flags) {
$flags = Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE;
@@ -77,8 +75,8 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0)
}
}
- if (\func_num_args() >= 5) {
- @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', \E_USER_DEPRECATED);
+ if (func_num_args() >= 5) {
+ @trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED);
if (func_get_arg(4)) {
$flags |= Yaml::DUMP_OBJECT;
@@ -93,58 +91,29 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0)
$dumpObjectAsInlineMap = empty((array) $input);
}
- if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || empty($input)) {
+ if ($inline <= 0 || (!is_array($input) && $dumpObjectAsInlineMap) || empty($input)) {
$output .= $prefix.Inline::dump($input, $flags);
} else {
$dumpAsMap = Inline::isHash($input);
foreach ($input as $key => $value) {
- if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) {
- // If the first line starts with a space character, the spec requires a blockIndicationIndicator
- // http://www.yaml.org/spec/1.2/spec.html#id2793979
- $blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : '';
- $output .= sprintf("%s%s%s |%s\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator);
+ if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value) && false !== strpos($value, "\n")) {
+ $output .= sprintf("%s%s%s |\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '');
- foreach (explode("\n", $value) as $row) {
+ foreach (preg_split('/\n|\r\n/', $value) as $row) {
$output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row);
}
continue;
}
- if ($value instanceof TaggedValue) {
- $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag());
-
- if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
- // If the first line starts with a space character, the spec requires a blockIndicationIndicator
- // http://www.yaml.org/spec/1.2/spec.html#id2793979
- $blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
- $output .= sprintf(" |%s\n", $blockIndentationIndicator);
-
- foreach (explode("\n", $value->getValue()) as $row) {
- $output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row);
- }
-
- continue;
- }
-
- if ($inline - 1 <= 0 || null === $value->getValue() || is_scalar($value->getValue())) {
- $output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n";
- } else {
- $output .= "\n";
- $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags);
- }
-
- continue;
- }
-
$dumpObjectAsInlineMap = true;
if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) {
$dumpObjectAsInlineMap = empty((array) $value);
}
- $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value);
+ $willBeInlined = $inline - 1 <= 0 || !is_array($value) && $dumpObjectAsInlineMap || empty($value);
$output .= sprintf('%s%s%s%s',
$prefix,
diff --git a/inc.lib/vendor/symfony/yaml/Escaper.php b/inc.lib/vendor/symfony/yaml/Escaper.php
index 9413d7a2..94bb3924 100644
--- a/inc.lib/vendor/symfony/yaml/Escaper.php
+++ b/inc.lib/vendor/symfony/yaml/Escaper.php
@@ -22,28 +22,26 @@
class Escaper
{
// Characters that would cause a dumped string to require double quoting.
- const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\x7f|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9";
+ const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9";
// Mapping arrays for escaping a double quoted string. The backslash is
// first to ensure proper escaping because str_replace operates iteratively
// on the input arrays. This ordering of the characters avoids the use of strtr,
// which performs more slowly.
- private static $escapees = ['\\', '\\\\', '\\"', '"',
+ private static $escapees = array('\\', '\\\\', '\\"', '"',
"\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07",
"\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f",
"\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17",
"\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f",
- "\x7f",
"\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",
- ];
- private static $escaped = ['\\\\', '\\"', '\\\\', '\\"',
+ );
+ private static $escaped = array('\\\\', '\\"', '\\\\', '\\"',
'\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a',
'\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f',
'\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17',
'\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f',
- '\\x7f',
'\\N', '\\_', '\\L', '\\P',
- ];
+ );
/**
* Determines if a PHP value would require double quoting in YAML.
@@ -80,7 +78,7 @@ public static function requiresSingleQuoting($value)
{
// Determines if a PHP value is entirely composed of a value that would
// require single quoting in YAML.
- if (\in_array(strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'])) {
+ if (in_array(strtolower($value), array('null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'))) {
return true;
}
diff --git a/inc.lib/vendor/symfony/yaml/Exception/ParseException.php b/inc.lib/vendor/symfony/yaml/Exception/ParseException.php
index 4207d9ab..be79960b 100644
--- a/inc.lib/vendor/symfony/yaml/Exception/ParseException.php
+++ b/inc.lib/vendor/symfony/yaml/Exception/ParseException.php
@@ -121,7 +121,7 @@ private function updateRepr()
}
if (null !== $this->parsedFile) {
- $this->message .= sprintf(' in %s', json_encode($this->parsedFile, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
+ $this->message .= sprintf(' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
}
if ($this->parsedLine >= 0) {
diff --git a/inc.lib/vendor/symfony/yaml/Inline.php b/inc.lib/vendor/symfony/yaml/Inline.php
index 64ac48a9..0ef43f78 100644
--- a/inc.lib/vendor/symfony/yaml/Inline.php
+++ b/inc.lib/vendor/symfony/yaml/Inline.php
@@ -11,8 +11,8 @@
namespace Symfony\Component\Yaml;
-use Symfony\Component\Yaml\Exception\DumpException;
use Symfony\Component\Yaml\Exception\ParseException;
+use Symfony\Component\Yaml\Exception\DumpException;
use Symfony\Component\Yaml\Tag\TaggedValue;
/**
@@ -63,10 +63,10 @@ public static function initialize($flags, $parsedLineNumber = null, $parsedFilen
*
* @throws ParseException
*/
- public static function parse($value, $flags = 0, $references = [])
+ public static function parse($value, $flags = 0, $references = array())
{
- if (\is_bool($flags)) {
- @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED);
+ if (is_bool($flags)) {
+ @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
if ($flags) {
$flags = Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE;
@@ -75,25 +75,25 @@ public static function parse($value, $flags = 0, $references = [])
}
}
- if (\func_num_args() >= 3 && !\is_array($references)) {
- @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT flag instead.', \E_USER_DEPRECATED);
+ if (func_num_args() >= 3 && !is_array($references)) {
+ @trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT flag instead.', E_USER_DEPRECATED);
if ($references) {
$flags |= Yaml::PARSE_OBJECT;
}
- if (\func_num_args() >= 4) {
- @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', \E_USER_DEPRECATED);
+ if (func_num_args() >= 4) {
+ @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED);
if (func_get_arg(3)) {
$flags |= Yaml::PARSE_OBJECT_FOR_MAP;
}
}
- if (\func_num_args() >= 5) {
+ if (func_num_args() >= 5) {
$references = func_get_arg(4);
} else {
- $references = [];
+ $references = array();
}
}
@@ -110,37 +110,35 @@ public static function parse($value, $flags = 0, $references = [])
mb_internal_encoding('ASCII');
}
- try {
- $i = 0;
- $tag = self::parseTag($value, $i, $flags);
- switch ($value[$i]) {
- case '[':
- $result = self::parseSequence($value, $flags, $i, $references);
- ++$i;
- break;
- case '{':
- $result = self::parseMapping($value, $flags, $i, $references);
- ++$i;
- break;
- default:
- $result = self::parseScalar($value, $flags, null, $i, null === $tag, $references);
- }
+ $i = 0;
+ $tag = self::parseTag($value, $i, $flags);
+ switch ($value[$i]) {
+ case '[':
+ $result = self::parseSequence($value, $flags, $i, $references);
+ ++$i;
+ break;
+ case '{':
+ $result = self::parseMapping($value, $flags, $i, $references);
+ ++$i;
+ break;
+ default:
+ $result = self::parseScalar($value, $flags, null, $i, null === $tag, $references);
+ }
- // some comments are allowed at the end
- if (preg_replace('/\s*#.*$/A', '', substr($value, $i))) {
- throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
- }
+ if (null !== $tag) {
+ return new TaggedValue($tag, $result);
+ }
- if (null !== $tag) {
- return new TaggedValue($tag, $result);
- }
+ // some comments are allowed at the end
+ if (preg_replace('/\s+#.*$/A', '', substr($value, $i))) {
+ throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
+ }
- return $result;
- } finally {
- if (isset($mbEncoding)) {
- mb_internal_encoding($mbEncoding);
- }
+ if (isset($mbEncoding)) {
+ mb_internal_encoding($mbEncoding);
}
+
+ return $result;
}
/**
@@ -155,8 +153,8 @@ public static function parse($value, $flags = 0, $references = [])
*/
public static function dump($value, $flags = 0)
{
- if (\is_bool($flags)) {
- @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED);
+ if (is_bool($flags)) {
+ @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
if ($flags) {
$flags = Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE;
@@ -165,8 +163,8 @@ public static function dump($value, $flags = 0)
}
}
- if (\func_num_args() >= 3) {
- @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', \E_USER_DEPRECATED);
+ if (func_num_args() >= 3) {
+ @trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED);
if (func_get_arg(2)) {
$flags |= Yaml::DUMP_OBJECT;
@@ -174,7 +172,7 @@ public static function dump($value, $flags = 0)
}
switch (true) {
- case \is_resource($value):
+ case is_resource($value):
if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) {
throw new DumpException(sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_resource_type($value)));
}
@@ -182,7 +180,7 @@ public static function dump($value, $flags = 0)
return 'null';
case $value instanceof \DateTimeInterface:
return $value->format('c');
- case \is_object($value):
+ case is_object($value):
if ($value instanceof TaggedValue) {
return '!'.$value->getTag().' '.self::dump($value->getValue(), $flags);
}
@@ -200,7 +198,7 @@ public static function dump($value, $flags = 0)
}
return 'null';
- case \is_array($value):
+ case is_array($value):
return self::dumpArray($value, $flags);
case null === $value:
return 'null';
@@ -209,13 +207,13 @@ public static function dump($value, $flags = 0)
case false === $value:
return 'false';
case ctype_digit($value):
- return \is_string($value) ? "'$value'" : (int) $value;
- case is_numeric($value) && false === strpos($value, "\f") && false === strpos($value, "\n") && false === strpos($value, "\r") && false === strpos($value, "\t") && false === strpos($value, "\v"):
- $locale = setlocale(\LC_NUMERIC, 0);
+ return is_string($value) ? "'$value'" : (int) $value;
+ case is_numeric($value):
+ $locale = setlocale(LC_NUMERIC, 0);
if (false !== $locale) {
- setlocale(\LC_NUMERIC, 'C');
+ setlocale(LC_NUMERIC, 'C');
}
- if (\is_float($value)) {
+ if (is_float($value)) {
$repr = (string) $value;
if (is_infinite($value)) {
$repr = str_ireplace('INF', '.Inf', $repr);
@@ -224,10 +222,10 @@ public static function dump($value, $flags = 0)
$repr = '!!float '.$repr;
}
} else {
- $repr = \is_string($value) ? "'$value'" : (string) $value;
+ $repr = is_string($value) ? "'$value'" : (string) $value;
}
if (false !== $locale) {
- setlocale(\LC_NUMERIC, $locale);
+ setlocale(LC_NUMERIC, $locale);
}
return $repr;
@@ -285,7 +283,7 @@ private static function dumpArray($value, $flags)
{
// array
if (($value || Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) {
- $output = [];
+ $output = array();
foreach ($value as $val) {
$output[] = self::dump($val, $flags);
}
@@ -294,7 +292,7 @@ private static function dumpArray($value, $flags)
}
// hash
- $output = [];
+ $output = array();
foreach ($value as $key => $val) {
$output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags));
}
@@ -318,18 +316,15 @@ private static function dumpArray($value, $flags)
*
* @internal
*/
- public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i = 0, $evaluate = true, $references = [], $legacyOmittedKeySupport = false)
+ public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i = 0, $evaluate = true, $references = array(), $legacyOmittedKeySupport = false)
{
- if (\in_array($scalar[$i], ['"', "'"])) {
+ if (in_array($scalar[$i], array('"', "'"))) {
// quoted scalar
$output = self::parseQuotedScalar($scalar, $i);
if (null !== $delimiters) {
$tmp = ltrim(substr($scalar, $i), ' ');
- if ('' === $tmp) {
- throw new ParseException(sprintf('Unexpected end of line, expected one of "%s".', implode('', $delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
- }
- if (!\in_array($tmp[0], $delimiters)) {
+ if (!in_array($tmp[0], $delimiters)) {
throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
}
@@ -337,17 +332,17 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i
// "normal" string
if (!$delimiters) {
$output = substr($scalar, $i);
- $i += \strlen($output);
+ $i += strlen($output);
// remove comments
- if (Parser::preg_match('/[ \t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) {
+ if (Parser::preg_match('/[ \t]+#/', $output, $match, PREG_OFFSET_CAPTURE)) {
$output = substr($output, 0, $match[0][1]);
}
} elseif (Parser::preg_match('/^(.'.($legacyOmittedKeySupport ? '+' : '*').'?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) {
$output = $match[1];
- $i += \strlen($output);
+ $i += strlen($output);
} else {
- throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename);
+ throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename);
}
// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
@@ -356,7 +351,7 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i
}
if ($output && '%' === $output[0]) {
- @trigger_error(self::getDeprecationMessage(sprintf('Not quoting the scalar "%s" starting with the "%%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', $output)), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage(sprintf('Not quoting the scalar "%s" starting with the "%%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', $output)), E_USER_DEPRECATED);
}
if ($evaluate) {
@@ -380,10 +375,10 @@ public static function parseScalar($scalar, $flags = 0, $delimiters = null, &$i
private static function parseQuotedScalar($scalar, &$i)
{
if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
- throw new ParseException(sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
+ throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- $output = substr($match[0], 1, \strlen($match[0]) - 2);
+ $output = substr($match[0], 1, strlen($match[0]) - 2);
$unescaper = new Unescaper();
if ('"' == $scalar[$i]) {
@@ -392,7 +387,7 @@ private static function parseQuotedScalar($scalar, &$i)
$output = $unescaper->unescapeSingleQuotedString($output);
}
- $i += \strlen($match[0]);
+ $i += strlen($match[0]);
return $output;
}
@@ -409,10 +404,10 @@ private static function parseQuotedScalar($scalar, &$i)
*
* @throws ParseException When malformed inline YAML string is parsed
*/
- private static function parseSequence($sequence, $flags, &$i = 0, $references = [])
+ private static function parseSequence($sequence, $flags, &$i = 0, $references = array())
{
- $output = [];
- $len = \strlen($sequence);
+ $output = array();
+ $len = strlen($sequence);
++$i;
// [foo, bar, ...]
@@ -437,11 +432,11 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references =
$value = self::parseMapping($sequence, $flags, $i, $references);
break;
default:
- $isQuoted = \in_array($sequence[$i], ['"', "'"]);
- $value = self::parseScalar($sequence, $flags, [',', ']'], $i, null === $tag, $references);
+ $isQuoted = in_array($sequence[$i], array('"', "'"));
+ $value = self::parseScalar($sequence, $flags, array(',', ']'), $i, null === $tag, $references);
// the value can be an array if a reference has been resolved to an array var
- if (\is_string($value) && !$isQuoted && false !== strpos($value, ': ')) {
+ if (is_string($value) && !$isQuoted && false !== strpos($value, ': ')) {
// embedded mapping?
try {
$pos = 0;
@@ -463,7 +458,7 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references =
++$i;
}
- throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename);
+ throw new ParseException(sprintf('Malformed inline YAML string: %s.', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename);
}
/**
@@ -478,10 +473,10 @@ private static function parseSequence($sequence, $flags, &$i = 0, $references =
*
* @throws ParseException When malformed inline YAML string is parsed
*/
- private static function parseMapping($mapping, $flags, &$i = 0, $references = [])
+ private static function parseMapping($mapping, $flags, &$i = 0, $references = array())
{
- $output = [];
- $len = \strlen($mapping);
+ $output = array();
+ $len = strlen($mapping);
++$i;
$allowOverwrite = false;
@@ -501,37 +496,27 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = []
}
// key
- $isKeyQuoted = \in_array($mapping[$i], ['"', "'"], true);
- $key = self::parseScalar($mapping, $flags, [':', ' '], $i, false, [], true);
-
- if ('!php/const' === $key) {
- $key .= self::parseScalar($mapping, $flags, [':', ' '], $i, false, [], true);
- if ('!php/const:' === $key && ':' !== $mapping[$i]) {
- $key = '';
- --$i;
- } else {
- $key = self::evaluateScalar($key, $flags);
- }
- }
+ $isKeyQuoted = in_array($mapping[$i], array('"', "'"), true);
+ $key = self::parseScalar($mapping, $flags, array(':', ' '), $i, false, array(), true);
if (':' !== $key && false === $i = strpos($mapping, ':', $i)) {
break;
}
if (':' === $key) {
- @trigger_error(self::getDeprecationMessage('Omitting the key of a mapping is deprecated and will throw a ParseException in 4.0.'), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage('Omitting the key of a mapping is deprecated and will throw a ParseException in 4.0.'), E_USER_DEPRECATED);
}
if (!$isKeyQuoted) {
$evaluatedKey = self::evaluateScalar($key, $flags, $references);
- if ('' !== $key && $evaluatedKey !== $key && !\is_string($evaluatedKey) && !\is_int($evaluatedKey)) {
- @trigger_error(self::getDeprecationMessage('Implicit casting of incompatible mapping keys to strings is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead.'), \E_USER_DEPRECATED);
+ if ('' !== $key && $evaluatedKey !== $key && !is_string($evaluatedKey) && !is_int($evaluatedKey)) {
+ @trigger_error(self::getDeprecationMessage('Implicit casting of incompatible mapping keys to strings is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead.'), E_USER_DEPRECATED);
}
}
- if (':' !== $key && !$isKeyQuoted && (!isset($mapping[$i + 1]) || !\in_array($mapping[$i + 1], [' ', ',', '[', ']', '{', '}'], true))) {
- @trigger_error(self::getDeprecationMessage('Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since Symfony 3.2 and will throw a ParseException in 4.0.'), \E_USER_DEPRECATED);
+ if (':' !== $key && !$isKeyQuoted && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) {
+ @trigger_error(self::getDeprecationMessage('Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since version 3.2 and will throw a ParseException in 4.0.'), E_USER_DEPRECATED);
}
if ('<<' === $key) {
@@ -565,7 +550,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = []
$output[$key] = $value;
}
} elseif (isset($output[$key])) {
- @trigger_error(self::getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), E_USER_DEPRECATED);
}
break;
case '{':
@@ -584,11 +569,11 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = []
$output[$key] = $value;
}
} elseif (isset($output[$key])) {
- @trigger_error(self::getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), E_USER_DEPRECATED);
}
break;
default:
- $value = self::parseScalar($mapping, $flags, [',', '}'], $i, null === $tag, $references);
+ $value = self::parseScalar($mapping, $flags, array(',', '}'), $i, null === $tag, $references);
// Spec: Keys MUST be unique; first one wins.
// Parser cannot abort this mapping earlier, since lines
// are processed sequentially.
@@ -602,7 +587,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = []
$output[$key] = $value;
}
} elseif (isset($output[$key])) {
- @trigger_error(self::getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), E_USER_DEPRECATED);
}
--$i;
}
@@ -612,7 +597,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = []
}
}
- throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $mapping), self::$parsedLineNumber + 1, null, self::$parsedFilename);
+ throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping), self::$parsedLineNumber + 1, null, self::$parsedFilename);
}
/**
@@ -626,7 +611,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = []
*
* @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved
*/
- private static function evaluateScalar($scalar, $flags, $references = [])
+ private static function evaluateScalar($scalar, $flags, $references = array())
{
$scalar = trim($scalar);
$scalarLower = strtolower($scalar);
@@ -643,7 +628,7 @@ private static function evaluateScalar($scalar, $flags, $references = [])
throw new ParseException('A reference must contain at least one character.', self::$parsedLineNumber + 1, $value, self::$parsedFilename);
}
- if (!\array_key_exists($value, $references)) {
+ if (!array_key_exists($value, $references)) {
throw new ParseException(sprintf('Reference "%s" does not exist.', $value), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
}
@@ -654,7 +639,7 @@ private static function evaluateScalar($scalar, $flags, $references = [])
case 'null' === $scalarLower:
case '' === $scalar:
case '~' === $scalar:
- return null;
+ return;
case 'true' === $scalarLower:
return true;
case 'false' === $scalarLower:
@@ -662,18 +647,18 @@ private static function evaluateScalar($scalar, $flags, $references = [])
case '!' === $scalar[0]:
switch (true) {
case 0 === strpos($scalar, '!str'):
- @trigger_error(self::getDeprecationMessage('Support for the !str tag is deprecated since Symfony 3.4. Use the !!str tag instead.'), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage('Support for the !str tag is deprecated since version 3.4. Use the !!str tag instead.'), E_USER_DEPRECATED);
return (string) substr($scalar, 5);
case 0 === strpos($scalar, '!!str '):
return (string) substr($scalar, 6);
case 0 === strpos($scalar, '! '):
- @trigger_error(self::getDeprecationMessage('Using the non-specific tag "!" is deprecated since Symfony 3.4 as its behavior will change in 4.0. It will force non-evaluating your values in 4.0. Use plain integers or !!float instead.'), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage('Using the non-specific tag "!" is deprecated since version 3.4 as its behavior will change in 4.0. It will force non-evaluating your values in 4.0. Use plain integers or !!float instead.'), E_USER_DEPRECATED);
return (int) self::parseScalar(substr($scalar, 2), $flags);
case 0 === strpos($scalar, '!php/object:'):
if (self::$objectSupport) {
- @trigger_error(self::getDeprecationMessage('The !php/object: tag to indicate dumped PHP objects is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/object (without the colon) tag instead.'), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage('The !php/object: tag to indicate dumped PHP objects is deprecated since version 3.4 and will be removed in 4.0. Use the !php/object (without the colon) tag instead.'), E_USER_DEPRECATED);
return unserialize(substr($scalar, 12));
}
@@ -682,10 +667,10 @@ private static function evaluateScalar($scalar, $flags, $references = [])
throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return null;
+ return;
case 0 === strpos($scalar, '!!php/object:'):
if (self::$objectSupport) {
- @trigger_error(self::getDeprecationMessage('The !!php/object: tag to indicate dumped PHP objects is deprecated since Symfony 3.1 and will be removed in 4.0. Use the !php/object (without the colon) tag instead.'), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage('The !!php/object: tag to indicate dumped PHP objects is deprecated since version 3.1 and will be removed in 4.0. Use the !php/object (without the colon) tag instead.'), E_USER_DEPRECATED);
return unserialize(substr($scalar, 13));
}
@@ -694,13 +679,9 @@ private static function evaluateScalar($scalar, $flags, $references = [])
throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return null;
+ return;
case 0 === strpos($scalar, '!php/object'):
if (self::$objectSupport) {
- if (!isset($scalar[12])) {
- return false;
- }
-
return unserialize(self::parseScalar(substr($scalar, 12)));
}
@@ -708,72 +689,61 @@ private static function evaluateScalar($scalar, $flags, $references = [])
throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return null;
+ return;
case 0 === strpos($scalar, '!php/const:'):
if (self::$constantSupport) {
- @trigger_error(self::getDeprecationMessage('The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead.'), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage('The !php/const: tag to indicate dumped PHP constants is deprecated since version 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead.'), E_USER_DEPRECATED);
- if (\defined($const = substr($scalar, 11))) {
- return \constant($const);
+ if (defined($const = substr($scalar, 11))) {
+ return constant($const);
}
throw new ParseException(sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
if (self::$exceptionOnInvalidType) {
- throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
+ throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return null;
+ return;
case 0 === strpos($scalar, '!php/const'):
if (self::$constantSupport) {
- if (!isset($scalar[11])) {
- return '';
- }
-
- $i = 0;
- if (\defined($const = self::parseScalar(substr($scalar, 11), 0, null, $i, false))) {
- return \constant($const);
+ if (defined($const = self::parseScalar(substr($scalar, 11)))) {
+ return constant($const);
}
throw new ParseException(sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
if (self::$exceptionOnInvalidType) {
- throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
+ throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return null;
+ return;
case 0 === strpos($scalar, '!!float '):
return (float) substr($scalar, 8);
case 0 === strpos($scalar, '!!binary '):
return self::evaluateBinaryScalar(substr($scalar, 9));
default:
- @trigger_error(self::getDeprecationMessage(sprintf('Using the unquoted scalar value "%s" is deprecated since Symfony 3.3 and will be considered as a tagged value in 4.0. You must quote it.', $scalar)), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage(sprintf('Using the unquoted scalar value "%s" is deprecated since version 3.3 and will be considered as a tagged value in 4.0. You must quote it.', $scalar)), E_USER_DEPRECATED);
}
// Optimize for returning strings.
// no break
case '+' === $scalar[0] || '-' === $scalar[0] || '.' === $scalar[0] || is_numeric($scalar[0]):
- if (Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar)) {
- $scalar = str_replace('_', '', (string) $scalar);
- }
-
switch (true) {
+ case Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar):
+ $scalar = str_replace('_', '', (string) $scalar);
+ // omitting the break / return as integers are handled in the next case
+ // no break
case ctype_digit($scalar):
- if (preg_match('/^0[0-7]+$/', $scalar)) {
- return octdec($scalar);
- }
-
+ $raw = $scalar;
$cast = (int) $scalar;
- return ($scalar === (string) $cast) ? $cast : $scalar;
+ return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)):
- if (preg_match('/^-0[0-7]+$/', $scalar)) {
- return -octdec(substr($scalar, 1));
- }
-
+ $raw = $scalar;
$cast = (int) $scalar;
- return ($scalar === (string) $cast) ? $cast : $scalar;
+ return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw === (string) $cast) ? $cast : $raw);
case is_numeric($scalar):
case Parser::preg_match(self::getHexRegex(), $scalar):
$scalar = str_replace('_', '', $scalar);
@@ -787,10 +757,10 @@ private static function evaluateScalar($scalar, $flags, $references = [])
case Parser::preg_match('/^(-|\+)?[0-9][0-9,]*(\.[0-9_]+)?$/', $scalar):
case Parser::preg_match('/^(-|\+)?[0-9][0-9_]*(\.[0-9_]+)?$/', $scalar):
if (false !== strpos($scalar, ',')) {
- @trigger_error(self::getDeprecationMessage('Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0.'), \E_USER_DEPRECATED);
+ @trigger_error(self::getDeprecationMessage('Using the comma as a group separator for floats is deprecated since version 3.2 and will be removed in 4.0.'), E_USER_DEPRECATED);
}
- return (float) str_replace([',', '_'], '', $scalar);
+ return (float) str_replace(array(',', '_'), '', $scalar);
case Parser::preg_match(self::getTimestampRegex(), $scalar):
if (Yaml::PARSE_DATETIME & $flags) {
// When no timezone is provided in the parsed date, YAML spec says we must assume UTC.
@@ -814,12 +784,12 @@ private static function evaluateScalar($scalar, $flags, $references = [])
* @param int &$i
* @param int $flags
*
- * @return string|null
+ * @return null|string
*/
private static function parseTag($value, &$i, $flags)
{
if ('!' !== $value[$i]) {
- return null;
+ return;
}
$tagLength = strcspn($value, " \t\n", $i + 1);
@@ -829,9 +799,9 @@ private static function parseTag($value, &$i, $flags)
$nextOffset += strspn($value, ' ', $nextOffset);
// Is followed by a scalar
- if ((!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], true)) && 'tagged' !== $tag) {
+ if ((!isset($value[$nextOffset]) || !in_array($value[$nextOffset], array('[', '{'), true)) && 'tagged' !== $tag) {
// Manage non-whitelisted scalars in {@link self::evaluateScalar()}
- return null;
+ return;
}
// Built-in tags
@@ -859,8 +829,8 @@ public static function evaluateBinaryScalar($scalar)
{
$parsedBinaryData = self::parseScalar(preg_replace('/\s/', '', $scalar));
- if (0 !== (\strlen($parsedBinaryData) % 4)) {
- throw new ParseException(sprintf('The normalized base64 encoded data (data without whitespace characters) length must be a multiple of four (%d bytes given).', \strlen($parsedBinaryData)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
+ if (0 !== (strlen($parsedBinaryData) % 4)) {
+ throw new ParseException(sprintf('The normalized base64 encoded data (data without whitespace characters) length must be a multiple of four (%d bytes given).', strlen($parsedBinaryData)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
if (!Parser::preg_match('#^[A-Z0-9+/]+={0,2}$#i', $parsedBinaryData)) {
diff --git a/inc.lib/vendor/symfony/yaml/LICENSE b/inc.lib/vendor/symfony/yaml/LICENSE
index 9e936ec0..17d16a13 100644
--- a/inc.lib/vendor/symfony/yaml/LICENSE
+++ b/inc.lib/vendor/symfony/yaml/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2020 Fabien Potencier
+Copyright (c) 2004-2017 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
diff --git a/inc.lib/vendor/symfony/yaml/Parser.php b/inc.lib/vendor/symfony/yaml/Parser.php
index ddd85676..1d172341 100644
--- a/inc.lib/vendor/symfony/yaml/Parser.php
+++ b/inc.lib/vendor/symfony/yaml/Parser.php
@@ -29,24 +29,23 @@ class Parser
private $filename;
private $offset = 0;
private $totalNumberOfLines;
- private $lines = [];
+ private $lines = array();
private $currentLineNb = -1;
private $currentLine = '';
- private $refs = [];
- private $skippedLineNumbers = [];
- private $locallySkippedLineNumbers = [];
- private $refsBeingParsed = [];
+ private $refs = array();
+ private $skippedLineNumbers = array();
+ private $locallySkippedLineNumbers = array();
public function __construct()
{
- if (\func_num_args() > 0) {
- @trigger_error(sprintf('The constructor arguments $offset, $totalNumberOfLines, $skippedLineNumbers of %s are deprecated and will be removed in 4.0', self::class), \E_USER_DEPRECATED);
+ if (func_num_args() > 0) {
+ @trigger_error(sprintf('The constructor arguments $offset, $totalNumberOfLines, $skippedLineNumbers of %s are deprecated and will be removed in 4.0', self::class), E_USER_DEPRECATED);
$this->offset = func_get_arg(0);
- if (\func_num_args() > 1) {
+ if (func_num_args() > 1) {
$this->totalNumberOfLines = func_get_arg(1);
}
- if (\func_num_args() > 2) {
+ if (func_num_args() > 2) {
$this->skippedLineNumbers = func_get_arg(2);
}
}
@@ -93,8 +92,8 @@ public function parseFile($filename, $flags = 0)
*/
public function parse($value, $flags = 0)
{
- if (\is_bool($flags)) {
- @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED);
+ if (is_bool($flags)) {
+ @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
if ($flags) {
$flags = Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE;
@@ -103,16 +102,16 @@ public function parse($value, $flags = 0)
}
}
- if (\func_num_args() >= 3) {
- @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT flag instead.', \E_USER_DEPRECATED);
+ if (func_num_args() >= 3) {
+ @trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT flag instead.', E_USER_DEPRECATED);
if (func_get_arg(2)) {
$flags |= Yaml::PARSE_OBJECT;
}
}
- if (\func_num_args() >= 4) {
- @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', \E_USER_DEPRECATED);
+ if (func_num_args() >= 4) {
+ @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED);
if (func_get_arg(3)) {
$flags |= Yaml::PARSE_OBJECT_FOR_MAP;
@@ -120,14 +119,14 @@ public function parse($value, $flags = 0)
}
if (Yaml::PARSE_KEYS_AS_STRINGS & $flags) {
- @trigger_error('Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.', \E_USER_DEPRECATED);
+ @trigger_error('Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since version 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.', E_USER_DEPRECATED);
}
if (false === preg_match('//u', $value)) {
throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename);
}
- $this->refs = [];
+ $this->refs = array();
$mbEncoding = null;
$e = null;
@@ -148,12 +147,11 @@ public function parse($value, $flags = 0)
mb_internal_encoding($mbEncoding);
}
- $this->lines = [];
+ $this->lines = array();
$this->currentLine = '';
- $this->refs = [];
- $this->skippedLineNumbers = [];
- $this->locallySkippedLineNumbers = [];
- $this->totalNumberOfLines = null;
+ $this->refs = array();
+ $this->skippedLineNumbers = array();
+ $this->locallySkippedLineNumbers = array();
if (null !== $e) {
throw $e;
@@ -168,17 +166,17 @@ private function doParse($value, $flags)
$this->currentLine = '';
$value = $this->cleanup($value);
$this->lines = explode("\n", $value);
- $this->locallySkippedLineNumbers = [];
+ $this->locallySkippedLineNumbers = array();
if (null === $this->totalNumberOfLines) {
- $this->totalNumberOfLines = \count($this->lines);
+ $this->totalNumberOfLines = count($this->lines);
}
if (!$this->moveToNextLine()) {
return null;
}
- $data = [];
+ $data = array();
$context = null;
$allowOverwrite = false;
@@ -208,18 +206,17 @@ private function doParse($value, $flags)
$isRef = $mergeNode = false;
if (self::preg_match('#^\-((?P\s+)(?P.+))?$#u', rtrim($this->currentLine), $values)) {
if ($context && 'mapping' == $context) {
- throw new ParseException('You cannot define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
+ throw new ParseException('You cannot define a sequence item when in a mapping', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
}
$context = 'sequence';
if (isset($values['value']) && self::preg_match('#^&(?P[[^ ]+) *(?P.*)#u', $values['value'], $matches)) {
$isRef = $matches['ref'];
- $this->refsBeingParsed[] = $isRef;
$values['value'] = $matches['value'];
}
if (isset($values['value'][1]) && '?' === $values['value'][0] && ' ' === $values['value'][1]) {
- @trigger_error($this->getDeprecationMessage('Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.'), \E_USER_DEPRECATED);
+ @trigger_error($this->getDeprecationMessage('Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.'), E_USER_DEPRECATED);
}
// array
@@ -231,17 +228,13 @@ private function doParse($value, $flags)
$this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $flags)
);
} else {
- if (
- isset($values['leadspaces'])
- && (
- '!' === $values['value'][0]
- || self::preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P.+?))?\s*$#u', $this->trimTag($values['value']), $matches)
- )
+ if (isset($values['leadspaces'])
+ && self::preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P.+?))?\s*$#u', $this->trimTag($values['value']), $matches)
) {
// this is a compact notation element, add to next block and parse
$block = $values['value'];
if ($this->isNextLineIndented()) {
- $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1);
+ $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + strlen($values['leadspaces']) + 1);
}
$data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $flags);
@@ -251,14 +244,13 @@ private function doParse($value, $flags)
}
if ($isRef) {
$this->refs[$isRef] = end($data);
- array_pop($this->refsBeingParsed);
}
} elseif (
self::preg_match('#^(?P(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|(?:!?!php/const:)?[^ \'"\[\{!].*?)) *\:(\s++(?P.+))?$#u', rtrim($this->currentLine), $values)
- && (false === strpos($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"]))
+ && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))
) {
if ($context && 'sequence' == $context) {
- throw new ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename);
+ throw new ParseException('You cannot define a mapping item when in a sequence', $this->currentLineNb + 1, $this->currentLine, $this->filename);
}
$context = 'mapping';
@@ -279,13 +271,13 @@ private function doParse($value, $flags)
throw $e;
}
- if (!\is_string($key) && !\is_int($key)) {
+ if (!is_string($key) && !is_int($key)) {
$keyType = is_numeric($key) ? 'numeric key' : 'non-string key';
- @trigger_error($this->getDeprecationMessage(sprintf('Implicit casting of %s to string is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead.', $keyType)), \E_USER_DEPRECATED);
+ @trigger_error($this->getDeprecationMessage(sprintf('Implicit casting of %s to string is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead.', $keyType)), E_USER_DEPRECATED);
}
// Convert float keys to strings, to avoid being converted to integers by PHP
- if (\is_float($key)) {
+ if (is_float($key)) {
$key = (string) $key;
}
@@ -294,11 +286,7 @@ private function doParse($value, $flags)
$allowOverwrite = true;
if (isset($values['value'][0]) && '*' === $values['value'][0]) {
$refName = substr(rtrim($values['value']), 1);
- if (!\array_key_exists($refName, $this->refs)) {
- if (false !== $pos = array_search($refName, $this->refsBeingParsed, true)) {
- throw new ParseException(sprintf('Circular reference [%s, %s] detected for reference "%s".', implode(', ', \array_slice($this->refsBeingParsed, $pos)), $refName, $refName), $this->currentLineNb + 1, $this->currentLine, $this->filename);
- }
-
+ if (!array_key_exists($refName, $this->refs)) {
throw new ParseException(sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
}
@@ -308,7 +296,7 @@ private function doParse($value, $flags)
$refValue = (array) $refValue;
}
- if (!\is_array($refValue)) {
+ if (!is_array($refValue)) {
throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
}
@@ -325,7 +313,7 @@ private function doParse($value, $flags)
$parsed = (array) $parsed;
}
- if (!\is_array($parsed)) {
+ if (!is_array($parsed)) {
throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
}
@@ -338,7 +326,7 @@ private function doParse($value, $flags)
$parsedItem = (array) $parsedItem;
}
- if (!\is_array($parsedItem)) {
+ if (!is_array($parsedItem)) {
throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem, $this->filename);
}
@@ -352,7 +340,6 @@ private function doParse($value, $flags)
}
} elseif ('<<' !== $key && isset($values['value']) && self::preg_match('#^&(?P][[^ ]++) *+(?P.*)#u', $values['value'], $matches)) {
$isRef = $matches['ref'];
- $this->refsBeingParsed[] = $isRef;
$values['value'] = $matches['value'];
}
@@ -372,9 +359,11 @@ private function doParse($value, $flags)
$data[$key] = null;
}
} else {
- @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), \E_USER_DEPRECATED);
+ @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), E_USER_DEPRECATED);
}
} else {
+ // remember the parsed line number here in case we need it to provide some contexts in error messages below
+ $realCurrentLineNbKey = $this->getRealCurrentLineNb();
$value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $flags);
if ('<<' === $key) {
$this->refs[$refMatches['ref']] = $value;
@@ -393,7 +382,7 @@ private function doParse($value, $flags)
$data[$key] = $value;
}
} else {
- @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), \E_USER_DEPRECATED);
+ @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), E_USER_DEPRECATED);
}
}
} else {
@@ -403,12 +392,11 @@ private function doParse($value, $flags)
if ($allowOverwrite || !isset($data[$key])) {
$data[$key] = $value;
} else {
- @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since Symfony 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), \E_USER_DEPRECATED);
+ @trigger_error($this->getDeprecationMessage(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key)), E_USER_DEPRECATED);
}
}
if ($isRef) {
$this->refs[$isRef] = $data[$key];
- array_pop($this->refsBeingParsed);
}
} else {
// multiple documents are not supported
@@ -416,12 +404,12 @@ private function doParse($value, $flags)
throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine, $this->filename);
}
- if ($deprecatedUsage = (isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $this->currentLine[1])) {
- @trigger_error($this->getDeprecationMessage('Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.'), \E_USER_DEPRECATED);
+ if (isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $this->currentLine[1]) {
+ @trigger_error($this->getDeprecationMessage('Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.'), E_USER_DEPRECATED);
}
// 1-liner optionally followed by newline(s)
- if (\is_string($value) && $this->lines[0] === trim($value)) {
+ if (is_string($value) && $this->lines[0] === trim($value)) {
try {
$value = Inline::parse($this->lines[0], $flags, $this->refs);
} catch (ParseException $e) {
@@ -436,46 +424,54 @@ private function doParse($value, $flags)
// try to parse the value as a multi-line string as a last resort
if (0 === $this->currentLineNb) {
+ $parseError = false;
$previousLineWasNewline = false;
$previousLineWasTerminatedWithBackslash = false;
$value = '';
foreach ($this->lines as $line) {
- if ('' !== ltrim($line) && '#' === ltrim($line)[0]) {
- continue;
- }
- // If the indentation is not consistent at offset 0, it is to be considered as a ParseError
- if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
- throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
- }
- if ('' === trim($line)) {
- $value .= "\n";
- } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) {
- $value .= ' ';
- }
+ try {
+ if (isset($line[0]) && ('"' === $line[0] || "'" === $line[0])) {
+ $parsedLine = $line;
+ } else {
+ $parsedLine = Inline::parse($line, $flags, $this->refs);
+ }
- if ('' !== trim($line) && '\\' === substr($line, -1)) {
- $value .= ltrim(substr($line, 0, -1));
- } elseif ('' !== trim($line)) {
- $value .= trim($line);
- }
+ if (!is_string($parsedLine)) {
+ $parseError = true;
+ break;
+ }
- if ('' === trim($line)) {
- $previousLineWasNewline = true;
- $previousLineWasTerminatedWithBackslash = false;
- } elseif ('\\' === substr($line, -1)) {
- $previousLineWasNewline = false;
- $previousLineWasTerminatedWithBackslash = true;
- } else {
- $previousLineWasNewline = false;
- $previousLineWasTerminatedWithBackslash = false;
+ if ('' === trim($parsedLine)) {
+ $value .= "\n";
+ } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) {
+ $value .= ' ';
+ }
+
+ if ('' !== trim($parsedLine) && '\\' === substr($parsedLine, -1)) {
+ $value .= ltrim(substr($parsedLine, 0, -1));
+ } elseif ('' !== trim($parsedLine)) {
+ $value .= trim($parsedLine);
+ }
+
+ if ('' === trim($parsedLine)) {
+ $previousLineWasNewline = true;
+ $previousLineWasTerminatedWithBackslash = false;
+ } elseif ('\\' === substr($parsedLine, -1)) {
+ $previousLineWasNewline = false;
+ $previousLineWasTerminatedWithBackslash = true;
+ } else {
+ $previousLineWasNewline = false;
+ $previousLineWasTerminatedWithBackslash = false;
+ }
+ } catch (ParseException $e) {
+ $parseError = true;
+ break;
}
}
- try {
+ if (!$parseError) {
return Inline::parse(trim($value));
- } catch (ParseException $e) {
- // fall-through to the ParseException thrown below
}
}
@@ -487,7 +483,7 @@ private function doParse($value, $flags)
$data = new TaggedValue($tag, $data);
}
- if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && !\is_object($data) && 'mapping' === $context) {
+ if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && !is_object($data) && 'mapping' === $context) {
$object = new \stdClass();
foreach ($data as $key => $value) {
@@ -517,7 +513,6 @@ private function parseBlock($offset, $yaml, $flags)
$parser->totalNumberOfLines = $this->totalNumberOfLines;
$parser->skippedLineNumbers = $skippedLineNumbers;
$parser->refs = &$this->refs;
- $parser->refsBeingParsed = $this->refsBeingParsed;
return $parser->doParse($yaml, $flags);
}
@@ -551,7 +546,7 @@ public function getRealCurrentLineNb()
*/
private function getCurrentLineIndentation()
{
- return \strlen($this->currentLine) - \strlen(ltrim($this->currentLine, ' '));
+ return strlen($this->currentLine) - strlen(ltrim($this->currentLine, ' '));
}
/**
@@ -567,33 +562,18 @@ private function getCurrentLineIndentation()
private function getNextEmbedBlock($indentation = null, $inSequence = false)
{
$oldLineIndentation = $this->getCurrentLineIndentation();
+ $blockScalarIndentations = array();
+
+ if ($this->isBlockScalarHeader()) {
+ $blockScalarIndentations[] = $oldLineIndentation;
+ }
if (!$this->moveToNextLine()) {
- return '';
+ return;
}
if (null === $indentation) {
- $newIndent = null;
- $movements = 0;
-
- do {
- $EOF = false;
-
- // empty and comment-like lines do not influence the indentation depth
- if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
- $EOF = !$this->moveToNextLine();
-
- if (!$EOF) {
- ++$movements;
- }
- } else {
- $newIndent = $this->getCurrentLineIndentation();
- }
- } while (!$EOF && null === $newIndent);
-
- for ($i = 0; $i < $movements; ++$i) {
- $this->moveToPreviousLine();
- }
+ $newIndent = $this->getCurrentLineIndentation();
$unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem();
@@ -604,15 +584,13 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
$newIndent = $indentation;
}
- $data = [];
+ $data = array();
if ($this->getCurrentLineIndentation() >= $newIndent) {
$data[] = substr($this->currentLine, $newIndent);
- } elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) {
- $data[] = $this->currentLine;
} else {
$this->moveToPreviousLine();
- return '';
+ return;
}
if ($inSequence && $oldLineIndentation === $newIndent && isset($data[0][0]) && '-' === $data[0][0]) {
@@ -620,19 +598,34 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
// and therefore no nested list or mapping
$this->moveToPreviousLine();
- return '';
+ return;
}
$isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
- $isItComment = $this->isCurrentLineComment();
+
+ if (empty($blockScalarIndentations) && $this->isBlockScalarHeader()) {
+ $blockScalarIndentations[] = $this->getCurrentLineIndentation();
+ }
+
+ $previousLineIndentation = $this->getCurrentLineIndentation();
while ($this->moveToNextLine()) {
- if ($isItComment && !$isItUnindentedCollection) {
- $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
- $isItComment = $this->isCurrentLineComment();
+ $indent = $this->getCurrentLineIndentation();
+
+ // terminate all block scalars that are more indented than the current line
+ if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && '' !== trim($this->currentLine)) {
+ foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
+ if ($blockScalarIndentation >= $indent) {
+ unset($blockScalarIndentations[$key]);
+ }
+ }
}
- $indent = $this->getCurrentLineIndentation();
+ if (empty($blockScalarIndentations) && !$this->isCurrentLineComment() && $this->isBlockScalarHeader()) {
+ $blockScalarIndentations[] = $indent;
+ }
+
+ $previousLineIndentation = $indent;
if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) {
$this->moveToPreviousLine();
@@ -644,10 +637,21 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
continue;
}
+ // we ignore "comment" lines only when we are not inside a scalar block
+ if (empty($blockScalarIndentations) && $this->isCurrentLineComment()) {
+ // remember ignored comment lines (they are used later in nested
+ // parser calls to determine real line numbers)
+ //
+ // CAUTION: beware to not populate the global property here as it
+ // will otherwise influence the getRealCurrentLineNb() call here
+ // for consecutive comment lines and subsequent embedded blocks
+ $this->locallySkippedLineNumbers[] = $this->getRealCurrentLineNb();
+
+ continue;
+ }
+
if ($indent >= $newIndent) {
$data[] = substr($this->currentLine, $newIndent);
- } elseif ($this->isCurrentLineComment()) {
- $data[] = $this->currentLine;
} elseif (0 == $indent) {
$this->moveToPreviousLine();
@@ -667,7 +671,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
*/
private function moveToNextLine()
{
- if ($this->currentLineNb >= \count($this->lines) - 1) {
+ if ($this->currentLineNb >= count($this->lines) - 1) {
return false;
}
@@ -712,11 +716,7 @@ private function parseValue($value, $flags, $context)
$value = substr($value, 1);
}
- if (!\array_key_exists($value, $this->refs)) {
- if (false !== $pos = array_search($value, $this->refsBeingParsed, true)) {
- throw new ParseException(sprintf('Circular reference [%s, %s] detected for reference "%s".', implode(', ', \array_slice($this->refsBeingParsed, $pos)), $value, $value), $this->currentLineNb + 1, $this->currentLine, $this->filename);
- }
-
+ if (!array_key_exists($value, $this->refs)) {
throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine, $this->filename);
}
@@ -726,7 +726,7 @@ private function parseValue($value, $flags, $context)
if (self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) {
$modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
- $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs((int) $modifiers));
+ $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers));
if ('' !== $matches['tag']) {
if ('!!binary' === $matches['tag']) {
@@ -734,7 +734,7 @@ private function parseValue($value, $flags, $context)
} elseif ('tagged' === $matches['tag']) {
return new TaggedValue(substr($matches['tag'], 1), $data);
} elseif ('!' !== $matches['tag']) {
- @trigger_error($this->getDeprecationMessage(sprintf('Using the custom tag "%s" for the value "%s" is deprecated since Symfony 3.3. It will be replaced by an instance of %s in 4.0.', $matches['tag'], $data, TaggedValue::class)), \E_USER_DEPRECATED);
+ @trigger_error($this->getDeprecationMessage(sprintf('Using the custom tag "%s" for the value "%s" is deprecated since version 3.3. It will be replaced by an instance of %s in 4.0.', $matches['tag'], $data, TaggedValue::class)), E_USER_DEPRECATED);
}
}
@@ -749,8 +749,6 @@ private function parseValue($value, $flags, $context)
return Inline::parse($value, $flags, $this->refs);
}
- $lines = [];
-
while ($this->moveToNextLine()) {
// unquoted strings end before the first unindented line
if (null === $quotation && 0 === $this->getCurrentLineIndentation()) {
@@ -759,33 +757,17 @@ private function parseValue($value, $flags, $context)
break;
}
- $lines[] = trim($this->currentLine);
+ $value .= ' '.trim($this->currentLine);
// quoted string values end with a line that is terminated with the quotation character
- $escapedLine = str_replace(['\\\\', '\\"'], '', $this->currentLine);
- if ('' !== $escapedLine && substr($escapedLine, -1) === $quotation) {
+ if ('' !== $this->currentLine && substr($this->currentLine, -1) === $quotation) {
break;
}
}
- for ($i = 0, $linesCount = \count($lines), $previousLineBlank = false; $i < $linesCount; ++$i) {
- if ('' === $lines[$i]) {
- $value .= "\n";
- $previousLineBlank = true;
- } elseif ($previousLineBlank) {
- $value .= $lines[$i];
- $previousLineBlank = false;
- } else {
- $value .= ' '.$lines[$i];
- $previousLineBlank = false;
- }
- }
-
- Inline::$parsedLineNumber = $this->getRealCurrentLineNb();
-
$parsedValue = Inline::parse($value, $flags, $this->refs);
- if ('mapping' === $context && \is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && false !== strpos($parsedValue, ': ')) {
+ if ('mapping' === $context && is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && false !== strpos($parsedValue, ': ')) {
throw new ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $this->filename);
}
@@ -815,7 +797,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0)
}
$isCurrentLineBlank = $this->isCurrentLineBlank();
- $blockLines = [];
+ $blockLines = array();
// leading blank lines are consumed before determining indentation
while ($notEOF && $isCurrentLineBlank) {
@@ -829,7 +811,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0)
// determine indentation if not specified
if (0 === $indentation) {
if (self::preg_match('/^ +/', $this->currentLine, $matches)) {
- $indentation = \strlen($matches[0]);
+ $indentation = strlen($matches[0]);
}
}
@@ -842,7 +824,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0)
self::preg_match($pattern, $this->currentLine, $matches)
)
) {
- if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) {
+ if ($isCurrentLineBlank && strlen($this->currentLine) > $indentation) {
$blockLines[] = substr($this->currentLine, $indentation);
} elseif ($isCurrentLineBlank) {
$blockLines[] = '';
@@ -872,7 +854,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0)
$previousLineIndented = false;
$previousLineBlank = false;
- for ($i = 0, $blockLinesCount = \count($blockLines); $i < $blockLinesCount; ++$i) {
+ for ($i = 0, $blockLinesCount = count($blockLines); $i < $blockLinesCount; ++$i) {
if ('' === $blockLines[$i]) {
$text .= "\n";
$previousLineIndented = false;
@@ -917,15 +899,11 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0)
private function isNextLineIndented()
{
$currentIndentation = $this->getCurrentLineIndentation();
- $movements = 0;
+ $EOF = !$this->moveToNextLine();
- do {
+ while (!$EOF && $this->isCurrentLineEmpty()) {
$EOF = !$this->moveToNextLine();
-
- if (!$EOF) {
- ++$movements;
- }
- } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()));
+ }
if ($EOF) {
return false;
@@ -933,9 +911,7 @@ private function isNextLineIndented()
$ret = $this->getCurrentLineIndentation() > $currentIndentation;
- for ($i = 0; $i < $movements; ++$i) {
- $this->moveToPreviousLine();
- }
+ $this->moveToPreviousLine();
return $ret;
}
@@ -987,7 +963,7 @@ private function isCurrentLineLastLineInDocument()
*/
private function cleanup($value)
{
- $value = str_replace(["\r\n", "\r"], "\n", $value);
+ $value = str_replace(array("\r\n", "\r"), "\n", $value);
// strip YAML header
$count = 0;
@@ -1024,25 +1000,19 @@ private function cleanup($value)
private function isNextLineUnIndentedCollection()
{
$currentIndentation = $this->getCurrentLineIndentation();
- $movements = 0;
-
- do {
- $EOF = !$this->moveToNextLine();
+ $notEOF = $this->moveToNextLine();
- if (!$EOF) {
- ++$movements;
- }
- } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()));
+ while ($notEOF && $this->isCurrentLineEmpty()) {
+ $notEOF = $this->moveToNextLine();
+ }
- if ($EOF) {
+ if (false === $notEOF) {
return false;
}
$ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem();
- for ($i = 0; $i < $movements; ++$i) {
- $this->moveToPreviousLine();
- }
+ $this->moveToPreviousLine();
return $ret;
}
@@ -1057,6 +1027,16 @@ private function isStringUnIndentedCollectionItem()
return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- ');
}
+ /**
+ * Tests whether or not the current line is the header of a block scalar.
+ *
+ * @return bool
+ */
+ private function isBlockScalarHeader()
+ {
+ return (bool) self::preg_match('~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~', $this->currentLine);
+ }
+
/**
* A local wrapper for `preg_match` which will throw a ParseException if there
* is an internal error in the PCRE engine.
@@ -1074,19 +1054,19 @@ public static function preg_match($pattern, $subject, &$matches = null, $flags =
{
if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) {
switch (preg_last_error()) {
- case \PREG_INTERNAL_ERROR:
+ case PREG_INTERNAL_ERROR:
$error = 'Internal PCRE error.';
break;
- case \PREG_BACKTRACK_LIMIT_ERROR:
+ case PREG_BACKTRACK_LIMIT_ERROR:
$error = 'pcre.backtrack_limit reached.';
break;
- case \PREG_RECURSION_LIMIT_ERROR:
+ case PREG_RECURSION_LIMIT_ERROR:
$error = 'pcre.recursion_limit reached.';
break;
- case \PREG_BAD_UTF8_ERROR:
+ case PREG_BAD_UTF8_ERROR:
$error = 'Malformed UTF-8 data.';
break;
- case \PREG_BAD_UTF8_OFFSET_ERROR:
+ case PREG_BAD_UTF8_OFFSET_ERROR:
$error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point.';
break;
default:
@@ -1114,17 +1094,14 @@ private function trimTag($value)
return $value;
}
- /**
- * @return string|null
- */
private function getLineTag($value, $flags, $nextLineCheck = true)
{
if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^'.self::TAG_PATTERN.' *( +#.*)?$/', $value, $matches)) {
- return null;
+ return;
}
if ($nextLineCheck && !$this->isNextLineIndented()) {
- return null;
+ return;
}
$tag = substr($matches['tag'], 1);
diff --git a/inc.lib/vendor/symfony/yaml/README.md b/inc.lib/vendor/symfony/yaml/README.md
index b914e783..0d324881 100644
--- a/inc.lib/vendor/symfony/yaml/README.md
+++ b/inc.lib/vendor/symfony/yaml/README.md
@@ -6,7 +6,7 @@ The Yaml component loads and dumps YAML files.
Resources
---------
- * [Documentation](https://symfony.com/doc/current/components/yaml.html)
+ * [Documentation](https://symfony.com/doc/current/components/yaml/index.html)
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls)
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Command/LintCommandTest.php b/inc.lib/vendor/symfony/yaml/Tests/Command/LintCommandTest.php
index 98c63b62..5d0f44d5 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Command/LintCommandTest.php
+++ b/inc.lib/vendor/symfony/yaml/Tests/Command/LintCommandTest.php
@@ -12,10 +12,10 @@
namespace Symfony\Component\Yaml\Tests\Command;
use PHPUnit\Framework\TestCase;
+use Symfony\Component\Yaml\Command\LintCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;
-use Symfony\Component\Yaml\Command\LintCommand;
/**
* Tests the YamlLintCommand.
@@ -31,10 +31,10 @@ public function testLintCorrectFile()
$tester = $this->createCommandTester();
$filename = $this->createFile('foo: bar');
- $ret = $tester->execute(['filename' => $filename], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]);
+ $ret = $tester->execute(array('filename' => $filename), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false));
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
- $this->assertMatchesRegularExpression('/^\/\/ OK in /', trim($tester->getDisplay()));
+ $this->assertRegExp('/^\/\/ OK in /', trim($tester->getDisplay()));
}
public function testLintIncorrectFile()
@@ -45,10 +45,10 @@ public function testLintIncorrectFile()
$tester = $this->createCommandTester();
$filename = $this->createFile($incorrectContent);
- $ret = $tester->execute(['filename' => $filename], ['decorated' => false]);
+ $ret = $tester->execute(array('filename' => $filename), array('decorated' => false));
$this->assertEquals(1, $ret, 'Returns 1 in case of error');
- $this->assertStringContainsString('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
+ $this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
}
public function testConstantAsKey()
@@ -56,7 +56,7 @@ public function testConstantAsKey()
$yaml = <<createCommandTester()->execute(['filename' => $this->createFile($yaml)], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]);
+ $ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml)), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false));
$this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success');
}
@@ -65,7 +65,7 @@ public function testCustomTags()
$yaml = <<createCommandTester()->execute(['filename' => $this->createFile($yaml), '--parse-tags' => true], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]);
+ $ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml), '--parse-tags' => true), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false));
$this->assertSame(0, $ret, 'lint:yaml exits with code 0 in case of success');
}
@@ -74,18 +74,20 @@ public function testCustomTagsError()
$yaml = <<createCommandTester()->execute(['filename' => $this->createFile($yaml)], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]);
+ $ret = $this->createCommandTester()->execute(array('filename' => $this->createFile($yaml)), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false));
$this->assertSame(1, $ret, 'lint:yaml exits with code 1 in case of error');
}
+ /**
+ * @expectedException \RuntimeException
+ */
public function testLintFileNotReadable()
{
- $this->expectException('RuntimeException');
$tester = $this->createCommandTester();
$filename = $this->createFile('');
unlink($filename);
- $tester->execute(['filename' => $filename], ['decorated' => false]);
+ $ret = $tester->execute(array('filename' => $filename), array('decorated' => false));
}
/**
@@ -115,7 +117,7 @@ protected function createCommandTester()
protected function setUp()
{
- $this->files = [];
+ $this->files = array();
@mkdir(sys_get_temp_dir().'/framework-yml-lint-test');
}
@@ -123,11 +125,11 @@ protected function tearDown()
{
foreach ($this->files as $file) {
if (file_exists($file)) {
- @unlink($file);
+ unlink($file);
}
}
- @rmdir(sys_get_temp_dir().'/framework-yml-lint-test');
+ rmdir(sys_get_temp_dir().'/framework-yml-lint-test');
}
}
diff --git a/inc.lib/vendor/symfony/yaml/Tests/DumperTest.php b/inc.lib/vendor/symfony/yaml/Tests/DumperTest.php
index e4dc49f3..bcdd3e0e 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/DumperTest.php
+++ b/inc.lib/vendor/symfony/yaml/Tests/DumperTest.php
@@ -12,9 +12,8 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
-use Symfony\Component\Yaml\Dumper;
use Symfony\Component\Yaml\Parser;
-use Symfony\Component\Yaml\Tag\TaggedValue;
+use Symfony\Component\Yaml\Dumper;
use Symfony\Component\Yaml\Yaml;
class DumperTest extends TestCase
@@ -23,20 +22,20 @@ class DumperTest extends TestCase
protected $dumper;
protected $path;
- protected $array = [
+ protected $array = array(
'' => 'bar',
'foo' => '#bar',
- 'foo\'bar' => [],
- 'bar' => [1, 'foo'],
- 'foobar' => [
+ 'foo\'bar' => array(),
+ 'bar' => array(1, 'foo'),
+ 'foobar' => array(
'foo' => 'bar',
- 'bar' => [1, 'foo'],
- 'foobar' => [
+ 'bar' => array(1, 'foo'),
+ 'foobar' => array(
'foo' => 'bar',
- 'bar' => [1, 'foo'],
- ],
- ],
- ];
+ 'bar' => array(1, 'foo'),
+ ),
+ ),
+ );
protected function setUp()
{
@@ -209,7 +208,7 @@ public function testInlineLevel()
public function testObjectSupportEnabled()
{
- $dump = $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_OBJECT);
+ $dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_OBJECT);
$this->assertEquals('{ foo: !php/object \'O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects');
}
@@ -219,42 +218,44 @@ public function testObjectSupportEnabled()
*/
public function testObjectSupportEnabledPassingTrue()
{
- $dump = $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, false, true);
+ $dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true);
$this->assertEquals('{ foo: !php/object \'O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects');
}
public function testObjectSupportDisabledButNoExceptions()
{
- $dump = $this->dumper->dump(['foo' => new A(), 'bar' => 1]);
+ $dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1));
$this->assertEquals('{ foo: null, bar: 1 }', $dump, '->dump() does not dump objects when disabled');
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\DumpException
+ */
public function testObjectSupportDisabledWithExceptions()
{
- $this->expectException('Symfony\Component\Yaml\Exception\DumpException');
- $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);
+ $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);
}
/**
* @group legacy
+ * @expectedException \Symfony\Component\Yaml\Exception\DumpException
*/
public function testObjectSupportDisabledWithExceptionsPassingTrue()
{
- $this->expectException('Symfony\Component\Yaml\Exception\DumpException');
- $this->dumper->dump(['foo' => new A(), 'bar' => 1], 0, 0, true);
+ $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, true);
}
public function testEmptyArray()
{
- $dump = $this->dumper->dump([]);
+ $dump = $this->dumper->dump(array());
$this->assertEquals('{ }', $dump);
- $dump = $this->dumper->dump([], 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
+ $dump = $this->dumper->dump(array(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
$this->assertEquals('[]', $dump);
- $dump = $this->dumper->dump([], 9, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
+ $dump = $this->dumper->dump(array(), 9, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
$this->assertEquals('[]', $dump);
$dump = $this->dumper->dump(new \ArrayObject(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | Yaml::DUMP_OBJECT_AS_MAP);
@@ -274,28 +275,27 @@ public function testEscapedEscapeSequencesInQuotedScalar($input, $expected)
public function getEscapeSequences()
{
- return [
- 'empty string' => ['', "''"],
- 'null' => ["\x0", '"\\0"'],
- 'bell' => ["\x7", '"\\a"'],
- 'backspace' => ["\x8", '"\\b"'],
- 'horizontal-tab' => ["\t", '"\\t"'],
- 'line-feed' => ["\n", '"\\n"'],
- 'vertical-tab' => ["\v", '"\\v"'],
- 'form-feed' => ["\xC", '"\\f"'],
- 'carriage-return' => ["\r", '"\\r"'],
- 'escape' => ["\x1B", '"\\e"'],
- 'space' => [' ', "' '"],
- 'double-quote' => ['"', "'\"'"],
- 'slash' => ['/', '/'],
- 'backslash' => ['\\', '\\'],
- 'del' => ["\x7f", '"\x7f"'],
- 'next-line' => ["\xC2\x85", '"\\N"'],
- 'non-breaking-space' => ["\xc2\xa0", '"\\_"'],
- 'line-separator' => ["\xE2\x80\xA8", '"\\L"'],
- 'paragraph-separator' => ["\xE2\x80\xA9", '"\\P"'],
- 'colon' => [':', "':'"],
- ];
+ return array(
+ 'empty string' => array('', "''"),
+ 'null' => array("\x0", '"\\0"'),
+ 'bell' => array("\x7", '"\\a"'),
+ 'backspace' => array("\x8", '"\\b"'),
+ 'horizontal-tab' => array("\t", '"\\t"'),
+ 'line-feed' => array("\n", '"\\n"'),
+ 'vertical-tab' => array("\v", '"\\v"'),
+ 'form-feed' => array("\xC", '"\\f"'),
+ 'carriage-return' => array("\r", '"\\r"'),
+ 'escape' => array("\x1B", '"\\e"'),
+ 'space' => array(' ', "' '"),
+ 'double-quote' => array('"', "'\"'"),
+ 'slash' => array('/', '/'),
+ 'backslash' => array('\\', '\\'),
+ 'next-line' => array("\xC2\x85", '"\\N"'),
+ 'non-breaking-space' => array("\xc2\xa0", '"\\_"'),
+ 'line-separator' => array("\xE2\x80\xA8", '"\\L"'),
+ 'paragraph-separator' => array("\xE2\x80\xA9", '"\\P"'),
+ 'colon' => array(':', "':'"),
+ );
}
public function testBinaryDataIsDumpedBase64Encoded()
@@ -303,7 +303,7 @@ public function testBinaryDataIsDumpedBase64Encoded()
$binaryData = file_get_contents(__DIR__.'/Fixtures/arrow.gif');
$expected = '{ data: !!binary '.base64_encode($binaryData).' }';
- $this->assertSame($expected, $this->dumper->dump(['data' => $binaryData]));
+ $this->assertSame($expected, $this->dumper->dump(array('data' => $binaryData)));
}
public function testNonUtf8DataIsDumpedBase64Encoded()
@@ -324,18 +324,18 @@ public function testDumpObjectAsMap($object, $expected)
public function objectAsMapProvider()
{
- $tests = [];
+ $tests = array();
$bar = new \stdClass();
$bar->class = 'classBar';
- $bar->args = ['bar'];
+ $bar->args = array('bar');
$zar = new \stdClass();
$foo = new \stdClass();
$foo->bar = $bar;
$foo->zar = $zar;
$object = new \stdClass();
$object->foo = $foo;
- $tests['stdClass'] = [$object, $object];
+ $tests['stdClass'] = array($object, $object);
$arrayObject = new \ArrayObject();
$arrayObject['foo'] = 'bar';
@@ -343,19 +343,19 @@ public function objectAsMapProvider()
$parsedArrayObject = new \stdClass();
$parsedArrayObject->foo = 'bar';
$parsedArrayObject->baz = 'foobar';
- $tests['ArrayObject'] = [$arrayObject, $parsedArrayObject];
+ $tests['ArrayObject'] = array($arrayObject, $parsedArrayObject);
$a = new A();
- $tests['arbitrary-object'] = [$a, null];
+ $tests['arbitrary-object'] = array($a, null);
return $tests;
}
public function testDumpingArrayObjectInstancesRespectsInlineLevel()
{
- $deep = new \ArrayObject(['deep1' => 'd', 'deep2' => 'e']);
- $inner = new \ArrayObject(['inner1' => 'b', 'inner2' => 'c', 'inner3' => $deep]);
- $outer = new \ArrayObject(['outer1' => 'a', 'outer2' => $inner]);
+ $deep = new \ArrayObject(array('deep1' => 'd', 'deep2' => 'e'));
+ $inner = new \ArrayObject(array('inner1' => 'b', 'inner2' => 'c', 'inner3' => $deep));
+ $outer = new \ArrayObject(array('outer1' => 'a', 'outer2' => $inner));
$yaml = $this->dumper->dump($outer, 2, 0, Yaml::DUMP_OBJECT_AS_MAP);
@@ -372,9 +372,9 @@ public function testDumpingArrayObjectInstancesRespectsInlineLevel()
public function testDumpingArrayObjectInstancesWithNumericKeysInlined()
{
- $deep = new \ArrayObject(['d', 'e']);
- $inner = new \ArrayObject(['b', 'c', $deep]);
- $outer = new \ArrayObject(['a', $inner]);
+ $deep = new \ArrayObject(array('d', 'e'));
+ $inner = new \ArrayObject(array('b', 'c', $deep));
+ $outer = new \ArrayObject(array('a', $inner));
$yaml = $this->dumper->dump($outer, 0, 0, Yaml::DUMP_OBJECT_AS_MAP);
$expected = <<dumper->dump($outer, 2, 0, Yaml::DUMP_OBJECT_AS_MAP);
$expected = <<assertSame($expected, $yaml);
}
- public function testDumpingTaggedValueSequenceRespectsInlineLevel()
- {
- $data = [
- new TaggedValue('user', [
- 'username' => 'jane',
- ]),
- new TaggedValue('user', [
- 'username' => 'john',
- ]),
- ];
-
- $yaml = $this->dumper->dump($data, 2);
-
- $expected = <<assertSame($expected, $yaml);
- }
-
- public function testDumpingTaggedValueSequenceWithInlinedTagValues()
- {
- $data = [
- new TaggedValue('user', [
- 'username' => 'jane',
- ]),
- new TaggedValue('user', [
- 'username' => 'john',
- ]),
- ];
-
- $yaml = $this->dumper->dump($data, 1);
-
- $expected = <<assertSame($expected, $yaml);
- }
-
- public function testDumpingTaggedValueMapRespectsInlineLevel()
- {
- $data = [
- 'user1' => new TaggedValue('user', [
- 'username' => 'jane',
- ]),
- 'user2' => new TaggedValue('user', [
- 'username' => 'john',
- ]),
- ];
-
- $yaml = $this->dumper->dump($data, 2);
-
- $expected = <<assertSame($expected, $yaml);
- }
-
- public function testDumpingTaggedValueMapWithInlinedTagValues()
- {
- $data = [
- 'user1' => new TaggedValue('user', [
- 'username' => 'jane',
- ]),
- 'user2' => new TaggedValue('user', [
- 'username' => 'john',
- ]),
- ];
-
- $yaml = $this->dumper->dump($data, 1);
-
- $expected = <<assertSame($expected, $yaml);
- }
-
- public function testDumpingNotInlinedScalarTaggedValue()
- {
- $data = [
- 'user1' => new TaggedValue('user', 'jane'),
- 'user2' => new TaggedValue('user', 'john'),
- ];
- $expected = <<assertSame($expected, $this->dumper->dump($data, 2));
- }
-
- public function testDumpingNotInlinedNullTaggedValue()
- {
- $data = [
- 'foo' => new TaggedValue('bar', null),
- ];
- $expected = <<assertSame($expected, $this->dumper->dump($data, 2));
- }
-
- public function testDumpingMultiLineStringAsScalarBlockTaggedValue()
- {
- $data = [
- 'foo' => new TaggedValue('bar', "foo\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz"),
- ];
- $expected = <<assertSame($expected, $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
- }
-
- public function testDumpingInlinedMultiLineIfRnBreakLineInTaggedValue()
- {
- $data = [
- 'data' => [
- 'foo' => new TaggedValue('bar', "foo\r\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz"),
- ],
- ];
-
- $this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block_for_tagged_values.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
- }
-
public function testDumpMultiLineStringAsScalarBlock()
{
- $data = [
- 'data' => [
+ $data = array(
+ 'data' => array(
'single_line' => 'foo bar baz',
- 'multi_line' => "foo\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz",
- 'multi_line_with_carriage_return' => "foo\nbar\r\nbaz",
- 'nested_inlined_multi_line_string' => [
+ 'multi_line' => "foo\nline with trailing spaces:\n \nbar\r\ninteger like line:\n123456789\nempty line:\n\nbaz",
+ 'nested_inlined_multi_line_string' => array(
'inlined_multi_line' => "foo\nbar\r\nempty line:\n\nbaz",
- ],
- ],
- ];
+ ),
+ ),
+ );
$this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
}
- public function testDumpMultiLineStringAsScalarBlockWhenFirstLineHasLeadingSpace()
- {
- $data = [
- 'data' => [
- 'multi_line' => " the first line has leading spaces\nThe second line does not.",
- ],
- ];
-
- $this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
- }
-
- public function testCarriageReturnFollowedByNewlineIsMaintainedWhenDumpingAsMultiLineLiteralBlock()
- {
- $this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(["a\r\nb\nc"], 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
- }
-
- public function testCarriageReturnNotFollowedByNewlineIsPreservedWhenDumpingAsMultiLineLiteralBlock()
- {
- $expected = <<<'YAML'
-parent:
- foo: "bar\n\rbaz: qux"
-
-YAML;
-
- $this->assertSame($expected, $this->dumper->dump([
- 'parent' => [
- 'foo' => "bar\n\rbaz: qux",
- ],
- ], 4, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
- }
-
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage The indentation must be greater than zero
+ */
public function testZeroIndentationThrowsException()
{
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage('The indentation must be greater than zero');
new Dumper(0);
}
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage The indentation must be greater than zero
+ */
public function testNegativeIndentationThrowsException()
{
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage('The indentation must be greater than zero');
new Dumper(-4);
}
}
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml
index 81b4129a..5f9c9427 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml
@@ -14,7 +14,7 @@ yaml: |
- Oren
- *showell
php: |
- ['Steve', 'Clark', 'Brian', 'Oren', 'Steve']
+ array('Steve', 'Clark', 'Brian', 'Oren', 'Steve')
---
test: Alias of a Mapping
@@ -28,4 +28,4 @@ yaml: |
- banana
- *hello
php: |
- [['Meat'=>'pork', 'Starch'=>'potato'], 'banana', ['Meat'=>'pork', 'Starch'=>'potato']]
+ array(array('Meat'=>'pork', 'Starch'=>'potato'), 'banana', array('Meat'=>'pork', 'Starch'=>'potato'))
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml
index 1a08d8ea..dfd93021 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml
@@ -9,7 +9,7 @@ yaml: |
- banana
- carrot
php: |
- ['apple', 'banana', 'carrot']
+ array('apple', 'banana', 'carrot')
---
test: Sequence With Item Being Null In The Middle
brief: |
@@ -21,7 +21,7 @@ yaml: |
-
- carrot
php: |
- ['apple', null, 'carrot']
+ array('apple', null, 'carrot')
---
test: Sequence With Last Item Being Null
brief: |
@@ -33,7 +33,7 @@ yaml: |
- banana
-
php: |
- ['apple', 'banana', null]
+ array('apple', 'banana', null)
---
test: Nested Sequences
brief: |
@@ -46,7 +46,7 @@ yaml: |
- bar
- baz
php: |
- [['foo', 'bar', 'baz']]
+ array(array('foo', 'bar', 'baz'))
---
test: Mixed Sequences
brief: |
@@ -61,7 +61,7 @@ yaml: |
- banana
- carrot
php: |
- ['apple', ['foo', 'bar', 'x123'], 'banana', 'carrot']
+ array('apple', array('foo', 'bar', 'x123'), 'banana', 'carrot')
---
test: Deeply Nested Sequences
brief: |
@@ -74,7 +74,7 @@ yaml: |
- uno
- dos
php: |
- [[['uno', 'dos']]]
+ array(array(array('uno', 'dos')))
---
test: Simple Mapping
brief: |
@@ -87,7 +87,7 @@ yaml: |
foo: whatever
bar: stuff
php: |
- ['foo' => 'whatever', 'bar' => 'stuff']
+ array('foo' => 'whatever', 'bar' => 'stuff')
---
test: Sequence in a Mapping
brief: |
@@ -98,7 +98,7 @@ yaml: |
- uno
- dos
php: |
- ['foo' => 'whatever', 'bar' => ['uno', 'dos']]
+ array('foo' => 'whatever', 'bar' => array('uno', 'dos'))
---
test: Nested Mappings
brief: |
@@ -110,14 +110,14 @@ yaml: |
name: steve
sport: baseball
php: |
- [
+ array(
'foo' => 'whatever',
- 'bar' => [
+ 'bar' => array(
'fruit' => 'apple',
'name' => 'steve',
'sport' => 'baseball'
- ]
- ]
+ )
+ )
---
test: Mixed Mapping
brief: |
@@ -136,22 +136,22 @@ yaml: |
perl: papers
ruby: scissorses
php: |
- [
+ array(
'foo' => 'whatever',
- 'bar' => [
- [
+ 'bar' => array(
+ array(
'fruit' => 'apple',
'name' => 'steve',
'sport' => 'baseball'
- ],
+ ),
'more',
- [
+ array(
'python' => 'rocks',
'perl' => 'papers',
'ruby' => 'scissorses'
- ]
- ]
- ]
+ )
+ )
+ )
---
test: Mapping-in-Sequence Shortcut
todo: true
@@ -163,7 +163,7 @@ yaml: |
- work on YAML.py:
- work on Store
php: |
- [['work on YAML.py' => ['work on Store']]]
+ array(array('work on YAML.py' => array('work on Store')))
---
test: Sequence-in-Mapping Shortcut
todo: true
@@ -177,7 +177,7 @@ yaml: |
- '%.sourceforge.net'
- '%.freepan.org'
php: |
- ['allow' => ['localhost', '%.sourceforge.net', '%.freepan.org']]
+ array('allow' => array('localhost', '%.sourceforge.net', '%.freepan.org'))
---
todo: true
test: Merge key
@@ -192,11 +192,11 @@ yaml: |
<<:
age: 38
php: |
- [
+ array(
'mapping' =>
- [
+ array(
'name' => 'Joe',
'job' => 'Accountant',
'age' => 38
- ]
- ]
+ )
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml
index 1f3a2e54..f7ca469b 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml
@@ -5,7 +5,7 @@ brief: |
yaml: |
foo: bar
php: |
- ['foo' => 'bar']
+ array('foo' => 'bar')
---
test: Multi Element Mapping
brief: |
@@ -15,11 +15,11 @@ yaml: |
white: walls
blue: berries
php: |
- [
+ array(
'red' => 'baron',
'white' => 'walls',
'blue' => 'berries',
- ]
+ )
---
test: Values aligned
brief: |
@@ -30,11 +30,11 @@ yaml: |
white: walls
blue: berries
php: |
- [
+ array(
'red' => 'baron',
'white' => 'walls',
'blue' => 'berries',
- ]
+ )
---
test: Colons aligned
brief: |
@@ -44,8 +44,8 @@ yaml: |
white : walls
blue : berries
php: |
- [
+ array(
'red' => 'baron',
'white' => 'walls',
'blue' => 'berries',
- ]
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml
index 67cb47ad..d9881025 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml
@@ -49,7 +49,7 @@ yaml: |
foo: 1
bar: 2
php: |
- ['foo' => 1, 'bar' => 2]
+ array('foo' => 1, 'bar' => 2)
documents: 1
---
@@ -63,7 +63,7 @@ yaml: |
foo: |
---
php: |
- ['foo' => "---\n"]
+ array('foo' => "---\n")
---
test: Multiple Document Separators in Block
@@ -79,7 +79,7 @@ yaml: |
bar: |
fooness
php: |
- [
+ array(
'foo' => "---\nfoo: bar\n---\nyo: baz\n",
'bar' => "fooness\n"
- ]
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml
index e8697f93..e8506fcb 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml
@@ -22,4 +22,4 @@ yaml: |
firstline: 1
secondline: 2
php: |
- ['foo' => null, 'firstline' => 1, 'secondline' => 2]
+ array('foo' => null, 'firstline' => 1, 'secondline' => 2)
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml
index cc562cd9..03090e4a 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml
@@ -8,7 +8,7 @@ brief: >
yaml: |
seq: [ a, b, c ]
php: |
- ['seq' => ['a', 'b', 'c']]
+ array('seq' => array('a', 'b', 'c'))
---
test: Simple Inline Hash
brief: >
@@ -21,7 +21,7 @@ brief: >
yaml: |
hash: { name: Steve, foo: bar }
php: |
- ['hash' => ['name' => 'Steve', 'foo' => 'bar']]
+ array('hash' => array('name' => 'Steve', 'foo' => 'bar'))
---
test: Multi-line Inline Collections
todo: true
@@ -38,15 +38,15 @@ yaml: |
Python: python.org,
Perl: use.perl.org }
php: |
- [
- 'languages' => ['Ruby', 'Perl', 'Python'],
- 'websites' => [
+ array(
+ 'languages' => array('Ruby', 'Perl', 'Python'),
+ 'websites' => array(
'YAML' => 'yaml.org',
'Ruby' => 'ruby-lang.org',
'Python' => 'python.org',
'Perl' => 'use.perl.org'
- ]
- ]
+ )
+ )
---
test: Commas in Values (not in the spec!)
todo: true
@@ -57,4 +57,4 @@ brief: >
yaml: |
attendances: [ 45,123, 70,000, 17,222 ]
php: |
- ['attendances' => [45123, 70000, 17222]]
+ array('attendances' => array(45123, 70000, 17222))
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml
index 2895202a..a14735a5 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml
@@ -12,7 +12,7 @@ yaml: |
Foo
Bar
php: |
- ['this' => "Foo\nBar\n"]
+ array('this' => "Foo\nBar\n")
---
test: The '+' indicator
brief: >
@@ -28,11 +28,11 @@ yaml: |
dummy: value
php: |
- [
+ array(
'normal' => "extra new lines not kept\n",
'preserving' => "extra new lines are kept\n\n\n",
'dummy' => 'value'
- ]
+ )
---
test: Three trailing newlines in literals
brief: >
@@ -64,14 +64,14 @@ yaml: |
same as "kept" above: "This has four newlines.\n\n\n\n"
php: |
- [
+ array(
'clipped' => "This has one newline.\n",
'same as "clipped" above' => "This has one newline.\n",
'stripped' => 'This has no newline.',
'same as "stripped" above' => 'This has no newline.',
'kept' => "This has four newlines.\n\n\n\n",
'same as "kept" above' => "This has four newlines.\n\n\n\n"
- ]
+ )
---
test: Extra trailing newlines with spaces
todo: true
@@ -95,8 +95,8 @@ yaml: |
php: |
- ['this' => "Foo\n\n \n",
- 'kept' => "Foo\n\n \n"]
+ array('this' => "Foo\n\n \n",
+ 'kept' => "Foo\n\n \n" )
---
test: Folded Block in a Sequence
@@ -115,12 +115,12 @@ yaml: |
hmm
- dog
php: |
- [
+ array(
'apple',
'banana',
"can't you see the beauty of yaml? hmm\n",
'dog'
- ]
+ )
---
test: Folded Block as a Mapping Value
brief: >
@@ -135,10 +135,10 @@ yaml: |
by a knee injury.
source: espn
php: |
- [
+ array(
'quote' => "Mark McGwire's year was crippled by a knee injury.\n",
'source' => 'espn'
- ]
+ )
---
test: Three trailing newlines in folded blocks
brief: >
@@ -166,11 +166,11 @@ yaml: |
same as "kept" above: "This has four newlines.\n\n\n\n"
php: |
- [
+ array(
'clipped' => "This has one newline.\n",
'same as "clipped" above' => "This has one newline.\n",
'stripped' => 'This has no newline.',
'same as "stripped" above' => 'This has no newline.',
'kept' => "This has four newlines.\n\n\n\n",
'same as "kept" above' => "This has four newlines.\n\n\n\n"
- ]
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml
index ea8e36ed..9a5300f2 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml
@@ -6,7 +6,7 @@ brief: >
yaml: |
empty: []
php: |
- ['empty' => []]
+ array('empty' => array())
---
test: Empty Mapping
brief: >
@@ -15,19 +15,19 @@ brief: >
yaml: |
empty: {}
php: |
- ['empty' => []]
+ array('empty' => array())
---
test: Empty Sequence as Entire Document
yaml: |
[]
php: |
- []
+ array()
---
test: Empty Mapping as Entire Document
yaml: |
{}
php: |
- []
+ array()
---
test: Null as Document
yaml: |
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml
index dd2d776f..a7bba5ed 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml
@@ -6,7 +6,7 @@ yaml: |
- Sammy Sosa
- Ken Griffey
php: |
- ['Mark McGwire', 'Sammy Sosa', 'Ken Griffey']
+ array('Mark McGwire', 'Sammy Sosa', 'Ken Griffey')
---
test: Mapping of scalars to scalars
spec: 2.2
@@ -15,7 +15,7 @@ yaml: |
avg: 0.278
rbi: 147
php: |
- ['hr' => 65, 'avg' => 0.278, 'rbi' => 147]
+ array('hr' => 65, 'avg' => 0.278, 'rbi' => 147)
---
test: Mapping of scalars to sequences
spec: 2.3
@@ -29,13 +29,13 @@ yaml: |
- Chicago Cubs
- Atlanta Braves
php: |
- ['american' =>
- ['Boston Red Sox', 'Detroit Tigers',
- 'New York Yankees'],
+ array('american' =>
+ array( 'Boston Red Sox', 'Detroit Tigers',
+ 'New York Yankees' ),
'national' =>
- ['New York Mets', 'Chicago Cubs',
- 'Atlanta Braves']
- ]
+ array( 'New York Mets', 'Chicago Cubs',
+ 'Atlanta Braves' )
+ )
---
test: Sequence of mappings
spec: 2.4
@@ -49,10 +49,10 @@ yaml: |
hr: 63
avg: 0.288
php: |
- [
- ['name' => 'Mark McGwire', 'hr' => 65, 'avg' => 0.278],
- ['name' => 'Sammy Sosa', 'hr' => 63, 'avg' => 0.288]
- ]
+ array(
+ array('name' => 'Mark McGwire', 'hr' => 65, 'avg' => 0.278),
+ array('name' => 'Sammy Sosa', 'hr' => 63, 'avg' => 0.288)
+ )
---
test: Legacy A5
todo: true
@@ -72,7 +72,7 @@ yaml: |
- 2001-07-23
perl-busted: >
YAML.pm will be able to emulate this behavior soon. In this regard
- it may be somewhat more correct than Python's native behavior which
+ it may be somewhat more correct than Python's native behaviour which
can only use tuples as mapping keys. PyYAML will also need to figure
out some clever way to roundtrip structured keys.
python: |
@@ -134,11 +134,11 @@ yaml: |
- [ Mark McGwire , 65 , 0.278 ]
- [ Sammy Sosa , 63 , 0.288 ]
php: |
- [
- [ 'name', 'hr', 'avg' ],
- [ 'Mark McGwire', 65, 0.278 ],
- [ 'Sammy Sosa', 63, 0.288 ]
- ]
+ array(
+ array( 'name', 'hr', 'avg' ),
+ array( 'Mark McGwire', 65, 0.278 ),
+ array( 'Sammy Sosa', 63, 0.288 )
+ )
---
test: Mapping of mappings
todo: true
@@ -150,12 +150,12 @@ yaml: |
avg: 0.288
}
php: |
- [
+ array(
'Mark McGwire' =>
- [ 'hr' => 65, 'avg' => 0.278 ],
+ array( 'hr' => 65, 'avg' => 0.278 ),
'Sammy Sosa' =>
- [ 'hr' => 63, 'avg' => 0.288 ]
- ]
+ array( 'hr' => 63, 'avg' => 0.288 )
+ )
---
test: Two documents in a stream each with a leading comment
todo: true
@@ -208,10 +208,10 @@ yaml: |
- Sammy Sosa
- Ken Griffey
php: |
- [
- 'hr' => [ 'Mark McGwire', 'Sammy Sosa' ],
- 'rbi' => [ 'Sammy Sosa', 'Ken Griffey' ]
- ]
+ array(
+ 'hr' => array( 'Mark McGwire', 'Sammy Sosa' ),
+ 'rbi' => array( 'Sammy Sosa', 'Ken Griffey' )
+ )
---
test: Node for Sammy Sosa appears twice in this document
spec: 2.10
@@ -225,12 +225,12 @@ yaml: |
- *SS # Subsequent occurrence
- Ken Griffey
php: |
- [
+ array(
'hr' =>
- ['Mark McGwire', 'Sammy Sosa'],
+ array('Mark McGwire', 'Sammy Sosa'),
'rbi' =>
- ['Sammy Sosa', 'Ken Griffey']
- ]
+ array('Sammy Sosa', 'Ken Griffey')
+ )
---
test: Mapping between sequences
todo: true
@@ -297,20 +297,20 @@ yaml: |
- item : Big Shoes
quantity: 1
php: |
- [
- [
+ array (
+ array (
'item' => 'Super Hoop',
'quantity' => 1,
- ],
- [
+ ),
+ array (
'item' => 'Basketball',
'quantity' => 4,
- ],
- [
+ ),
+ array (
'item' => 'Big Shoes',
'quantity' => 1,
- ]
- ]
+ )
+ )
perl: |
[
{ item => 'Super Hoop', quantity => 1 },
@@ -462,11 +462,11 @@ yaml: |
65 Home Runs
0.278 Batting Average
php: |
- [
+ array(
'name' => 'Mark McGwire',
'accomplishment' => "Mark set a major league home run record in 1998.\n",
'stats' => "65 Home Runs\n0.278 Batting Average\n"
- ]
+ )
---
test: Quoted scalars
todo: true
@@ -512,11 +512,11 @@ yaml: |
octal: 014
hexadecimal: 0xC
php: |
- [
+ array(
'canonical' => 12345,
'octal' => 014,
'hexadecimal' => 0xC
- ]
+ )
---
test: Decimal Integer
deprecated: true
@@ -524,9 +524,9 @@ spec: 2.19
yaml: |
decimal: +12,345
php: |
- [
+ array(
'decimal' => 12345.0,
- ]
+ )
---
# FIX: spec shows parens around -inf and NaN
test: Floating point
@@ -538,13 +538,13 @@ yaml: |
not a number: .NaN
float as whole number: !!float 1
php: |
- [
+ array(
'canonical' => 1230.15,
'exponential' => 1230.15,
'negative infinity' => log(0),
'not a number' => -log(0),
'float as whole number' => (float) 1
- ]
+ )
---
test: Fixed Floating point
deprecated: true
@@ -552,9 +552,9 @@ spec: 2.20
yaml: |
fixed: 1,230.15
php: |
- [
+ array(
'fixed' => 1230.15,
- ]
+ )
---
test: Timestamps
todo: true
@@ -565,12 +565,12 @@ yaml: |
spaced: 2001-12-14 21:59:43.10 -05:00
date: 2002-12-14 # Time is noon UTC
php: |
- [
+ array(
'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),
'iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'date' => Date.new( 2002, 12, 14 )
- ]
+ )
---
test: legacy Timestamps test
todo: true
@@ -581,12 +581,12 @@ yaml: |
spaced: 2001-12-14 21:59:43.00 -05:00
date: 2002-12-14
php: |
- [
+ array(
'canonical' => Time::utc( 2001, 12, 15, 2, 59, 43, 0 ),
'iso8601' => YAML::mktime( 2001, 2, 28, 21, 59, 43, 0, "-05:00" ),
'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0, "-05:00" ),
'date' => Date.new( 2002, 12, 14 )
- ]
+ )
---
test: Various explicit families
todo: true
@@ -754,20 +754,20 @@ yaml: |
Backup contact is Nancy
Billsmer @ 338-4338.
php: |
- [
+ array(
'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'bill-to' =>
- [ 'given' => 'Chris', 'family' => 'Dumars', 'address' => [ 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ] ]
+ array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
, 'ship-to' =>
- [ 'given' => 'Chris', 'family' => 'Dumars', 'address' => [ 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ] ]
+ array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
, 'product' =>
- [
- [ 'sku' => 'BL394D', 'quantity' => 4, 'description' => 'Basketball', 'price' => 450.00 ],
- [ 'sku' => 'BL4438H', 'quantity' => 1, 'description' => 'Super Hoop', 'price' => 2392.00 ]
- ],
+ array(
+ array( 'sku' => 'BL394D', 'quantity' => 4, 'description' => 'Basketball', 'price' => 450.00 ),
+ array( 'sku' => 'BL4438H', 'quantity' => 1, 'description' => 'Super Hoop', 'price' => 2392.00 )
+ ),
'tax' => 251.42, 'total' => 4443.52,
'comments' => "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.\n"
- ]
+ )
---
test: Log file
todo: true
@@ -826,9 +826,9 @@ yaml: |
# These are three throwaway comment
# lines (the first line is empty).
php: |
- [
+ array(
'this' => "contains three lines of text.\nThe third one starts with a\n# character. This isn't a comment.\n"
- ]
+ )
---
test: Document with a single value
todo: true
@@ -878,11 +878,11 @@ yaml: |
date : 2001-01-23
total : 4443.52
php: |
- [
+ array(
'invoice' => 34843,
'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'total' => 4443.52
- ]
+ )
---
test: Single-line documents
todo: true
@@ -928,13 +928,13 @@ documents: 2
---
test: Explicit typing
-deprecated: Using the non-specific tag "!" is deprecated since Symfony 3.4 as its behavior will change in 4.0.
+deprecated: Using the non-specific tag "!" is deprecated since version 3.4 as its behavior will change in 4.0.
yaml: |
integer: 12
also int: ! "12"
string: !!str 12
php: |
- [ 'integer' => 12, 'also int' => 12, 'string' => '12' ]
+ array( 'integer' => 12, 'also int' => 12, 'string' => '12' )
---
test: Private types
todo: true
@@ -966,7 +966,7 @@ yaml: |
# The URI is 'tag:yaml.org,2002:str'
- !!str a Unicode string
php: |
- [ 'a Unicode string' ]
+ array( 'a Unicode string' )
---
test: Type family under perl.yaml.org
todo: true
@@ -1039,9 +1039,9 @@ yaml: |
repeated use of this value.
alias : *A001
php: |
- [ 'anchor' => 'This scalar has an anchor.',
+ array( 'anchor' => 'This scalar has an anchor.',
'override' => "The alias node below is a repeated use of this value.\n",
- 'alias' => "The alias node below is a repeated use of this value.\n"]
+ 'alias' => "The alias node below is a repeated use of this value.\n" )
---
test: Flow and block formatting
todo: true
@@ -1152,12 +1152,12 @@ yaml: |
redundant: |2
This value is indented 2 spaces.
php: |
- [
+ array(
'leading spaces' => " This value starts with four spaces.\n",
'leading line break' => "\nThis value starts with a line break.\n",
'leading comment indicator' => "# first line starts with a\n# character.\n",
'redundant' => "This value is indented 2 spaces.\n"
- ]
+ )
---
test: Chomping and keep modifiers
yaml: |
@@ -1176,14 +1176,14 @@ yaml: |
same as "kept" above: "This has two newlines.\n\n"
php: |
- [
+ array(
'clipped' => "This has one newline.\n",
'same as "clipped" above' => "This has one newline.\n",
'stripped' => 'This has no newline.',
'same as "stripped" above' => 'This has no newline.',
'kept' => "This has two newlines.\n\n",
'same as "kept" above' => "This has two newlines.\n\n"
- ]
+ )
---
test: Literal combinations
todo: true
@@ -1221,7 +1221,7 @@ yaml: |
both are equal to: " This has no newline."
php: |
- [
+ array(
'empty' => '',
'literal' => "The \\ ' \" characters may be\nfreely used. Leading white\n space " +
"is significant.\n\nLine breaks are significant.\nThus this value contains one\n" +
@@ -1232,7 +1232,7 @@ php: |
'indented and chomped' => ' This has no newline.',
'also written as' => ' This has no newline.',
'both are equal to' => ' This has no newline.'
- [
+ )
---
test: Folded combinations
todo: true
@@ -1288,7 +1288,7 @@ yaml: |
# Explicit comments may follow
# but must be less indented.
php: |
- [
+ array(
'empty' => '',
'one paragraph' => 'Line feeds are converted to spaces, so this value'.
" contains no line breaks except for the final one.\n",
@@ -1300,7 +1300,7 @@ php: |
'above is equal to' => "This is a folded paragraph followed by a list:\n".
" * first entry\n * second entry\nFollowed by another folded paragraph, ".
"another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n"
- ]
+ )
---
test: Single quotes
todo: true
@@ -1315,13 +1315,13 @@ yaml: |
line break'
is same as: "this contains six spaces\nand one line break"
php: |
- [
+ array(
'empty' => '',
'second' => '! : \\ etc. can be used freely.',
'third' => "a single quote ' must be escaped.",
'span' => "this contains six spaces\nand one line break",
'is same as' => "this contains six spaces\nand one line break"
- ]
+ )
---
test: Double quotes
todo: true
@@ -1335,14 +1335,14 @@ yaml: |
spaces"
is equal to: "this contains four spaces"
php: |
- [
+ array(
'empty' => '',
'second' => '! : etc. can be used freely.',
'third' => 'a " or a \\ must be escaped.',
'fourth' => "this value ends with an LF.\n",
'span' => "this contains four spaces",
'is equal to' => "this contains four spaces"
- ]
+ )
---
test: Unquoted strings
todo: true
@@ -1371,7 +1371,7 @@ yaml: |
note: { one-line keys: but multi-line values }
php: |
- [
+ array(
'first' => 'There is no unquoted empty string.',
'second' => 12,
'third' => '12',
@@ -1379,7 +1379,7 @@ php: |
'indicators' => "this has no comments. #:foo and bar# are both text.",
'flow' => [ 'can span lines', 'like this' ],
'note' => { 'one-line keys' => 'but multi-line values' }
- ]
+ )
---
test: Spanning sequences
todo: true
@@ -1393,11 +1393,11 @@ yaml: |
- one
- two
php: |
- [
+ array(
'flow' => [ 'one', 'two' ],
'spanning' => [ 'one', 'two' ],
'block' => [ 'one', 'two' ]
- ]
+ )
---
test: Flow mappings
yaml: |
@@ -1408,10 +1408,10 @@ yaml: |
one: 1
two: 2
php: |
- [
- 'flow' => [ 'one' => 1, 'two' => 2 ],
- 'block' => [ 'one' => 1, 'two' => 2 ]
- ]
+ array(
+ 'flow' => array( 'one' => 1, 'two' => 2 ),
+ 'block' => array( 'one' => 1, 'two' => 2 )
+ )
---
test: Representations of 12
todo: true
@@ -1433,7 +1433,7 @@ yaml: |
- foo/bar
- /a.*b/
php: |
- [ 12, '12', '12', '12', '12', '/foo/bar', 'd:/foo/bar', 'foo/bar', '/a.*b/' ]
+ array( 12, '12', '12', '12', '12', '/foo/bar', 'd:/foo/bar', 'foo/bar', '/a.*b/' )
---
test: "Null"
todo: true
@@ -1455,12 +1455,12 @@ yaml: |
only two with values.
php: |
- [
+ array (
'canonical' => null,
'english' => null,
- 'sparse' => [ null, '2nd entry', null, '4th entry', null ]],
+ 'sparse' => array( null, '2nd entry', null, '4th entry', null ]),
'four' => 'This mapping has five keys, only two with values.'
- ]
+ )
---
test: Omap
todo: true
@@ -1525,29 +1525,29 @@ yaml: |
octal: 014
hexadecimal: 0xC
php: |
- [
+ array(
'canonical' => 12345,
'octal' => 12,
'hexadecimal' => 12
- ]
+ )
---
test: Decimal
deprecated: true
yaml: |
decimal: +12,345
php: |
- [
+ array(
'decimal' => 12345.0,
- ]
+ )
---
test: Fixed Float
deprecated: true
yaml: |
fixed: 1,230.15
php: |
- [
+ array(
'fixed' => 1230.15,
- ]
+ )
---
test: Float
yaml: |
@@ -1556,12 +1556,12 @@ yaml: |
negative infinity: -.inf
not a number: .NaN
php: |
- [
+ array(
'canonical' => 1230.15,
'exponential' => 1230.15,
'negative infinity' => log(0),
'not a number' => -log(0)
- ]
+ )
---
test: Timestamp
todo: true
@@ -1571,12 +1571,12 @@ yaml: |
space separated: 2001-12-14 21:59:43.10 -05:00
date (noon UTC): 2002-12-14
ruby: |
- [
+ array(
'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),
'valid iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'space separated' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'date (noon UTC)' => Date.new( 2002, 12, 14 )
- ]
+ )
---
test: Binary
todo: true
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml
index e96b5536..dea0be01 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml
@@ -25,14 +25,14 @@ yaml: |
- No, I mean, "And what about Yaml?"
- Oh, oh yeah. Uh.. Yaml for Ruby.
php: |
- [
+ array(
"What's Yaml?",
"It's for writing data structures in plain text.",
"And?",
"And what? That's not good enough for you?",
"No, I mean, \"And what about Yaml?\"",
"Oh, oh yeah. Uh.. Yaml for Ruby."
- ]
+ )
---
test: Indicators in Strings
brief: >
@@ -43,11 +43,11 @@ yaml: |
same for the pound sign: here we have it#in a string
the comma can, honestly, be used in most cases: [ but not in, inline collections ]
php: |
- [
+ array(
'the colon followed by space is an indicator' => 'but is a string:right here',
'same for the pound sign' => 'here we have it#in a string',
- 'the comma can, honestly, be used in most cases' => ['but not in', 'inline collections']
- ]
+ 'the comma can, honestly, be used in most cases' => array('but not in', 'inline collections')
+ )
---
test: Forcing Strings
brief: >
@@ -57,10 +57,10 @@ yaml: |
date string: !!str 2001-08-01
number string: !!str 192
php: |
- [
+ array(
'date string' => '2001-08-01',
'number string' => '192'
- ]
+ )
---
test: Single-quoted Strings
brief: >
@@ -75,12 +75,12 @@ yaml: |
why do i hate them?: 'it''s very hard to explain'
entities: '£ me'
php: |
- [
+ array(
'all my favorite symbols' => '#:!/%.)',
'a few i hate' => '&(*',
'why do i hate them?' => 'it\'s very hard to explain',
'entities' => '£ me'
- ]
+ )
---
test: Double-quoted Strings
brief: >
@@ -90,9 +90,9 @@ brief: >
yaml: |
i know where i want my line breaks: "one here\nand another here\n"
php: |
- [
+ array(
'i know where i want my line breaks' => "one here\nand another here\n"
- ]
+ )
---
test: Multi-line Quoted Strings
todo: true
@@ -106,10 +106,10 @@ yaml: |
let it go on and on to other lines
until i end it with a quote."
php: |
- ['i want a long string' => "so i'm going to ".
+ array('i want a long string' => "so i'm going to ".
"let it go on and on to other lines ".
"until i end it with a quote."
- ]
+ )
---
test: Plain scalars
@@ -128,7 +128,7 @@ yaml: |
- This would impair my skiing ability somewhat for the
duration, as can be imagined.
php: |
- [
+ array(
"My little toe is broken in two places;",
"I'm crazy to have skied this way;",
"I'm not the craziest he's seen, since there was always ".
@@ -139,7 +139,7 @@ php: |
"He's going to put my foot in plaster for a month;",
"This would impair my skiing ability somewhat for the duration, ".
"as can be imagined."
- ]
+ )
---
test: 'Null'
brief: >
@@ -149,11 +149,11 @@ yaml: |
hosted by: Bob and David
date of next season: ~
php: |
- [
+ array(
'name' => 'Mr. Show',
'hosted by' => 'Bob and David',
'date of next season' => null
- ]
+ )
---
test: Boolean
brief: >
@@ -162,10 +162,10 @@ yaml: |
Is Gus a Liar?: true
Do I rely on Gus for Sustenance?: false
php: |
- [
+ array(
'Is Gus a Liar?' => true,
'Do I rely on Gus for Sustenance?' => false
- ]
+ )
---
test: Integers
dump_skip: true
@@ -177,10 +177,10 @@ yaml: |
zero: 0
simple: 12
php: |
- [
+ array(
'zero' => 0,
'simple' => 12,
- ]
+ )
---
test: Positive Big Integer
deprecated: true
@@ -192,9 +192,9 @@ brief: >
yaml: |
one-thousand: 1,000
php: |
- [
+ array(
'one-thousand' => 1000.0,
- ]
+ )
---
test: Negative Big Integer
deprecated: true
@@ -206,9 +206,9 @@ brief: >
yaml: |
negative one-thousand: -1,000
php: |
- [
+ array(
'negative one-thousand' => -1000.0
- ]
+ )
---
test: Floats
dump_skip: true
@@ -220,10 +220,10 @@ yaml: |
a simple float: 2.00
scientific notation: 1.00009e+3
php: |
- [
+ array(
'a simple float' => 2.0,
'scientific notation' => 1000.09
- ]
+ )
---
test: Larger Float
dump_skip: true
@@ -235,9 +235,9 @@ brief: >
yaml: |
larger float: 1,000.09
php: |
- [
+ array(
'larger float' => 1000.09,
- ]
+ )
---
test: Time
todo: true
@@ -250,10 +250,10 @@ yaml: |
iso8601: 2001-12-14t21:59:43.10-05:00
space separated: 2001-12-14 21:59:43.10 -05:00
php: |
- [
+ array(
'iso8601' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
'space separated' => mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" )
- ]
+ )
---
test: Date
todo: true
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml
index 88287f1b..26799e8e 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml
@@ -5,7 +5,7 @@ yaml: |
true: true
false: false
php: |
- [
+ array(
'true' => true,
'false' => false,
- ]
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml
index 87d352db..6ca044c8 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml
@@ -4,7 +4,7 @@ yaml: |
php: |
"\\0 \\ \\a \\b \\n"
---
-test: 'null'
+test: null
yaml: |
"\0"
php: |
@@ -142,14 +142,14 @@ test: Double quotes with a line feed
yaml: |
{ double: "some value\n \"some quoted string\" and 'some single quotes one'" }
php: |
- [
+ array(
'double' => "some value\n \"some quoted string\" and 'some single quotes one'"
- ]
+ )
---
test: Backslashes
yaml: |
{ single: 'foo\Var', no-quotes: foo\Var, double: "foo\\Var" }
php: |
- [
+ array(
'single' => 'foo\Var', 'no-quotes' => 'foo\Var', 'double' => 'foo\Var'
- ]
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/legacyBooleanMappingKeys.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/legacyBooleanMappingKeys.yml
index db950165..5e8d0917 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/legacyBooleanMappingKeys.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/legacyBooleanMappingKeys.yml
@@ -5,10 +5,10 @@ yaml: |
true: true
false: false
php: |
- [
+ array(
1 => true,
0 => false,
- ]
+ )
---
test: Boolean
yaml: |
@@ -16,8 +16,8 @@ yaml: |
logical: true
answer: false
php: |
- [
+ array(
false => 'used as key',
'logical' => true,
'answer' => false
- ]
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/legacyNullMappingKey.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/legacyNullMappingKey.yml
index 14f93c2d..551a6205 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/legacyNullMappingKey.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/legacyNullMappingKey.yml
@@ -4,6 +4,6 @@ spec: 2.21
yaml: |
null: ~
php: |
- [
+ array(
'' => null,
- ]
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml
index 9d72f09b..b4903d30 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml
@@ -10,5 +10,4 @@ data:
empty line:
baz
- multi_line_with_carriage_return: "foo\nbar\r\nbaz"
nested_inlined_multi_line_string: { inlined_multi_line: "foo\nbar\r\nempty line:\n\nbaz" }
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block_for_tagged_values.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block_for_tagged_values.yml
deleted file mode 100644
index f8c9112f..00000000
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block_for_tagged_values.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-data:
- foo: !bar "foo\r\nline with trailing spaces:\n \nbar\ninteger like line:\n123456789\nempty line:\n\nbaz"
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml
deleted file mode 100644
index 3f2dedd1..00000000
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-data:
- multi_line: |4
- the first line has leading spaces
- The second line does not.
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml
index cd90f7b4..7dcadc72 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml
@@ -4,6 +4,6 @@ spec: 2.21
yaml: |
null: ~
php: |
- [
+ array(
'null' => null,
- ]
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml
index 246447e4..9cfb7713 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml
@@ -6,7 +6,7 @@ yaml: |
1: foo
0: bar
php: |
- [1 => 'foo', 0 => 'bar']
+ array(1 => 'foo', 0 => 'bar')
---
test: Integers as Map Keys
brief: >
@@ -16,8 +16,8 @@ yaml: |
2: two
3: three
php: |
- [
+ array(
1 => 'one',
2 => 'two',
3 => 'three'
- ]
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfComments.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfComments.yml
index 4b0c91c9..b72a9b69 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfComments.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfComments.yml
@@ -11,7 +11,7 @@ yaml: |
ex6: foo#foo # comment here
ex7: foo # ignore me # and me
php: |
- ['ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo', 'ex5' => 'foo', 'ex6' => 'foo#foo', 'ex7' => 'foo']
+ array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo', 'ex5' => 'foo', 'ex6' => 'foo#foo', 'ex7' => 'foo')
---
test: Comments in the middle
brief: >
@@ -24,7 +24,7 @@ yaml: |
# some comment
# some comment
php: |
- ['foo' => ['bar' => 'foo']]
+ array('foo' => array('bar' => 'foo'))
---
test: Comments on a hash line
brief: >
@@ -33,7 +33,7 @@ yaml: |
foo: # a comment
foo: bar # a comment
php: |
- ['foo' => ['foo' => 'bar']]
+ array('foo' => array('foo' => 'bar'))
---
test: 'Value starting with a #'
brief: >
@@ -41,7 +41,7 @@ brief: >
yaml: |
foo: '#bar'
php: |
- ['foo' => '#bar']
+ array('foo' => '#bar')
---
test: Document starting with a comment and a separator
brief: >
@@ -51,7 +51,7 @@ yaml: |
---
foo: bar # a comment
php: |
- ['foo' => 'bar']
+ array('foo' => 'bar')
---
test: Comment containing a colon on a hash line
brief: >
@@ -65,7 +65,7 @@ brief: >
'Hash key containing a #'
yaml: 'foo#bar: baz'
php: |
- ['foo#bar' => 'baz']
+ array('foo#bar' => 'baz')
---
test: 'Hash key ending with a space and a #'
brief: >
@@ -73,18 +73,4 @@ brief: >
yaml: |
'foo #': baz
php: |
- ['foo #' => 'baz']
----
-test: Comment before first item in unindented collection
-brief: >
- Comment directly before unindented collection is allowed
-yaml: |
- collection1:
- # comment
- - a
- - b
- collection2:
- - a
- - b
-php: |
- ['collection1' => ['a', 'b'], 'collection2' => ['a', 'b']]
+ array('foo #' => 'baz')
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml
index 8cadae2c..1339d23a 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml
@@ -13,22 +13,22 @@ yaml: |
nick: Biggies
quantity: 1
php: |
- [
- [
+ array (
+ array (
'item' => 'Super Hoop',
- ],
- [
+ ),
+ array (
'item' => 'Basketball',
'quantity' => 1,
- ],
- [
- 'item' => [
+ ),
+ array (
+ 'item' => array(
'name' => 'Big Shoes',
'nick' => 'Biggies'
- ],
+ ),
'quantity' => 1
- ]
- ]
+ )
+ )
---
test: Compact notation combined with inline notation
brief: |
@@ -39,18 +39,18 @@ yaml: |
- { item: Super Hoop, quantity: 1 }
- [ Basketball, Big Shoes ]
php: |
- [
- 'items' => [
- [
+ array (
+ 'items' => array (
+ array (
'item' => 'Super Hoop',
'quantity' => 1,
- ],
- [
+ ),
+ array (
'Basketball',
'Big Shoes'
- ]
- ]
- ]
+ )
+ )
+ )
--- %YAML:1.0
test: Compact notation
brief: |
@@ -66,22 +66,22 @@ yaml: |
nick: Biggies
quantity: 1
php: |
- [
- [
+ array (
+ array (
'item' => 'Super Hoop',
- ],
- [
+ ),
+ array (
'item' => 'Basketball',
'quantity' => 1,
- ],
- [
- 'item' => [
+ ),
+ array (
+ 'item' => array(
'name' => 'Big Shoes',
'nick' => 'Biggies'
- ],
+ ),
'quantity' => 1
- ]
- ]
+ )
+ )
---
test: Compact notation combined with inline notation
brief: |
@@ -92,18 +92,18 @@ yaml: |
- { item: Super Hoop, quantity: 1 }
- [ Basketball, Big Shoes ]
php: |
- [
- 'items' => [
- [
+ array (
+ 'items' => array (
+ array (
'item' => 'Super Hoop',
'quantity' => 1,
- ],
- [
+ ),
+ array (
'Basketball',
'Big Shoes'
- ]
- ]
- ]
+ )
+ )
+ )
--- %YAML:1.0
test: Compact notation
brief: |
@@ -119,22 +119,22 @@ yaml: |
nick: Biggies
quantity: 1
php: |
- [
- [
+ array (
+ array (
'item' => 'Super Hoop',
- ],
- [
+ ),
+ array (
'item' => 'Basketball',
'quantity' => 1,
- ],
- [
- 'item' => [
+ ),
+ array (
+ 'item' => array(
'name' => 'Big Shoes',
'nick' => 'Biggies'
- ],
+ ),
'quantity' => 1
- ]
- ]
+ )
+ )
---
test: Compact notation combined with inline notation
brief: |
@@ -145,15 +145,15 @@ yaml: |
- { item: Super Hoop, quantity: 1 }
- [ Basketball, Big Shoes ]
php: |
- [
- 'items' => [
- [
+ array (
+ 'items' => array (
+ array (
'item' => 'Super Hoop',
'quantity' => 1,
- ],
- [
+ ),
+ array (
'Basketball',
'Big Shoes'
- ]
- ]
- ]
+ )
+ )
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml
index af787ae4..83264cfa 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml
@@ -46,16 +46,16 @@ yaml: |
head_inline: &head_inline { <<: [ *foo , *dong , *foo2 ] }
recursive_inline: { <<: *head_inline, c: { <<: *foo2 } }
php: |
- [
- 'foo' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'],
- 'bar' => ['a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'x' => 'Oren'],
- 'bar_inline' => ['a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => ['foo' => 'bar', 'bar' => 'foo'], 'e' => 'notnull', 'x' => 'Oren'],
- 'foo2' => ['a' => 'Ballmer'],
- 'ding' => ['fi', 'fei', 'fo', 'fam'],
- 'check' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'],
- 'head' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
- 'taz' => ['a' => 'Steve', 'w' => ['p' => 1234]],
- 'nested' => ['a' => 'Steve', 'w' => ['p' => 12345], 'd' => 'Doug', 'z' => ['p' => 12345]],
- 'head_inline' => ['a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
- 'recursive_inline' => ['a' => 'Steve', 'b' => 'Clark', 'c' => ['a' => 'Ballmer'], 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'],
- ]
+ array(
+ 'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'),
+ 'bar' => array('a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'),
+ 'bar_inline' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'e' => 'notnull', 'x' => 'Oren'),
+ 'foo2' => array('a' => 'Ballmer'),
+ 'ding' => array('fi', 'fei', 'fo', 'fam'),
+ 'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'),
+ 'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
+ 'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)),
+ 'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345)),
+ 'head_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
+ 'recursive_inline' => array('a' => 'Steve', 'b' => 'Clark', 'c' => array('a' => 'Ballmer'), 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml
index 144615f2..ee124b24 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml
@@ -8,4 +8,4 @@ yaml: |
ex3: 'foo # bar' # comment
ex4: foo # comment
php: |
- ['ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo']
+ array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo')
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml
index c8326fdb..7c60baec 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml
@@ -5,7 +5,7 @@ brief: >
yaml: |
foo: '| bar'
php: |
- ['foo' => '| bar']
+ array('foo' => '| bar')
---
test: A key can be a quoted string
brief: >
@@ -19,15 +19,15 @@ yaml: |
"foo4: ": bar
foo5: { "foo \" bar: ": bar, 'foo '' bar: ': bar }
php: |
- [
+ array(
'foo1' => 'bar',
'foo2' => 'bar',
'foo " bar' => 'bar',
'foo \' bar' => 'bar',
'foo3: ' => 'bar',
'foo4: ' => 'bar',
- 'foo5' => [
+ 'foo5' => array(
'foo " bar: ' => 'bar',
'foo \' bar: ' => 'bar',
- ],
- ]
+ ),
+ )
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfTests.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfTests.yml
index 2ea417a7..2a0b9c87 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfTests.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/sfTests.yml
@@ -5,19 +5,19 @@ brief: >
yaml: |
stripped_title: { name: "foo bar", help: "bar foo" }
php: |
- ['stripped_title' => ['name' => 'foo bar', 'help' => 'bar foo']]
+ array('stripped_title' => array('name' => 'foo bar', 'help' => 'bar foo'))
---
test: Empty sequence
yaml: |
foo: [ ]
php: |
- ['foo' => []]
+ array('foo' => array())
---
test: Empty value
yaml: |
foo:
php: |
- ['foo' => null]
+ array('foo' => null)
---
test: Inline string parsing
brief: >
@@ -25,7 +25,7 @@ brief: >
yaml: |
test: ['complex: string', 'another [string]']
php: |
- ['test' => ['complex: string', 'another [string]']]
+ array('test' => array('complex: string', 'another [string]'))
---
test: Boolean
brief: >
@@ -40,7 +40,7 @@ yaml: |
- 'null'
- '~'
php: |
- [
+ array(
false,
true,
null,
@@ -49,7 +49,7 @@ php: |
'true',
'null',
'~',
- ]
+ )
---
test: Empty lines in literal blocks
brief: >
@@ -63,7 +63,7 @@ yaml: |
bar
php: |
- ['foo' => ['bar' => "foo\n\n\n \nbar\n"]]
+ array('foo' => array('bar' => "foo\n\n\n \nbar\n"))
---
test: Empty lines in folded blocks
brief: >
@@ -77,7 +77,7 @@ yaml: |
bar
php: |
- ['foo' => ['bar' => "\nfoo\n\nbar\n"]]
+ array('foo' => array('bar' => "\nfoo\n\nbar\n"))
---
test: IP addresses
brief: >
@@ -85,7 +85,7 @@ brief: >
yaml: |
foo: 10.0.0.2
php: |
- ['foo' => '10.0.0.2']
+ array('foo' => '10.0.0.2')
---
test: A sequence with an embedded mapping
brief: >
@@ -94,28 +94,28 @@ yaml: |
- foo
- bar: { bar: foo }
php: |
- ['foo', ['bar' => ['bar' => 'foo']]]
+ array('foo', array('bar' => array('bar' => 'foo')))
---
test: Octal
brief: as in spec example 2.19, octal value is converted
yaml: |
foo: 0123
php: |
- ['foo' => 83]
+ array('foo' => 83)
---
test: Octal strings
brief: Octal notation in a string must remain a string
yaml: |
foo: "0123"
php: |
- ['foo' => '0123']
+ array('foo' => '0123')
---
test: Octal strings
brief: Octal notation in a string must remain a string
yaml: |
foo: '0123'
php: |
- ['foo' => '0123']
+ array('foo' => '0123')
---
test: Octal strings
brief: Octal notation in a string must remain a string
@@ -123,18 +123,18 @@ yaml: |
foo: |
0123
php: |
- ['foo' => "0123\n"]
+ array('foo' => "0123\n")
---
test: Document as a simple hash
brief: Document as a simple hash
yaml: |
{ foo: bar }
php: |
- ['foo' => 'bar']
+ array('foo' => 'bar')
---
test: Document as a simple array
brief: Document as a simple array
yaml: |
[ foo, bar ]
php: |
- ['foo', 'bar']
+ array('foo', 'bar')
diff --git a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml
index c85952df..0c96108e 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml
+++ b/inc.lib/vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml
@@ -8,7 +8,7 @@ yaml: |
- item2
- item3
php: |
- ['collection' => ['item1', 'item2', 'item3']]
+ array('collection' => array('item1', 'item2', 'item3'))
---
test: Nested unindented collection (two levels)
brief: >
@@ -20,7 +20,7 @@ yaml: |
- b
- c
php: |
- ['collection' => ['key' => ['a', 'b', 'c']]]
+ array('collection' => array('key' => array('a', 'b', 'c')))
---
test: Nested unindented collection (three levels)
brief: >
@@ -33,7 +33,7 @@ yaml: |
- two
- three
php: |
- ['collection' => ['key' => ['subkey' => ['one', 'two', 'three']]]]
+ array('collection' => array('key' => array('subkey' => array('one', 'two', 'three'))))
---
test: Key/value after unindented collection (1)
brief: >
@@ -46,7 +46,7 @@ yaml: |
- c
foo: bar
php: |
- ['collection' => ['key' => ['a', 'b', 'c']], 'foo' => 'bar']
+ array('collection' => array('key' => array('a', 'b', 'c')), 'foo' => 'bar')
---
test: Key/value after unindented collection (at the same level)
brief: >
@@ -59,7 +59,7 @@ yaml: |
- c
foo: bar
php: |
- ['collection' => ['key' => ['a', 'b', 'c'], 'foo' => 'bar']]
+ array('collection' => array('key' => array('a', 'b', 'c'), 'foo' => 'bar'))
---
test: Shortcut Key after unindented collection
brief: >
@@ -69,7 +69,7 @@ yaml: |
- key: foo
foo: bar
php: |
- ['collection' => [['key' => 'foo', 'foo' => 'bar']]]
+ array('collection' => array(array('key' => 'foo', 'foo' => 'bar')))
---
test: Shortcut Key after unindented collection with custom spaces
brief: >
@@ -79,4 +79,4 @@ yaml: |
- key: foo
foo: bar
php: |
- ['collection' => [['key' => 'foo', 'foo' => 'bar']]]
+ array('collection' => array(array('key' => 'foo', 'foo' => 'bar')))
diff --git a/inc.lib/vendor/symfony/yaml/Tests/InlineTest.php b/inc.lib/vendor/symfony/yaml/Tests/InlineTest.php
index f64cc682..815c694b 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/InlineTest.php
+++ b/inc.lib/vendor/symfony/yaml/Tests/InlineTest.php
@@ -53,50 +53,39 @@ public function testParsePhpConstants($yaml, $value)
public function getTestsForParsePhpConstants()
{
- return [
- ['!php/const Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT],
- ['!php/const PHP_INT_MAX', \PHP_INT_MAX],
- ['[!php/const PHP_INT_MAX]', [\PHP_INT_MAX]],
- ['{ foo: !php/const PHP_INT_MAX }', ['foo' => \PHP_INT_MAX]],
- ['{ !php/const PHP_INT_MAX: foo }', [\PHP_INT_MAX => 'foo']],
- ['!php/const NULL', null],
- ];
+ return array(
+ array('!php/const Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT),
+ array('!php/const PHP_INT_MAX', PHP_INT_MAX),
+ array('[!php/const PHP_INT_MAX]', array(PHP_INT_MAX)),
+ array('{ foo: !php/const PHP_INT_MAX }', array('foo' => PHP_INT_MAX)),
+ );
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage The constant "WRONG_CONSTANT" is not defined
+ */
public function testParsePhpConstantThrowsExceptionWhenUndefined()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('The constant "WRONG_CONSTANT" is not defined');
Inline::parse('!php/const WRONG_CONSTANT', Yaml::PARSE_CONSTANT);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessageRegExp #The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#
+ */
public function testParsePhpConstantThrowsExceptionOnInvalidType()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessageMatches('#The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#');
Inline::parse('!php/const PHP_INT_MAX', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
}
/**
* @group legacy
- * @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 1.
- * @dataProvider getTestsForParseLegacyPhpConstants
+ * @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since version 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 1.
*/
- public function testDeprecatedConstantTag($yaml, $expectedValue)
- {
- $this->assertSame($expectedValue, Inline::parse($yaml, Yaml::PARSE_CONSTANT));
- }
-
- public function getTestsForParseLegacyPhpConstants()
+ public function testDeprecatedConstantTag()
{
- return [
- ['!php/const:Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT],
- ['!php/const:PHP_INT_MAX', \PHP_INT_MAX],
- ['[!php/const:PHP_INT_MAX]', [\PHP_INT_MAX]],
- ['{ foo: !php/const:PHP_INT_MAX }', ['foo' => \PHP_INT_MAX]],
- ['{ !php/const:PHP_INT_MAX: foo }', [\PHP_INT_MAX => 'foo']],
- ['!php/const:NULL', null],
- ];
+ Inline::parse('!php/const:PHP_INT_MAX', Yaml::PARSE_CONSTANT);
}
/**
@@ -122,21 +111,21 @@ public function testDump($yaml, $value, $parseFlags = 0)
public function testDumpNumericValueWithLocale()
{
- $locale = setlocale(\LC_NUMERIC, 0);
+ $locale = setlocale(LC_NUMERIC, 0);
if (false === $locale) {
$this->markTestSkipped('Your platform does not support locales.');
}
try {
- $requiredLocales = ['fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'];
- if (false === setlocale(\LC_NUMERIC, $requiredLocales)) {
+ $requiredLocales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
+ if (false === setlocale(LC_NUMERIC, $requiredLocales)) {
$this->markTestSkipped('Could not set any of required locales: '.implode(', ', $requiredLocales));
}
$this->assertEquals('1.2', Inline::dump(1.2));
- $this->assertStringContainsStringIgnoringCase('fr', setlocale(\LC_NUMERIC, 0));
+ $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0)));
} finally {
- setlocale(\LC_NUMERIC, $locale);
+ setlocale(LC_NUMERIC, $locale);
}
}
@@ -147,43 +136,53 @@ public function testHashStringsResemblingExponentialNumericsShouldNotBeChangedTo
$this->assertSame($value, Inline::parse(Inline::dump($value)));
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage Found unknown escape character "\V".
+ */
public function testParseScalarWithNonEscapedBlackslashShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('Found unknown escape character "\V".');
Inline::parse('"Foo\Var"');
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ */
public function testParseScalarWithNonEscapedBlackslashAtTheEndShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Inline::parse('"Foo\\"');
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ */
public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$value = "'don't do somthin' like that'";
Inline::parse($value);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ */
public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$value = '"don"t do somthin" like that"';
Inline::parse($value);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ */
public function testParseInvalidMappingKeyShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$value = '{ "foo " bar": "bar" }';
Inline::parse($value);
}
/**
* @group legacy
- * @expectedDeprecation Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since Symfony 3.2 and will throw a ParseException in 4.0 on line 1.
+ * @expectedDeprecation Using a colon after an unquoted mapping key that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}") is deprecated since version 3.2 and will throw a ParseException in 4.0 on line 1.
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
*/
public function testParseMappingKeyWithColonNotFollowedBySpace()
@@ -191,24 +190,22 @@ public function testParseMappingKeyWithColonNotFollowedBySpace()
Inline::parse('{1:""}');
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ */
public function testParseInvalidMappingShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Inline::parse('[foo] bar');
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ */
public function testParseInvalidSequenceShouldThrowException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Inline::parse('{ foo: bar } bar');
}
- public function testParseInvalidTaggedSequenceShouldThrowException()
- {
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- Inline::parse('!foo { bar: baz } qux', Yaml::PARSE_CUSTOM_TAGS);
- }
-
public function testParseScalarWithCorrectlyQuotedStringShouldReturnString()
{
$value = "'don''t do somthin'' like that'";
@@ -222,7 +219,7 @@ public function testParseScalarWithCorrectlyQuotedStringShouldReturnString()
*/
public function testParseReferences($yaml, $expected)
{
- $this->assertSame($expected, Inline::parse($yaml, 0, ['var' => 'var-value']));
+ $this->assertSame($expected, Inline::parse($yaml, 0, array('var' => 'var-value')));
}
/**
@@ -231,31 +228,31 @@ public function testParseReferences($yaml, $expected)
*/
public function testParseReferencesAsFifthArgument($yaml, $expected)
{
- $this->assertSame($expected, Inline::parse($yaml, false, false, false, ['var' => 'var-value']));
+ $this->assertSame($expected, Inline::parse($yaml, false, false, false, array('var' => 'var-value')));
}
public function getDataForParseReferences()
{
- return [
- 'scalar' => ['*var', 'var-value'],
- 'list' => ['[ *var ]', ['var-value']],
- 'list-in-list' => ['[[ *var ]]', [['var-value']]],
- 'map-in-list' => ['[ { key: *var } ]', [['key' => 'var-value']]],
- 'embedded-mapping-in-list' => ['[ key: *var ]', [['key' => 'var-value']]],
- 'map' => ['{ key: *var }', ['key' => 'var-value']],
- 'list-in-map' => ['{ key: [*var] }', ['key' => ['var-value']]],
- 'map-in-map' => ['{ foo: { bar: *var } }', ['foo' => ['bar' => 'var-value']]],
- ];
+ return array(
+ 'scalar' => array('*var', 'var-value'),
+ 'list' => array('[ *var ]', array('var-value')),
+ 'list-in-list' => array('[[ *var ]]', array(array('var-value'))),
+ 'map-in-list' => array('[ { key: *var } ]', array(array('key' => 'var-value'))),
+ 'embedded-mapping-in-list' => array('[ key: *var ]', array(array('key' => 'var-value'))),
+ 'map' => array('{ key: *var }', array('key' => 'var-value')),
+ 'list-in-map' => array('{ key: [*var] }', array('key' => array('var-value'))),
+ 'map-in-map' => array('{ foo: { bar: *var } }', array('foo' => array('bar' => 'var-value'))),
+ );
}
public function testParseMapReferenceInSequence()
{
- $foo = [
+ $foo = array(
'a' => 'Steve',
'b' => 'Clark',
'c' => 'Brian',
- ];
- $this->assertSame([$foo], Inline::parse('[*foo]', 0, ['foo' => $foo]));
+ );
+ $this->assertSame(array($foo), Inline::parse('[*foo]', 0, array('foo' => $foo)));
}
/**
@@ -263,25 +260,29 @@ public function testParseMapReferenceInSequence()
*/
public function testParseMapReferenceInSequenceAsFifthArgument()
{
- $foo = [
+ $foo = array(
'a' => 'Steve',
'b' => 'Clark',
'c' => 'Brian',
- ];
- $this->assertSame([$foo], Inline::parse('[*foo]', false, false, false, ['foo' => $foo]));
+ );
+ $this->assertSame(array($foo), Inline::parse('[*foo]', false, false, false, array('foo' => $foo)));
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage A reference must contain at least one character at line 1.
+ */
public function testParseUnquotedAsterisk()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('A reference must contain at least one character at line 1.');
Inline::parse('{ foo: * }');
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage A reference must contain at least one character at line 1.
+ */
public function testParseUnquotedAsteriskFollowedByAComment()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('A reference must contain at least one character at line 1.');
Inline::parse('{ foo: * #foo }');
}
@@ -290,15 +291,19 @@ public function testParseUnquotedAsteriskFollowedByAComment()
*/
public function testParseUnquotedScalarStartingWithReservedIndicator($indicator)
{
- $this->expectException(ParseException::class);
- $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
+ if (method_exists($this, 'expectExceptionMessage')) {
+ $this->expectException(ParseException::class);
+ $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
+ } else {
+ $this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
+ }
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
}
public function getReservedIndicators()
{
- return [['@'], ['`']];
+ return array(array('@'), array('`'));
}
/**
@@ -306,15 +311,19 @@ public function getReservedIndicators()
*/
public function testParseUnquotedScalarStartingWithScalarIndicator($indicator)
{
- $this->expectException(ParseException::class);
- $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
+ if (method_exists($this, 'expectExceptionMessage')) {
+ $this->expectException(ParseException::class);
+ $this->expectExceptionMessage(sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
+ } else {
+ $this->setExpectedException(ParseException::class, sprintf('cannot start a plain scalar; you need to quote the scalar at line 1 (near "%sfoo ").', $indicator));
+ }
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
}
public function getScalarIndicators()
{
- return [['|'], ['>']];
+ return array(array('|'), array('>'));
}
/**
@@ -337,248 +346,240 @@ public function testIsHash($array, $expected)
public function getDataForIsHash()
{
- return [
- [[], false],
- [[1, 2, 3], false],
- [[2 => 1, 1 => 2, 0 => 3], true],
- [['foo' => 1, 'bar' => 2], true],
- ];
+ return array(
+ array(array(), false),
+ array(array(1, 2, 3), false),
+ array(array(2 => 1, 1 => 2, 0 => 3), true),
+ array(array('foo' => 1, 'bar' => 2), true),
+ );
}
public function getTestsForParse()
{
- return [
- ['', ''],
- ['null', null],
- ['false', false],
- ['true', true],
- ['12', 12],
- ['-12', -12],
- ['1_2', 12],
- ['_12', '_12'],
- ['12_', 12],
- ['"quoted string"', 'quoted string'],
- ["'quoted string'", 'quoted string'],
- ['12.30e+02', 12.30e+02],
- ['123.45_67', 123.4567],
- ['0x4D2', 0x4D2],
- ['0x_4_D_2_', 0x4D2],
- ['02333', 02333],
- ['0_2_3_3_3', 02333],
- ['.Inf', -log(0)],
- ['-.Inf', log(0)],
- ["'686e444'", '686e444'],
- ['686e444', 646e444],
- ['123456789123456789123456789123456789', '123456789123456789123456789123456789'],
- ['"foo\r\nbar"', "foo\r\nbar"],
- ["'foo#bar'", 'foo#bar'],
- ["'foo # bar'", 'foo # bar'],
- ["'#cfcfcf'", '#cfcfcf'],
- ['::form_base.html.twig', '::form_base.html.twig'],
+ return array(
+ array('', ''),
+ array('null', null),
+ array('false', false),
+ array('true', true),
+ array('12', 12),
+ array('-12', -12),
+ array('1_2', 12),
+ array('_12', '_12'),
+ array('12_', 12),
+ array('"quoted string"', 'quoted string'),
+ array("'quoted string'", 'quoted string'),
+ array('12.30e+02', 12.30e+02),
+ array('123.45_67', 123.4567),
+ array('0x4D2', 0x4D2),
+ array('0x_4_D_2_', 0x4D2),
+ array('02333', 02333),
+ array('0_2_3_3_3', 02333),
+ array('.Inf', -log(0)),
+ array('-.Inf', log(0)),
+ array("'686e444'", '686e444'),
+ array('686e444', 646e444),
+ array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
+ array('"foo\r\nbar"', "foo\r\nbar"),
+ array("'foo#bar'", 'foo#bar'),
+ array("'foo # bar'", 'foo # bar'),
+ array("'#cfcfcf'", '#cfcfcf'),
+ array('::form_base.html.twig', '::form_base.html.twig'),
// Pre-YAML-1.2 booleans
- ["'y'", 'y'],
- ["'n'", 'n'],
- ["'yes'", 'yes'],
- ["'no'", 'no'],
- ["'on'", 'on'],
- ["'off'", 'off'],
-
- ['2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)],
- ['2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)],
- ['2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)],
- ['1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)],
- ['1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)],
-
- ['"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''],
- ["'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''],
+ array("'y'", 'y'),
+ array("'n'", 'n'),
+ array("'yes'", 'yes'),
+ array("'no'", 'no'),
+ array("'on'", 'on'),
+ array("'off'", 'off'),
+
+ array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
+ array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
+ array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
+ array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
+ array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
+
+ array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
+ array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
// sequences
// urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
- ['[foo, http://urls.are/no/mappings, false, null, 12]', ['foo', 'http://urls.are/no/mappings', false, null, 12]],
- ['[ foo , bar , false , null , 12 ]', ['foo', 'bar', false, null, 12]],
- ['[\'foo,bar\', \'foo bar\']', ['foo,bar', 'foo bar']],
+ array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
+ array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),
+ array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
// mappings
- ['{foo: bar,bar: foo,"false": false, "null": null,integer: 12}', ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12]],
- ['{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12]],
- ['{foo: \'bar\', bar: \'foo: bar\'}', ['foo' => 'bar', 'bar' => 'foo: bar']],
- ['{\'foo\': \'bar\', "bar": \'foo: bar\'}', ['foo' => 'bar', 'bar' => 'foo: bar']],
- ['{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', ['foo\'' => 'bar', 'bar"' => 'foo: bar']],
- ['{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', ['foo: ' => 'bar', 'bar: ' => 'foo: bar']],
- ['{"foo:bar": "baz"}', ['foo:bar' => 'baz']],
- ['{"foo":"bar"}', ['foo' => 'bar']],
+ array('{foo: bar,bar: foo,"false": false, "null": null,integer: 12}', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
+ array('{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
+ array('{foo: \'bar\', bar: \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
+ array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
+ array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
+ array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
+ array('{"foo:bar": "baz"}', array('foo:bar' => 'baz')),
+ array('{"foo":"bar"}', array('foo' => 'bar')),
// nested sequences and mappings
- ['[foo, [bar, foo]]', ['foo', ['bar', 'foo']]],
- ['[foo, {bar: foo}]', ['foo', ['bar' => 'foo']]],
- ['{ foo: {bar: foo} }', ['foo' => ['bar' => 'foo']]],
- ['{ foo: [bar, foo] }', ['foo' => ['bar', 'foo']]],
- ['{ foo:{bar: foo} }', ['foo' => ['bar' => 'foo']]],
- ['{ foo:[bar, foo] }', ['foo' => ['bar', 'foo']]],
+ array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
+ array('[foo, {bar: foo}]', array('foo', array('bar' => 'foo'))),
+ array('{ foo: {bar: foo} }', array('foo' => array('bar' => 'foo'))),
+ array('{ foo: [bar, foo] }', array('foo' => array('bar', 'foo'))),
+ array('{ foo:{bar: foo} }', array('foo' => array('bar' => 'foo'))),
+ array('{ foo:[bar, foo] }', array('foo' => array('bar', 'foo'))),
- ['[ foo, [ bar, foo ] ]', ['foo', ['bar', 'foo']]],
+ array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),
- ['[{ foo: {bar: foo} }]', [['foo' => ['bar' => 'foo']]]],
+ array('[{ foo: {bar: foo} }]', array(array('foo' => array('bar' => 'foo')))),
- ['[foo, [bar, [foo, [bar, foo]], foo]]', ['foo', ['bar', ['foo', ['bar', 'foo']], 'foo']]],
+ array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
- ['[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', ['foo', ['bar' => 'foo', 'foo' => ['foo', ['bar' => 'foo']]], ['foo', ['bar' => 'foo']]]],
+ array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
- ['[foo, bar: { foo: bar }]', ['foo', '1' => ['bar' => ['foo' => 'bar']]]],
- ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']],
- ];
+ array('[foo, bar: { foo: bar }]', array('foo', '1' => array('bar' => array('foo' => 'bar')))),
+ array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
+ );
}
public function getTestsForParseWithMapObjects()
{
- return [
- ['', ''],
- ['null', null],
- ['false', false],
- ['true', true],
- ['12', 12],
- ['-12', -12],
- ['"quoted string"', 'quoted string'],
- ["'quoted string'", 'quoted string'],
- ['12.30e+02', 12.30e+02],
- ['0x4D2', 0x4D2],
- ['02333', 02333],
- ['.Inf', -log(0)],
- ['-.Inf', log(0)],
- ["'686e444'", '686e444'],
- ['686e444', 646e444],
- ['123456789123456789123456789123456789', '123456789123456789123456789123456789'],
- ['"foo\r\nbar"', "foo\r\nbar"],
- ["'foo#bar'", 'foo#bar'],
- ["'foo # bar'", 'foo # bar'],
- ["'#cfcfcf'", '#cfcfcf'],
- ['::form_base.html.twig', '::form_base.html.twig'],
-
- ['2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)],
- ['2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)],
- ['2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)],
- ['1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)],
- ['1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)],
-
- ['"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''],
- ["'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''],
+ return array(
+ array('', ''),
+ array('null', null),
+ array('false', false),
+ array('true', true),
+ array('12', 12),
+ array('-12', -12),
+ array('"quoted string"', 'quoted string'),
+ array("'quoted string'", 'quoted string'),
+ array('12.30e+02', 12.30e+02),
+ array('0x4D2', 0x4D2),
+ array('02333', 02333),
+ array('.Inf', -log(0)),
+ array('-.Inf', log(0)),
+ array("'686e444'", '686e444'),
+ array('686e444', 646e444),
+ array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
+ array('"foo\r\nbar"', "foo\r\nbar"),
+ array("'foo#bar'", 'foo#bar'),
+ array("'foo # bar'", 'foo # bar'),
+ array("'#cfcfcf'", '#cfcfcf'),
+ array('::form_base.html.twig', '::form_base.html.twig'),
+
+ array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
+ array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
+ array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
+ array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
+ array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
+
+ array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
+ array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
// sequences
// urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
- ['[foo, http://urls.are/no/mappings, false, null, 12]', ['foo', 'http://urls.are/no/mappings', false, null, 12]],
- ['[ foo , bar , false , null , 12 ]', ['foo', 'bar', false, null, 12]],
- ['[\'foo,bar\', \'foo bar\']', ['foo,bar', 'foo bar']],
+ array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
+ array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),
+ array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
// mappings
- ['{foo: bar,bar: foo,"false": false,"null": null,integer: 12}', (object) ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12], Yaml::PARSE_OBJECT_FOR_MAP],
- ['{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', (object) ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12], Yaml::PARSE_OBJECT_FOR_MAP],
- ['{foo: \'bar\', bar: \'foo: bar\'}', (object) ['foo' => 'bar', 'bar' => 'foo: bar']],
- ['{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) ['foo' => 'bar', 'bar' => 'foo: bar']],
- ['{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) ['foo\'' => 'bar', 'bar"' => 'foo: bar']],
- ['{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) ['foo: ' => 'bar', 'bar: ' => 'foo: bar']],
- ['{"foo:bar": "baz"}', (object) ['foo:bar' => 'baz']],
- ['{"foo":"bar"}', (object) ['foo' => 'bar']],
+ array('{foo: bar,bar: foo,"false": false,"null": null,integer: 12}', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_OBJECT_FOR_MAP),
+ array('{ foo : bar, bar : foo, "false" : false, "null" : null, integer : 12 }', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), Yaml::PARSE_OBJECT_FOR_MAP),
+ array('{foo: \'bar\', bar: \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
+ array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
+ array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', 'bar"' => 'foo: bar')),
+ array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),
+ array('{"foo:bar": "baz"}', (object) array('foo:bar' => 'baz')),
+ array('{"foo":"bar"}', (object) array('foo' => 'bar')),
// nested sequences and mappings
- ['[foo, [bar, foo]]', ['foo', ['bar', 'foo']]],
- ['[foo, {bar: foo}]', ['foo', (object) ['bar' => 'foo']]],
- ['{ foo: {bar: foo} }', (object) ['foo' => (object) ['bar' => 'foo']]],
- ['{ foo: [bar, foo] }', (object) ['foo' => ['bar', 'foo']]],
+ array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
+ array('[foo, {bar: foo}]', array('foo', (object) array('bar' => 'foo'))),
+ array('{ foo: {bar: foo} }', (object) array('foo' => (object) array('bar' => 'foo'))),
+ array('{ foo: [bar, foo] }', (object) array('foo' => array('bar', 'foo'))),
- ['[ foo, [ bar, foo ] ]', ['foo', ['bar', 'foo']]],
+ array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),
- ['[{ foo: {bar: foo} }]', [(object) ['foo' => (object) ['bar' => 'foo']]]],
+ array('[{ foo: {bar: foo} }]', array((object) array('foo' => (object) array('bar' => 'foo')))),
- ['[foo, [bar, [foo, [bar, foo]], foo]]', ['foo', ['bar', ['foo', ['bar', 'foo']], 'foo']]],
+ array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
- ['[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', ['foo', (object) ['bar' => 'foo', 'foo' => ['foo', (object) ['bar' => 'foo']]], ['foo', (object) ['bar' => 'foo']]]],
+ array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', (object) array('bar' => 'foo', 'foo' => array('foo', (object) array('bar' => 'foo'))), array('foo', (object) array('bar' => 'foo')))),
- ['[foo, bar: { foo: bar }]', ['foo', '1' => (object) ['bar' => (object) ['foo' => 'bar']]]],
- ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', (object) ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']],
+ array('[foo, bar: { foo: bar }]', array('foo', '1' => (object) array('bar' => (object) array('foo' => 'bar')))),
+ array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', (object) array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
- ['{}', new \stdClass()],
- ['{ foo : bar, bar : {} }', (object) ['foo' => 'bar', 'bar' => new \stdClass()]],
- ['{ foo : [], bar : {} }', (object) ['foo' => [], 'bar' => new \stdClass()]],
- ['{foo: \'bar\', bar: {} }', (object) ['foo' => 'bar', 'bar' => new \stdClass()]],
- ['{\'foo\': \'bar\', "bar": {}}', (object) ['foo' => 'bar', 'bar' => new \stdClass()]],
- ['{\'foo\': \'bar\', "bar": \'{}\'}', (object) ['foo' => 'bar', 'bar' => '{}']],
+ array('{}', new \stdClass()),
+ array('{ foo : bar, bar : {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
+ array('{ foo : [], bar : {} }', (object) array('foo' => array(), 'bar' => new \stdClass())),
+ array('{foo: \'bar\', bar: {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
+ array('{\'foo\': \'bar\', "bar": {}}', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
+ array('{\'foo\': \'bar\', "bar": \'{}\'}', (object) array('foo' => 'bar', 'bar' => '{}')),
- ['[foo, [{}, {}]]', ['foo', [new \stdClass(), new \stdClass()]]],
- ['[foo, [[], {}]]', ['foo', [[], new \stdClass()]]],
- ['[foo, [[{}, {}], {}]]', ['foo', [[new \stdClass(), new \stdClass()], new \stdClass()]]],
- ['[foo, {bar: {}}]', ['foo', '1' => (object) ['bar' => new \stdClass()]]],
- ];
+ array('[foo, [{}, {}]]', array('foo', array(new \stdClass(), new \stdClass()))),
+ array('[foo, [[], {}]]', array('foo', array(array(), new \stdClass()))),
+ array('[foo, [[{}, {}], {}]]', array('foo', array(array(new \stdClass(), new \stdClass()), new \stdClass()))),
+ array('[foo, {bar: {}}]', array('foo', '1' => (object) array('bar' => new \stdClass()))),
+ );
}
public function getTestsForDump()
{
- return [
- ['null', null],
- ['false', false],
- ['true', true],
- ['12', 12],
- ["'1_2'", '1_2'],
- ['_12', '_12'],
- ["'12_'", '12_'],
- ["'quoted string'", 'quoted string'],
- ['!!float 1230', 12.30e+02],
- ['1234', 0x4D2],
- ['1243', 02333],
- ["'0x_4_D_2_'", '0x_4_D_2_'],
- ["'0_2_3_3_3'", '0_2_3_3_3'],
- ['.Inf', -log(0)],
- ['-.Inf', log(0)],
- ["'686e444'", '686e444'],
- ['"foo\r\nbar"', "foo\r\nbar"],
- ["'foo#bar'", 'foo#bar'],
- ["'foo # bar'", 'foo # bar'],
- ["'#cfcfcf'", '#cfcfcf'],
-
- ["'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''],
-
- ["'-dash'", '-dash'],
- ["'-'", '-'],
+ return array(
+ array('null', null),
+ array('false', false),
+ array('true', true),
+ array('12', 12),
+ array("'1_2'", '1_2'),
+ array('_12', '_12'),
+ array("'12_'", '12_'),
+ array("'quoted string'", 'quoted string'),
+ array('!!float 1230', 12.30e+02),
+ array('1234', 0x4D2),
+ array('1243', 02333),
+ array("'0x_4_D_2_'", '0x_4_D_2_'),
+ array("'0_2_3_3_3'", '0_2_3_3_3'),
+ array('.Inf', -log(0)),
+ array('-.Inf', log(0)),
+ array("'686e444'", '686e444'),
+ array('"foo\r\nbar"', "foo\r\nbar"),
+ array("'foo#bar'", 'foo#bar'),
+ array("'foo # bar'", 'foo # bar'),
+ array("'#cfcfcf'", '#cfcfcf'),
+
+ array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
+
+ array("'-dash'", '-dash'),
+ array("'-'", '-'),
// Pre-YAML-1.2 booleans
- ["'y'", 'y'],
- ["'n'", 'n'],
- ["'yes'", 'yes'],
- ["'no'", 'no'],
- ["'on'", 'on'],
- ["'off'", 'off'],
+ array("'y'", 'y'),
+ array("'n'", 'n'),
+ array("'yes'", 'yes'),
+ array("'no'", 'no'),
+ array("'on'", 'on'),
+ array("'off'", 'off'),
// sequences
- ['[foo, bar, false, null, 12]', ['foo', 'bar', false, null, 12]],
- ['[\'foo,bar\', \'foo bar\']', ['foo,bar', 'foo bar']],
+ array('[foo, bar, false, null, 12]', array('foo', 'bar', false, null, 12)),
+ array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
// mappings
- ['{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', ['foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12]],
- ['{ foo: bar, bar: \'foo: bar\' }', ['foo' => 'bar', 'bar' => 'foo: bar']],
+ array('{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
+ array('{ foo: bar, bar: \'foo: bar\' }', array('foo' => 'bar', 'bar' => 'foo: bar')),
// nested sequences and mappings
- ['[foo, [bar, foo]]', ['foo', ['bar', 'foo']]],
+ array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
- ['[foo, [bar, [foo, [bar, foo]], foo]]', ['foo', ['bar', ['foo', ['bar', 'foo']], 'foo']]],
+ array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
- ['{ foo: { bar: foo } }', ['foo' => ['bar' => 'foo']]],
+ array('{ foo: { bar: foo } }', array('foo' => array('bar' => 'foo'))),
- ['[foo, { bar: foo }]', ['foo', ['bar' => 'foo']]],
+ array('[foo, { bar: foo }]', array('foo', array('bar' => 'foo'))),
- ['[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', ['foo', ['bar' => 'foo', 'foo' => ['foo', ['bar' => 'foo']]], ['foo', ['bar' => 'foo']]]],
+ array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
- ['[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', ['foo', '@foo.baz', ['%foo%' => 'foo is %foo%', 'bar' => '%foo%'], true, '@service_container']],
+ array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
- ['{ foo: { bar: { 1: 2, baz: 3 } } }', ['foo' => ['bar' => [1 => 2, 'baz' => 3]]]],
-
- // numeric strings with trailing whitespaces
- ["'0123 '", '0123 '],
- ['"0123\f"', "0123\f"],
- ['"0123\n"', "0123\n"],
- ['"0123\r"', "0123\r"],
- ['"0123\t"', "0123\t"],
- ['"0123\v"', "0123\v"],
- ];
+ array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),
+ );
}
/**
@@ -611,12 +612,12 @@ public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $
public function getTimestampTests()
{
- return [
- 'canonical' => ['2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43.1, '+0000'],
- 'ISO-8601' => ['2001-12-15t21:59:43.10-05:00', 2001, 12, 16, 2, 59, 43.1, '-0500'],
- 'spaced' => ['2001-12-15 21:59:43.10 -5', 2001, 12, 16, 2, 59, 43.1, '-0500'],
- 'date' => ['2001-12-15', 2001, 12, 15, 0, 0, 0, '+0000'],
- ];
+ return array(
+ 'canonical' => array('2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43.1, '+0000'),
+ 'ISO-8601' => array('2001-12-15t21:59:43.10-05:00', 2001, 12, 16, 2, 59, 43.1, '-0500'),
+ 'spaced' => array('2001-12-15 21:59:43.10 -5', 2001, 12, 16, 2, 59, 43.1, '-0500'),
+ 'date' => array('2001-12-15', 2001, 12, 15, 0, 0, 0, '+0000'),
+ );
}
/**
@@ -633,7 +634,7 @@ public function testParseNestedTimestampListAsDateTimeObject($yaml, $year, $mont
$expected->setTime($hour, $minute, $second);
}
- $expectedNested = ['nested' => [$expected]];
+ $expectedNested = array('nested' => array($expected));
$yamlNested = "{nested: [$yaml]}";
$this->assertEquals($expectedNested, Inline::parse($yamlNested, Yaml::PARSE_DATETIME));
@@ -649,13 +650,13 @@ public function testDumpDateTime($dateTime, $expected)
public function getDateTimeDumpTests()
{
- $tests = [];
+ $tests = array();
$dateTime = new \DateTime('2001-12-15 21:59:43', new \DateTimeZone('UTC'));
- $tests['date-time-utc'] = [$dateTime, '2001-12-15T21:59:43+00:00'];
+ $tests['date-time-utc'] = array($dateTime, '2001-12-15T21:59:43+00:00');
$dateTime = new \DateTimeImmutable('2001-07-15 21:59:43', new \DateTimeZone('Europe/Berlin'));
- $tests['immutable-date-time-europe-berlin'] = [$dateTime, '2001-07-15T21:59:43+02:00'];
+ $tests['immutable-date-time-europe-berlin'] = array($dateTime, '2001-07-15T21:59:43+02:00');
return $tests;
}
@@ -670,38 +671,44 @@ public function testParseBinaryData($data)
public function getBinaryData()
{
- return [
- 'enclosed with double quotes' => ['!!binary "SGVsbG8gd29ybGQ="'],
- 'enclosed with single quotes' => ["!!binary 'SGVsbG8gd29ybGQ='"],
- 'containing spaces' => ['!!binary "SGVs bG8gd 29ybGQ="'],
- ];
+ return array(
+ 'enclosed with double quotes' => array('!!binary "SGVsbG8gd29ybGQ="'),
+ 'enclosed with single quotes' => array("!!binary 'SGVsbG8gd29ybGQ='"),
+ 'containing spaces' => array('!!binary "SGVs bG8gd 29ybGQ="'),
+ );
}
/**
* @dataProvider getInvalidBinaryData
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testParseInvalidBinaryData($data, $expectedMessage)
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessageMatches($expectedMessage);
+ if (method_exists($this, 'expectException')) {
+ $this->expectExceptionMessageRegExp($expectedMessage);
+ } else {
+ $this->setExpectedExceptionRegExp(ParseException::class, $expectedMessage);
+ }
Inline::parse($data);
}
public function getInvalidBinaryData()
{
- return [
- 'length not a multiple of four' => ['!!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'],
- 'invalid characters' => ['!!binary "SGVsbG8#d29ybGQ="', '/The base64 encoded data \(.*\) contains invalid characters/'],
- 'too many equals characters' => ['!!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \(.*\) contains invalid characters/'],
- 'misplaced equals character' => ['!!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'],
- ];
+ return array(
+ 'length not a multiple of four' => array('!!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'),
+ 'invalid characters' => array('!!binary "SGVsbG8#d29ybGQ="', '/The base64 encoded data \(.*\) contains invalid characters/'),
+ 'too many equals characters' => array('!!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \(.*\) contains invalid characters/'),
+ 'misplaced equals character' => array('!!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'),
+ );
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported} at line 1.
+ */
public function testNotSupportedMissingValue()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('Malformed inline YAML string: "{this, is not, supported}" at line 1.');
Inline::parse('{this, is not, supported}');
}
@@ -709,7 +716,7 @@ public function testVeryLongQuotedStrings()
{
$longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000);
- $yamlString = Inline::dump(['longStringWithQuotes' => $longStringWithQuotes]);
+ $yamlString = Inline::dump(array('longStringWithQuotes' => $longStringWithQuotes));
$arrayFromYaml = Inline::parse($yamlString);
$this->assertEquals($longStringWithQuotes, $arrayFromYaml['longStringWithQuotes']);
@@ -721,7 +728,7 @@ public function testVeryLongQuotedStrings()
*/
public function testOmittedMappingKeyIsParsedAsColon()
{
- $this->assertSame([':' => 'foo'], Inline::parse('{: foo}'));
+ $this->assertSame(array(':' => 'foo'), Inline::parse('{: foo}'));
}
/**
@@ -734,20 +741,20 @@ public function testParseMissingMappingValueAsNull($yaml, $expected)
public function getTestsForNullValues()
{
- return [
- 'null before closing curly brace' => ['{foo:}', ['foo' => null]],
- 'null before comma' => ['{foo:, bar: baz}', ['foo' => null, 'bar' => 'baz']],
- ];
+ return array(
+ 'null before closing curly brace' => array('{foo:}', array('foo' => null)),
+ 'null before comma' => array('{foo:, bar: baz}', array('foo' => null, 'bar' => 'baz')),
+ );
}
public function testTheEmptyStringIsAValidMappingKey()
{
- $this->assertSame(['' => 'foo'], Inline::parse('{ "": foo }'));
+ $this->assertSame(array('' => 'foo'), Inline::parse('{ "": foo }'));
}
/**
* @group legacy
- * @expectedDeprecation Implicit casting of incompatible mapping keys to strings is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 1.
+ * @expectedDeprecation Implicit casting of incompatible mapping keys to strings is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 1.
* @dataProvider getNotPhpCompatibleMappingKeyData
*/
public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expected)
@@ -757,8 +764,8 @@ public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expec
/**
* @group legacy
- * @expectedDeprecation Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.
- * @expectedDeprecation Implicit casting of incompatible mapping keys to strings is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 1.
+ * @expectedDeprecation Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since version 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.
+ * @expectedDeprecation Implicit casting of incompatible mapping keys to strings is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 1.
* @dataProvider getNotPhpCompatibleMappingKeyData
*/
public function testExplicitStringCastingOfMappingKeys($yaml, $expected)
@@ -768,106 +775,20 @@ public function testExplicitStringCastingOfMappingKeys($yaml, $expected)
public function getNotPhpCompatibleMappingKeyData()
{
- return [
- 'boolean-true' => ['{true: "foo"}', ['true' => 'foo']],
- 'boolean-false' => ['{false: "foo"}', ['false' => 'foo']],
- 'null' => ['{null: "foo"}', ['null' => 'foo']],
- 'float' => ['{0.25: "foo"}', ['0.25' => 'foo']],
- ];
+ return array(
+ 'boolean-true' => array('{true: "foo"}', array('true' => 'foo')),
+ 'boolean-false' => array('{false: "foo"}', array('false' => 'foo')),
+ 'null' => array('{null: "foo"}', array('null' => 'foo')),
+ 'float' => array('{0.25: "foo"}', array('0.25' => 'foo')),
+ );
}
/**
* @group legacy
- * @expectedDeprecation Support for the !str tag is deprecated since Symfony 3.4. Use the !!str tag instead on line 1.
+ * @expectedDeprecation Support for the !str tag is deprecated since version 3.4. Use the !!str tag instead on line 1.
*/
public function testDeprecatedStrTag()
{
- $this->assertSame(['foo' => 'bar'], Inline::parse('{ foo: !str bar }'));
- }
-
- public function testUnfinishedInlineMap()
- {
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('Unexpected end of line, expected one of ",}" at line 1 (near "{abc: \'def\'").');
- Inline::parse("{abc: 'def'");
- }
-
- /**
- * @dataProvider getTestsForOctalNumbers
- */
- public function testParseOctalNumbers($expected, $yaml)
- {
- self::assertSame($expected, Inline::parse($yaml));
- }
-
- public function getTestsForOctalNumbers()
- {
- return [
- 'positive octal number' => [28, '034'],
- 'negative octal number' => [-28, '-034'],
- ];
- }
-
- /**
- * @dataProvider phpObjectTagWithEmptyValueProvider
- */
- public function testPhpObjectWithEmptyValue($expected, $value)
- {
- $this->assertSame($expected, Inline::parse($value, Yaml::PARSE_OBJECT));
- }
-
- public function phpObjectTagWithEmptyValueProvider()
- {
- return [
- [false, '!php/object'],
- [false, '!php/object '],
- [false, '!php/object '],
- [[false], '[!php/object]'],
- [[false], '[!php/object ]'],
- [[false, 'foo'], '[!php/object , foo]'],
- ];
- }
-
- /**
- * @dataProvider phpConstTagWithEmptyValueProvider
- */
- public function testPhpConstTagWithEmptyValue($expected, $value)
- {
- $this->assertSame($expected, Inline::parse($value, Yaml::PARSE_CONSTANT));
- }
-
- public function phpConstTagWithEmptyValueProvider()
- {
- return [
- ['', '!php/const'],
- ['', '!php/const '],
- ['', '!php/const '],
- [[''], '[!php/const]'],
- [[''], '[!php/const ]'],
- [['', 'foo'], '[!php/const , foo]'],
- [['' => 'foo'], '{!php/const: foo}'],
- [['' => 'foo'], '{!php/const : foo}'],
- [['' => 'foo', 'bar' => 'ccc'], '{!php/const : foo, bar: ccc}'],
- ];
- }
-
- public function testParsePositiveOctalNumberContainingInvalidDigits()
- {
- self::assertSame('0123456789', Inline::parse('0123456789'));
- }
-
- public function testParseNegativeOctalNumberContainingInvalidDigits()
- {
- self::assertSame('-0123456789', Inline::parse('-0123456789'));
- }
-
- public function testParseCommentNotPrefixedBySpaces()
- {
- self::assertSame('foo', Inline::parse('"foo"#comment'));
- }
-
- public function testParseUnquotedStringContainingHashTagNotPrefixedBySpace()
- {
- self::assertSame('foo#nocomment', Inline::parse('foo#nocomment'));
+ $this->assertSame(array('foo' => 'bar'), Inline::parse('{ foo: !str bar }'));
}
}
diff --git a/inc.lib/vendor/symfony/yaml/Tests/ParserTest.php b/inc.lib/vendor/symfony/yaml/Tests/ParserTest.php
index 7fa6ed1a..c0a647ec 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/ParserTest.php
+++ b/inc.lib/vendor/symfony/yaml/Tests/ParserTest.php
@@ -12,9 +12,10 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Component\Yaml\Exception\ParseException;
+use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
-use Symfony\Component\Yaml\Yaml;
class ParserTest extends TestCase
{
@@ -38,19 +39,21 @@ protected function tearDown()
*/
public function testSpecifications($expected, $yaml, $comment, $deprecated)
{
- $deprecations = [];
+ $deprecations = array();
if ($deprecated) {
set_error_handler(function ($type, $msg) use (&$deprecations) {
- if (\E_USER_DEPRECATED !== $type) {
+ if (E_USER_DEPRECATED !== $type) {
restore_error_handler();
- return \call_user_func_array('PHPUnit\Util\ErrorHandler::handleError', \func_get_args());
+ if (class_exists('PHPUnit_Util_ErrorHandler')) {
+ return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args());
+ }
+
+ return call_user_func_array('PHPUnit\Util\ErrorHandler::handleError', func_get_args());
}
$deprecations[] = $msg;
-
- return null;
});
}
@@ -60,7 +63,7 @@ public function testSpecifications($expected, $yaml, $comment, $deprecated)
restore_error_handler();
$this->assertCount(1, $deprecations);
- $this->assertStringContainsString(true !== $deprecated ? $deprecated : 'Using the comma as a group separator for floats is deprecated since Symfony 3.2 and will be removed in 4.0 on line 1.', $deprecations[0]);
+ $this->assertContains(true !== $deprecated ? $deprecated : 'Using the comma as a group separator for floats is deprecated since version 3.2 and will be removed in 4.0 on line 1.', $deprecations[0]);
}
}
@@ -71,7 +74,7 @@ public function getDataFormSpecifications()
/**
* @group legacy
- * @expectedDeprecationMessage Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable
+ * @expectedDeprecationMessage Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since version 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable
* @dataProvider getNonStringMappingKeysData
*/
public function testNonStringMappingKeys($expected, $yaml, $comment)
@@ -101,16 +104,16 @@ public function getLegacyNonStringMappingKeysData()
public function testTabsInYaml()
{
// test tabs in YAML
- $yamls = [
+ $yamls = array(
"foo:\n bar",
"foo:\n bar",
"foo:\n bar",
"foo:\n bar",
- ];
+ );
foreach ($yamls as $yaml) {
try {
- $this->parser->parse($yaml);
+ $content = $this->parser->parse($yaml);
$this->fail('YAML files must not contain tabs');
} catch (\Exception $e) {
@@ -133,7 +136,7 @@ public function testEndOfTheDocumentMarker()
public function getBlockChompingTests()
{
- $tests = [];
+ $tests = array();
$yaml = <<<'EOF'
foo: |-
@@ -144,11 +147,11 @@ public function getBlockChompingTests()
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one\ntwo",
'bar' => "one\ntwo",
- ];
- $tests['Literal block chomping strip with single trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Literal block chomping strip with single trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: |-
@@ -161,19 +164,19 @@ public function getBlockChompingTests()
EOF;
- $expected = [
+ $expected = array(
'foo' => "one\ntwo",
'bar' => "one\ntwo",
- ];
- $tests['Literal block chomping strip with multiple trailing newlines'] = [$expected, $yaml];
+ );
+ $tests['Literal block chomping strip with multiple trailing newlines'] = array($expected, $yaml);
$yaml = <<<'EOF'
{}
EOF;
- $expected = [];
- $tests['Literal block chomping strip with multiple trailing newlines after a 1-liner'] = [$expected, $yaml];
+ $expected = array();
+ $tests['Literal block chomping strip with multiple trailing newlines after a 1-liner'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: |-
@@ -183,11 +186,11 @@ public function getBlockChompingTests()
one
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one\ntwo",
'bar' => "one\ntwo",
- ];
- $tests['Literal block chomping strip without trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Literal block chomping strip without trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: |
@@ -198,11 +201,11 @@ public function getBlockChompingTests()
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one\ntwo\n",
'bar' => "one\ntwo\n",
- ];
- $tests['Literal block chomping clip with single trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Literal block chomping clip with single trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: |
@@ -215,11 +218,11 @@ public function getBlockChompingTests()
EOF;
- $expected = [
+ $expected = array(
'foo' => "one\ntwo\n",
'bar' => "one\ntwo\n",
- ];
- $tests['Literal block chomping clip with multiple trailing newlines'] = [$expected, $yaml];
+ );
+ $tests['Literal block chomping clip with multiple trailing newlines'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo:
@@ -228,14 +231,14 @@ public function getBlockChompingTests()
two
EOF;
- $expected = [
- 'foo' => [
- [
+ $expected = array(
+ 'foo' => array(
+ array(
'bar' => "one\n\ntwo",
- ],
- ],
- ];
- $tests['Literal block chomping clip with embedded blank line inside unindented collection'] = [$expected, $yaml];
+ ),
+ ),
+ );
+ $tests['Literal block chomping clip with embedded blank line inside unindented collection'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: |
@@ -245,11 +248,11 @@ public function getBlockChompingTests()
one
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one\ntwo\n",
'bar' => "one\ntwo",
- ];
- $tests['Literal block chomping clip without trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Literal block chomping clip without trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: |+
@@ -260,11 +263,11 @@ public function getBlockChompingTests()
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one\ntwo\n",
'bar' => "one\ntwo\n",
- ];
- $tests['Literal block chomping keep with single trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Literal block chomping keep with single trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: |+
@@ -277,11 +280,11 @@ public function getBlockChompingTests()
EOF;
- $expected = [
+ $expected = array(
'foo' => "one\ntwo\n\n",
'bar' => "one\ntwo\n\n",
- ];
- $tests['Literal block chomping keep with multiple trailing newlines'] = [$expected, $yaml];
+ );
+ $tests['Literal block chomping keep with multiple trailing newlines'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: |+
@@ -291,11 +294,11 @@ public function getBlockChompingTests()
one
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one\ntwo\n",
'bar' => "one\ntwo",
- ];
- $tests['Literal block chomping keep without trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Literal block chomping keep without trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: >-
@@ -306,11 +309,11 @@ public function getBlockChompingTests()
two
EOF;
- $expected = [
+ $expected = array(
'foo' => 'one two',
'bar' => 'one two',
- ];
- $tests['Folded block chomping strip with single trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Folded block chomping strip with single trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: >-
@@ -323,11 +326,11 @@ public function getBlockChompingTests()
EOF;
- $expected = [
+ $expected = array(
'foo' => 'one two',
'bar' => 'one two',
- ];
- $tests['Folded block chomping strip with multiple trailing newlines'] = [$expected, $yaml];
+ );
+ $tests['Folded block chomping strip with multiple trailing newlines'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: >-
@@ -337,11 +340,11 @@ public function getBlockChompingTests()
one
two
EOF;
- $expected = [
+ $expected = array(
'foo' => 'one two',
'bar' => 'one two',
- ];
- $tests['Folded block chomping strip without trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Folded block chomping strip without trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: >
@@ -352,11 +355,11 @@ public function getBlockChompingTests()
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one two\n",
'bar' => "one two\n",
- ];
- $tests['Folded block chomping clip with single trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Folded block chomping clip with single trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: >
@@ -369,11 +372,11 @@ public function getBlockChompingTests()
EOF;
- $expected = [
+ $expected = array(
'foo' => "one two\n",
'bar' => "one two\n",
- ];
- $tests['Folded block chomping clip with multiple trailing newlines'] = [$expected, $yaml];
+ );
+ $tests['Folded block chomping clip with multiple trailing newlines'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: >
@@ -383,11 +386,11 @@ public function getBlockChompingTests()
one
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one two\n",
'bar' => 'one two',
- ];
- $tests['Folded block chomping clip without trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Folded block chomping clip without trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: >+
@@ -398,11 +401,11 @@ public function getBlockChompingTests()
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one two\n",
'bar' => "one two\n",
- ];
- $tests['Folded block chomping keep with single trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Folded block chomping keep with single trailing newline'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: >+
@@ -415,11 +418,11 @@ public function getBlockChompingTests()
EOF;
- $expected = [
+ $expected = array(
'foo' => "one two\n\n",
'bar' => "one two\n\n",
- ];
- $tests['Folded block chomping keep with multiple trailing newlines'] = [$expected, $yaml];
+ );
+ $tests['Folded block chomping keep with multiple trailing newlines'] = array($expected, $yaml);
$yaml = <<<'EOF'
foo: >+
@@ -429,11 +432,11 @@ public function getBlockChompingTests()
one
two
EOF;
- $expected = [
+ $expected = array(
'foo' => "one two\n",
'bar' => 'one two',
- ];
- $tests['Folded block chomping keep without trailing newline'] = [$expected, $yaml];
+ );
+ $tests['Folded block chomping keep without trailing newline'] = array($expected, $yaml);
return $tests;
}
@@ -460,9 +463,9 @@ public function testBlockLiteralWithLeadingNewlines()
bar
EOF;
- $expected = [
+ $expected = array(
'foo' => "\n\nbar",
- ];
+ );
$this->assertSame($expected, $this->parser->parse($yaml));
}
@@ -473,7 +476,7 @@ public function testObjectSupportEnabled()
foo: !php/object O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
bar: 1
EOF;
- $this->assertEquals(['foo' => new B(), 'bar' => 1], $this->parser->parse($input, Yaml::PARSE_OBJECT), '->parse() is able to parse objects');
+ $this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, Yaml::PARSE_OBJECT), '->parse() is able to parse objects');
}
/**
@@ -485,7 +488,7 @@ public function testObjectSupportEnabledPassingTrue()
foo: !php/object:O:30:"Symfony\Component\Yaml\Tests\B":1:{s:1:"b";s:3:"foo";}
bar: 1
EOF;
- $this->assertEquals(['foo' => new B(), 'bar' => 1], $this->parser->parse($input, false, true), '->parse() is able to parse objects');
+ $this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($input, false, true), '->parse() is able to parse objects');
}
/**
@@ -494,25 +497,25 @@ public function testObjectSupportEnabledPassingTrue()
*/
public function testObjectSupportEnabledWithDeprecatedTag($yaml)
{
- $this->assertEquals(['foo' => new B(), 'bar' => 1], $this->parser->parse($yaml, Yaml::PARSE_OBJECT), '->parse() is able to parse objects');
+ $this->assertEquals(array('foo' => new B(), 'bar' => 1), $this->parser->parse($yaml, Yaml::PARSE_OBJECT), '->parse() is able to parse objects');
}
public function deprecatedObjectValueProvider()
{
- return [
- [
+ return array(
+ array(
<<assertEquals(['foo' => null, 'bar' => 1], $this->parser->parse($input), '->parse() does not parse objects');
+ $this->assertEquals(array('foo' => null, 'bar' => 1), $this->parser->parse($input), '->parse() does not parse objects');
}
/**
@@ -544,7 +547,7 @@ public function testObjectForMapEnabledWithMappingUsingBooleanToggles($yaml, $ex
public function getObjectForMapTests()
{
- $tests = [];
+ $tests = array();
$yaml = <<<'EOF'
foo:
@@ -552,20 +555,20 @@ public function getObjectForMapTests()
EOF;
$expected = new \stdClass();
$expected->foo = new \stdClass();
- $expected->foo->fiz = ['cat'];
- $tests['mapping'] = [$yaml, $expected];
+ $expected->foo->fiz = array('cat');
+ $tests['mapping'] = array($yaml, $expected);
$yaml = '{ "foo": "bar", "fiz": "cat" }';
$expected = new \stdClass();
$expected->foo = 'bar';
$expected->fiz = 'cat';
- $tests['inline-mapping'] = [$yaml, $expected];
+ $tests['inline-mapping'] = array($yaml, $expected);
$yaml = "foo: bar\nbaz: foobar";
$expected = new \stdClass();
$expected->foo = 'bar';
$expected->baz = 'foobar';
- $tests['object-for-map-is-applied-after-parsing'] = [$yaml, $expected];
+ $tests['object-for-map-is-applied-after-parsing'] = array($yaml, $expected);
$yaml = <<<'EOT'
array:
@@ -573,12 +576,12 @@ public function getObjectForMapTests()
- key: two
EOT;
$expected = new \stdClass();
- $expected->array = [];
+ $expected->array = array();
$expected->array[0] = new \stdClass();
$expected->array[0]->key = 'one';
$expected->array[1] = new \stdClass();
$expected->array[1]->key = 'two';
- $tests['nest-map-and-sequence'] = [$yaml, $expected];
+ $tests['nest-map-and-sequence'] = array($yaml, $expected);
$yaml = <<<'YAML'
map:
@@ -589,7 +592,7 @@ public function getObjectForMapTests()
$expected->map = new \stdClass();
$expected->map->{1} = 'one';
$expected->map->{2} = 'two';
- $tests['numeric-keys'] = [$yaml, $expected];
+ $tests['numeric-keys'] = array($yaml, $expected);
$yaml = <<<'YAML'
map:
@@ -600,17 +603,17 @@ public function getObjectForMapTests()
$expected->map = new \stdClass();
$expected->map->{0} = 'one';
$expected->map->{1} = 'two';
- $tests['zero-indexed-numeric-keys'] = [$yaml, $expected];
+ $tests['zero-indexed-numeric-keys'] = array($yaml, $expected);
return $tests;
}
/**
* @dataProvider invalidDumpedObjectProvider
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testObjectsSupportDisabledWithExceptions($yaml)
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->parser->parse($yaml, Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
}
@@ -618,9 +621,9 @@ public function testCanParseContentWithTrailingSpaces()
{
$yaml = "items: \n foo: bar";
- $expected = [
- 'items' => ['foo' => 'bar'],
- ];
+ $expected = array(
+ 'items' => array('foo' => 'bar'),
+ );
$this->assertSame($expected, $this->parser->parse($yaml));
}
@@ -628,10 +631,10 @@ public function testCanParseContentWithTrailingSpaces()
/**
* @group legacy
* @dataProvider invalidDumpedObjectProvider
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testObjectsSupportDisabledWithExceptionsUsingBooleanToggles($yaml)
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->parser->parse($yaml, true);
}
@@ -646,10 +649,10 @@ public function invalidDumpedObjectProvider()
bar: 1
EOF;
- return [
- 'yaml-tag' => [$yamlTag],
- 'local-tag' => [$localTag],
- ];
+ return array(
+ 'yaml-tag' => array($yamlTag),
+ 'local-tag' => array($localTag),
+ );
}
/**
@@ -657,11 +660,11 @@ public function invalidDumpedObjectProvider()
*/
public function testNonUtf8Exception()
{
- $yamls = [
+ $yamls = array(
iconv('UTF-8', 'ISO-8859-1', "foo: 'äöüß'"),
iconv('UTF-8', 'ISO-8859-15', "euro: '€'"),
iconv('UTF-8', 'CP1252', "cp1252: '©ÉÇáñ'"),
- ];
+ );
foreach ($yamls as $yaml) {
try {
@@ -674,9 +677,11 @@ public function testNonUtf8Exception()
}
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ */
public function testUnindentedCollectionException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$yaml = <<<'EOF'
collection:
@@ -689,9 +694,11 @@ public function testUnindentedCollectionException()
$this->parser->parse($yaml);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ */
public function testShortcutKeyUnindentedCollectionException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$yaml = <<<'EOF'
collection:
@@ -703,10 +710,12 @@ public function testShortcutKeyUnindentedCollectionException()
$this->parser->parse($yaml);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessageRegExp /^Multiple documents are not supported.+/
+ */
public function testMultipleDocumentsNotSupportedException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessageMatches('/^Multiple documents are not supported.+/');
Yaml::parse(<<<'EOL'
# Ranking of 1998 home runs
---
@@ -722,9 +731,11 @@ public function testMultipleDocumentsNotSupportedException()
);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ */
public function testSequenceInAMapping()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Yaml::parse(<<<'EOF'
yaml:
hash: me
@@ -744,19 +755,19 @@ public function testSequenceInMappingStartedBySingleDashLine()
- foo
d: e
EOT;
- $expected = [
- 'a' => [
- [
- 'b' => [
- [
+ $expected = array(
+ 'a' => array(
+ array(
+ 'b' => array(
+ array(
'bar' => 'baz',
- ],
- ],
- ],
+ ),
+ ),
+ ),
'foo',
- ],
+ ),
'd' => 'e',
- ];
+ );
$this->assertSame($expected, $this->parser->parse($yaml));
}
@@ -770,101 +781,21 @@ public function testSequenceFollowedByCommentEmbeddedInMapping()
# comment
d: e
EOT;
- $expected = [
- 'a' => [
- 'b' => ['c'],
+ $expected = array(
+ 'a' => array(
+ 'b' => array('c'),
'd' => 'e',
- ],
- ];
-
- $this->assertSame($expected, $this->parser->parse($yaml));
- }
-
- public function testNonStringFollowedByCommentEmbeddedInMapping()
- {
- $yaml = <<<'EOT'
-a:
- b:
- {}
-# comment
- d:
- 1.1
-# another comment
-EOT;
- $expected = [
- 'a' => [
- 'b' => [],
- 'd' => 1.1,
- ],
- ];
+ ),
+ );
$this->assertSame($expected, $this->parser->parse($yaml));
}
- public function getParseExceptionNotAffectedMultiLineStringLastResortParsing()
- {
- $tests = [];
-
- $yaml = <<<'EOT'
-a
- b:
-EOT;
- $tests['parse error on first line'] = [$yaml];
-
- $yaml = <<<'EOT'
-a
-
-b
- c:
-EOT;
- $tests['parse error due to inconsistent indentation'] = [$yaml];
-
- $yaml = <<<'EOT'
- & * ! | > ' " % @ ` #, { asd a;sdasd }-@^qw3
-EOT;
- $tests['symfony/symfony/issues/22967#issuecomment-322067742'] = [$yaml];
-
- return $tests;
- }
-
/**
- * @dataProvider getParseExceptionNotAffectedMultiLineStringLastResortParsing
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
- public function testParseExceptionNotAffectedByMultiLineStringLastResortParsing($yaml)
- {
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->parser->parse($yaml);
- }
-
- public function testMultiLineStringLastResortParsing()
- {
- $yaml = <<<'EOT'
-test:
- You can have things that don't look like strings here
- true
- yes you can
-EOT;
- $expected = [
- 'test' => 'You can have things that don\'t look like strings here true yes you can',
- ];
-
- $this->assertSame($expected, $this->parser->parse($yaml));
-
- $yaml = <<<'EOT'
-a:
- b
- c
-EOT;
- $expected = [
- 'a' => 'b c',
- ];
-
- $this->assertSame($expected, $this->parser->parse($yaml));
- }
-
public function testMappingInASequence()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
Yaml::parse(<<<'EOF'
yaml:
- array stuff
@@ -873,10 +804,12 @@ public function testMappingInASequence()
);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage missing colon
+ */
public function testScalarInSequence()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('missing colon');
Yaml::parse(<<<'EOF'
foo:
- bar
@@ -907,11 +840,11 @@ public function testMappingDuplicateKeyBlock()
child: duplicate
child: duplicate
EOD;
- $expected = [
- 'parent' => [
+ $expected = array(
+ 'parent' => array(
'child' => 'first',
- ],
- ];
+ ),
+ );
$this->assertSame($expected, Yaml::parse($input));
}
@@ -924,11 +857,11 @@ public function testMappingDuplicateKeyFlow()
parent: { child: first, child: duplicate }
parent: { child: duplicate, child: duplicate }
EOD;
- $expected = [
- 'parent' => [
+ $expected = array(
+ 'parent' => array(
'child' => 'first',
- ],
- ];
+ ),
+ );
$this->assertSame($expected, Yaml::parse($input));
}
@@ -945,30 +878,30 @@ public function testParseExceptionOnDuplicate($input, $duplicateKey, $lineNumber
public function getParseExceptionOnDuplicateData()
{
- $tests = [];
+ $tests = array();
$yaml = <<assertEquals(['hash' => null], Yaml::parse($input));
+ $this->assertEquals(array('hash' => null), Yaml::parse($input));
}
public function testCommentAtTheRootIndent()
{
- $this->assertEquals([
- 'services' => [
- 'app.foo_service' => [
+ $this->assertEquals(array(
+ 'services' => array(
+ 'app.foo_service' => array(
'class' => 'Foo',
- ],
- 'app/bar_service' => [
+ ),
+ 'app/bar_service' => array(
'class' => 'Bar',
- ],
- ],
- ], Yaml::parse(<<<'EOF'
+ ),
+ ),
+ ), Yaml::parse(<<<'EOF'
# comment 1
services:
# comment 2
@@ -1037,7 +970,7 @@ class: Bar
public function testStringBlockWithComments()
{
- $this->assertEquals(['content' => <<<'EOT'
+ $this->assertEquals(array('content' => <<<'EOT'
# comment 1
header
@@ -1048,7 +981,7 @@ public function testStringBlockWithComments()
footer # comment3
EOT
- ], Yaml::parse(<<<'EOF'
+ ), Yaml::parse(<<<'EOF'
content: |
# comment 1
header
@@ -1065,7 +998,7 @@ public function testStringBlockWithComments()
public function testFoldedStringBlockWithComments()
{
- $this->assertEquals([['content' => <<<'EOT'
+ $this->assertEquals(array(array('content' => <<<'EOT'
# comment 1
header
@@ -1076,7 +1009,7 @@ public function testFoldedStringBlockWithComments()
footer # comment3
EOT
- ]], Yaml::parse(<<<'EOF'
+ )), Yaml::parse(<<<'EOF'
-
content: |
# comment 1
@@ -1094,7 +1027,7 @@ public function testFoldedStringBlockWithComments()
public function testNestedFoldedStringBlockWithComments()
{
- $this->assertEquals([[
+ $this->assertEquals(array(array(
'title' => 'some title',
'content' => <<<'EOT'
# comment 1
@@ -1107,7 +1040,7 @@ public function testNestedFoldedStringBlockWithComments()
footer # comment3
EOT
- ]], Yaml::parse(<<<'EOF'
+ )), Yaml::parse(<<<'EOF'
-
title: some title
content: |
@@ -1126,17 +1059,17 @@ public function testNestedFoldedStringBlockWithComments()
public function testReferenceResolvingInInlineStrings()
{
- $this->assertEquals([
+ $this->assertEquals(array(
'var' => 'var-value',
'scalar' => 'var-value',
- 'list' => ['var-value'],
- 'list_in_list' => [['var-value']],
- 'map_in_list' => [['key' => 'var-value']],
- 'embedded_mapping' => [['key' => 'var-value']],
- 'map' => ['key' => 'var-value'],
- 'list_in_map' => ['key' => ['var-value']],
- 'map_in_map' => ['foo' => ['bar' => 'var-value']],
- ], Yaml::parse(<<<'EOF'
+ 'list' => array('var-value'),
+ 'list_in_list' => array(array('var-value')),
+ 'map_in_list' => array(array('key' => 'var-value')),
+ 'embedded_mapping' => array(array('key' => 'var-value')),
+ 'map' => array('key' => 'var-value'),
+ 'list_in_map' => array('key' => array('var-value')),
+ 'map_in_map' => array('foo' => array('bar' => 'var-value')),
+ ), Yaml::parse(<<<'EOF'
var: &var var-value
scalar: *var
list: [ *var ]
@@ -1158,12 +1091,12 @@ public function testYamlDirective()
foo: 1
bar: 2
EOF;
- $this->assertEquals(['foo' => 1, 'bar' => 2], $this->parser->parse($yaml));
+ $this->assertEquals(array('foo' => 1, 'bar' => 2), $this->parser->parse($yaml));
}
/**
* @group legacy
- * @expectedDeprecation Implicit casting of numeric key to string is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 2.
+ * @expectedDeprecation Implicit casting of numeric key to string is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 2.
*/
public function testFloatKeys()
{
@@ -1173,19 +1106,19 @@ public function testFloatKeys()
1.3: "baz"
EOF;
- $expected = [
- 'foo' => [
+ $expected = array(
+ 'foo' => array(
'1.2' => 'bar',
'1.3' => 'baz',
- ],
- ];
+ ),
+ );
$this->assertEquals($expected, $this->parser->parse($yaml));
}
/**
* @group legacy
- * @expectedDeprecation Implicit casting of non-string key to string is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 1.
+ * @expectedDeprecation Implicit casting of non-string key to string is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Quote your evaluable mapping keys instead on line 1.
*/
public function testBooleanKeys()
{
@@ -1194,10 +1127,10 @@ public function testBooleanKeys()
false: bar
EOF;
- $expected = [
+ $expected = array(
1 => 'foo',
0 => 'bar',
- ];
+ );
$this->assertEquals($expected, $this->parser->parse($yaml));
}
@@ -1215,22 +1148,24 @@ public function testExplicitStringCasting()
'~': 'null'
EOF;
- $expected = [
+ $expected = array(
'1.2' => 'bar',
'1.3' => 'baz',
'true' => 'foo',
'false' => 'bar',
'null' => 'null',
'~' => 'null',
- ];
+ );
$this->assertEquals($expected, $this->parser->parse($yaml));
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage A colon cannot be used in an unquoted mapping value
+ */
public function testColonInMappingValueException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('A colon cannot be used in an unquoted mapping value');
$yaml = <<<'EOF'
foo: bar: baz
EOF;
@@ -1245,7 +1180,7 @@ public function testColonInMappingValueExceptionNotTriggeredByColonInComment()
bar: foobar # Note: a comment after a colon
EOT;
- $this->assertSame(['foo' => ['bar' => 'foobar']], $this->parser->parse($yaml));
+ $this->assertSame(array('foo' => array('bar' => 'foobar')), $this->parser->parse($yaml));
}
/**
@@ -1258,7 +1193,7 @@ public function testCommentLikeStringsAreNotStrippedInBlockScalars($yaml, $expec
public function getCommentLikeStringInScalarBlockData()
{
- $tests = [];
+ $tests = array();
$yaml = <<<'EOT'
pages:
@@ -1275,9 +1210,9 @@ public function getCommentLikeStringInScalarBlockData()
footer # comment3
EOT;
- $expected = [
- 'pages' => [
- [
+ $expected = array(
+ 'pages' => array(
+ array(
'title' => 'some title',
'content' => <<<'EOT'
# comment 1
@@ -1291,10 +1226,10 @@ public function getCommentLikeStringInScalarBlockData()
footer # comment3
EOT
,
- ],
- ],
- ];
- $tests[] = [$yaml, $expected];
+ ),
+ ),
+ );
+ $tests[] = array($yaml, $expected);
$yaml = <<<'EOT'
test: |
@@ -1311,7 +1246,7 @@ public function getCommentLikeStringInScalarBlockData()
# bar
baz
EOT;
- $expected = [
+ $expected = array(
'test' => <<<'EOT'
foo
# bar
@@ -1319,8 +1254,8 @@ public function getCommentLikeStringInScalarBlockData()
EOT
,
- 'collection' => [
- [
+ 'collection' => array(
+ array(
'one' => <<<'EOT'
foo
# bar
@@ -1328,18 +1263,18 @@ public function getCommentLikeStringInScalarBlockData()
EOT
,
- ],
- [
+ ),
+ array(
'two' => <<<'EOT'
foo
# bar
baz
EOT
,
- ],
- ],
- ];
- $tests[] = [$yaml, $expected];
+ ),
+ ),
+ );
+ $tests[] = array($yaml, $expected);
$yaml = <<<'EOT'
foo:
@@ -1351,17 +1286,17 @@ public function getCommentLikeStringInScalarBlockData()
# comment
foobar: ~
EOT;
- $expected = [
- 'foo' => [
- 'bar' => [
+ $expected = array(
+ 'foo' => array(
+ 'bar' => array(
'scalar-block' => "line1 line2>\n",
- ],
- 'baz' => [
+ ),
+ 'baz' => array(
'foobar' => null,
- ],
- ],
- ];
- $tests[] = [$yaml, $expected];
+ ),
+ ),
+ );
+ $tests[] = array($yaml, $expected);
$yaml = <<<'EOT'
a:
@@ -1371,13 +1306,13 @@ public function getCommentLikeStringInScalarBlockData()
# second row
d: hello
EOT;
- $expected = [
- 'a' => [
+ $expected = array(
+ 'a' => array(
'b' => 'hello',
'd' => 'hello',
- ],
- ];
- $tests[] = [$yaml, $expected];
+ ),
+ );
+ $tests[] = array($yaml, $expected);
return $tests;
}
@@ -1395,13 +1330,13 @@ public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
EOT;
$this->assertSame(
- [
+ array(
'test' => <<<'EOT'
]A heading
- a list
- may be a good example
EOT
,
- ],
+ ),
$this->parser->parse($yaml)
);
}
@@ -1419,7 +1354,7 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
EOT;
$this->assertSame(
- [
+ array(
'test' => <<<'EOT'
A heading
@@ -1428,7 +1363,7 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
EOT
,
- ],
+ ),
$this->parser->parse($yaml)
);
}
@@ -1438,81 +1373,85 @@ public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
*/
public function testParseBinaryData($data)
{
- $this->assertSame(['data' => 'Hello world'], $this->parser->parse($data));
+ $this->assertSame(array('data' => 'Hello world'), $this->parser->parse($data));
}
public function getBinaryData()
{
- return [
- 'enclosed with double quotes' => ['data: !!binary "SGVsbG8gd29ybGQ="'],
- 'enclosed with single quotes' => ["data: !!binary 'SGVsbG8gd29ybGQ='"],
- 'containing spaces' => ['data: !!binary "SGVs bG8gd 29ybGQ="'],
- 'in block scalar' => [
+ return array(
+ 'enclosed with double quotes' => array('data: !!binary "SGVsbG8gd29ybGQ="'),
+ 'enclosed with single quotes' => array("data: !!binary 'SGVsbG8gd29ybGQ='"),
+ 'containing spaces' => array('data: !!binary "SGVs bG8gd 29ybGQ="'),
+ 'in block scalar' => array(
<<<'EOT'
data: !!binary |
SGVsbG8gd29ybGQ=
EOT
- ],
- 'containing spaces in block scalar' => [
+ ),
+ 'containing spaces in block scalar' => array(
<<<'EOT'
data: !!binary |
SGVs bG8gd 29ybGQ=
EOT
- ],
- ];
+ ),
+ );
}
/**
* @dataProvider getInvalidBinaryData
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
*/
public function testParseInvalidBinaryData($data, $expectedMessage)
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessageMatches($expectedMessage);
+ if (method_exists($this, 'expectException')) {
+ $this->expectExceptionMessageRegExp($expectedMessage);
+ } else {
+ $this->setExpectedExceptionRegExp(ParseException::class, $expectedMessage);
+ }
$this->parser->parse($data);
}
public function getInvalidBinaryData()
{
- return [
- 'length not a multiple of four' => ['data: !!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'],
- 'invalid characters' => ['!!binary "SGVsbG8#d29ybGQ="', '/The base64 encoded data \(.*\) contains invalid characters/'],
- 'too many equals characters' => ['data: !!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \(.*\) contains invalid characters/'],
- 'misplaced equals character' => ['data: !!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'],
- 'length not a multiple of four in block scalar' => [
+ return array(
+ 'length not a multiple of four' => array('data: !!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'),
+ 'invalid characters' => array('!!binary "SGVsbG8#d29ybGQ="', '/The base64 encoded data \(.*\) contains invalid characters/'),
+ 'too many equals characters' => array('data: !!binary "SGVsbG8gd29yb==="', '/The base64 encoded data \(.*\) contains invalid characters/'),
+ 'misplaced equals character' => array('data: !!binary "SGVsbG8gd29ybG=Q"', '/The base64 encoded data \(.*\) contains invalid characters/'),
+ 'length not a multiple of four in block scalar' => array(
<<<'EOT'
data: !!binary |
SGVsbG8d29ybGQ=
EOT
,
'/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/',
- ],
- 'invalid characters in block scalar' => [
+ ),
+ 'invalid characters in block scalar' => array(
<<<'EOT'
data: !!binary |
SGVsbG8#d29ybGQ=
EOT
,
'/The base64 encoded data \(.*\) contains invalid characters/',
- ],
- 'too many equals characters in block scalar' => [
+ ),
+ 'too many equals characters in block scalar' => array(
<<<'EOT'
data: !!binary |
SGVsbG8gd29yb===
EOT
,
'/The base64 encoded data \(.*\) contains invalid characters/',
- ],
- 'misplaced equals character in block scalar' => [
+ ),
+ 'misplaced equals character in block scalar' => array(
<<<'EOT'
data: !!binary |
SGVsbG8gd29ybG=Q
EOT
,
'/The base64 encoded data \(.*\) contains invalid characters/',
- ],
- ];
+ ),
+ );
}
public function testParseDateAsMappingValue()
@@ -1525,7 +1464,7 @@ public function testParseDateAsMappingValue()
$expectedDate->setDate(2002, 12, 14);
$expectedDate->setTime(0, 0, 0);
- $this->assertEquals(['date' => $expectedDate], $this->parser->parse($yaml, Yaml::PARSE_DATETIME));
+ $this->assertEquals(array('date' => $expectedDate), $this->parser->parse($yaml, Yaml::PARSE_DATETIME));
}
/**
@@ -1535,16 +1474,20 @@ public function testParseDateAsMappingValue()
*/
public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yaml)
{
- $this->expectException('\Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage(sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('\Symfony\Component\Yaml\Exception\ParseException');
+ $this->expectExceptionMessage(sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
+ } else {
+ $this->setExpectedException('\Symfony\Component\Yaml\Exception\ParseException', sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber));
+ }
$this->parser->parse($yaml);
}
public function parserThrowsExceptionWithCorrectLineNumberProvider()
{
- return [
- [
+ return array(
+ array(
4,
<<<'YAML'
foo:
@@ -1552,8 +1495,8 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
# bar
bar: "123",
YAML
- ],
- [
+ ),
+ array(
5,
<<<'YAML'
foo:
@@ -1562,8 +1505,8 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
# bar
bar: "123",
YAML
- ],
- [
+ ),
+ array(
8,
<<<'YAML'
foo:
@@ -1575,8 +1518,8 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
# bar
bar: "123",
YAML
- ],
- [
+ ),
+ array(
10,
<<<'YAML'
foo:
@@ -1590,8 +1533,8 @@ public function parserThrowsExceptionWithCorrectLineNumberProvider()
# bar
bar: "123",
YAML
- ],
- ];
+ ),
+ );
}
public function testParseMultiLineQuotedString()
@@ -1604,7 +1547,7 @@ public function testParseMultiLineQuotedString()
bar: baz
EOT;
- $this->assertSame(['foo' => 'bar baz foobar foo', 'bar' => 'baz'], $this->parser->parse($yaml));
+ $this->assertSame(array('foo' => 'bar baz foobar foo', 'bar' => 'baz'), $this->parser->parse($yaml));
}
public function testMultiLineQuotedStringWithTrailingBackslash()
@@ -1615,66 +1558,7 @@ public function testMultiLineQuotedStringWithTrailingBackslash()
bar"
YAML;
- $this->assertSame(['foobar' => 'foobar'], $this->parser->parse($yaml));
- }
-
- public function testCommentCharactersInMultiLineQuotedStrings()
- {
- $yaml = << [
- 'foobar' => 'foo #bar',
- 'bar' => 'baz',
- ],
- ];
-
- $this->assertSame($expected, $this->parser->parse($yaml));
- }
-
- public function testBlankLinesInQuotedMultiLineString()
- {
- $yaml = << "foo\nbar",
- ];
-
- $this->assertSame($expected, $this->parser->parse($yaml));
- }
-
- public function testEscapedQuoteInQuotedMultiLineString()
- {
- $yaml = << 'foo "bar" baz',
- ];
-
- $this->assertSame($expected, $this->parser->parse($yaml));
- }
-
- public function testBackslashInQuotedMultiLineString()
- {
- $yaml = << 'foo bar\\',
- ];
-
- $this->assertSame($expected, $this->parser->parse($yaml));
+ $this->assertSame(array('foobar' => 'foobar'), $this->parser->parse($yaml));
}
public function testParseMultiLineUnquotedString()
@@ -1687,7 +1571,7 @@ public function testParseMultiLineUnquotedString()
bar: baz
EOT;
- $this->assertSame(['foo' => 'bar baz foobar foo', 'bar' => 'baz'], $this->parser->parse($yaml));
+ $this->assertSame(array('foo' => 'bar baz foobar foo', 'bar' => 'baz'), $this->parser->parse($yaml));
}
public function testParseMultiLineString()
@@ -1705,7 +1589,7 @@ public function testParseMultiLineMappingValue($yaml, $expected, $parseError)
public function multiLineDataProvider()
{
- $tests = [];
+ $tests = array();
$yaml = <<<'EOF'
foo:
@@ -1715,15 +1599,15 @@ public function multiLineDataProvider()
two
three
EOF;
- $expected = [
- 'foo' => [
- [
+ $expected = array(
+ 'foo' => array(
+ array(
'bar' => "one\ntwo three",
- ],
- ],
- ];
+ ),
+ ),
+ );
- $tests[] = [$yaml, $expected, false];
+ $tests[] = array($yaml, $expected, false);
$yaml = <<<'EOF'
bar
@@ -1731,7 +1615,7 @@ public function multiLineDataProvider()
EOF;
$expected = 'bar "foo"';
- $tests[] = [$yaml, $expected, false];
+ $tests[] = array($yaml, $expected, false);
$yaml = <<<'EOF'
bar
@@ -1739,7 +1623,7 @@ public function multiLineDataProvider()
EOF;
$expected = 'bar "foo';
- $tests[] = [$yaml, $expected, false];
+ $tests[] = array($yaml, $expected, false);
$yaml = <<<'EOF'
bar
@@ -1748,7 +1632,7 @@ public function multiLineDataProvider()
EOF;
$expected = "bar\n'foo'";
- $tests[] = [$yaml, $expected, false];
+ $tests[] = array($yaml, $expected, false);
$yaml = <<<'EOF'
bar
@@ -1757,14 +1641,14 @@ public function multiLineDataProvider()
EOF;
$expected = "bar\nfoo'";
- $tests[] = [$yaml, $expected, false];
+ $tests[] = array($yaml, $expected, false);
return $tests;
}
public function testTaggedInlineMapping()
{
- $this->assertEquals(new TaggedValue('foo', ['foo' => 'bar']), $this->parser->parse('!foo {foo: bar}', Yaml::PARSE_CUSTOM_TAGS));
+ $this->assertEquals(new TaggedValue('foo', array('foo' => 'bar')), $this->parser->parse('!foo {foo: bar}', Yaml::PARSE_CUSTOM_TAGS));
}
/**
@@ -1777,60 +1661,64 @@ public function testCustomTagSupport($expected, $yaml)
public function taggedValuesProvider()
{
- return [
- 'sequences' => [
- [new TaggedValue('foo', ['yaml']), new TaggedValue('quz', ['bar'])],
+ return array(
+ 'sequences' => array(
+ array(new TaggedValue('foo', array('yaml')), new TaggedValue('quz', array('bar'))),
<< [
- new TaggedValue('foo', ['foo' => new TaggedValue('quz', ['bar']), 'quz' => new TaggedValue('foo', ['quz' => 'bar'])]),
+ ),
+ 'mappings' => array(
+ new TaggedValue('foo', array('foo' => new TaggedValue('quz', array('bar')), 'quz' => new TaggedValue('foo', array('quz' => 'bar')))),
<< [
- [new TaggedValue('foo', ['foo', 'bar']), new TaggedValue('quz', ['foo' => 'bar', 'quz' => new TaggedValue('bar', ['one' => 'bar'])])],
+ ),
+ 'inline' => array(
+ array(new TaggedValue('foo', array('foo', 'bar')), new TaggedValue('quz', array('foo' => 'bar', 'quz' => new TaggedValue('bar', array('one' => 'bar'))))),
<<expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('Tags support is not enabled. Enable the `Yaml::PARSE_CUSTOM_TAGS` flag to use "!iterator" at line 1 (near "!iterator [foo]").');
$this->parser->parse('!iterator [foo]');
}
/**
* @group legacy
- * @expectedDeprecation Using the unquoted scalar value "!iterator foo" is deprecated since Symfony 3.3 and will be considered as a tagged value in 4.0. You must quote it on line 1.
+ * @expectedDeprecation Using the unquoted scalar value "!iterator foo" is deprecated since version 3.3 and will be considered as a tagged value in 4.0. You must quote it on line 1.
*/
public function testUnsupportedTagWithScalar()
{
$this->assertEquals('!iterator foo', $this->parser->parse('!iterator foo'));
}
- public function testExceptionWhenUsingUnsupportedBuiltInTags()
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage The built-in tag "!!foo" is not implemented at line 1 (near "!!foo").
+ */
+ public function testExceptionWhenUsingUnsuportedBuiltInTags()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('The built-in tag "!!foo" is not implemented at line 1 (near "!!foo").');
$this->parser->parse('!!foo');
}
/**
* @group legacy
- * @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line 1.
+ * @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line 1.
*/
public function testComplexMappingThrowsParseException()
{
@@ -1845,7 +1733,7 @@ public function testComplexMappingThrowsParseException()
/**
* @group legacy
- * @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line 2.
+ * @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line 2.
*/
public function testComplexMappingNestedInMappingThrowsParseException()
{
@@ -1861,7 +1749,7 @@ public function testComplexMappingNestedInMappingThrowsParseException()
/**
* @group legacy
- * @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since Symfony 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line 1.
+ * @expectedDeprecation Starting an unquoted string with a question mark followed by a space is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0 on line 1.
*/
public function testComplexMappingNestedInSequenceThrowsParseException()
{
@@ -1874,10 +1762,12 @@ public function testComplexMappingNestedInSequenceThrowsParseException()
$this->parser->parse($yaml);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage Unable to parse at line 1 (near "[parameters]").
+ */
public function testParsingIniThrowsException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('Unable to parse at line 1 (near "[parameters]").');
$ini = <<parseFile(__DIR__.'/Fixtures/'.$testsFile);
foreach ($files as $file) {
$yamls = file_get_contents(__DIR__.'/Fixtures/'.$file.'.yml');
@@ -1908,7 +1798,7 @@ private function loadTestsFromFixtureFiles($testsFile)
} else {
eval('$expected = '.trim($test['php']).';');
- $tests[] = [var_export($expected, true), $test['yaml'], $test['test'], isset($test['deprecated']) ? $test['deprecated'] : false];
+ $tests[] = array(var_export($expected, true), $test['yaml'], $test['test'], isset($test['deprecated']) ? $test['deprecated'] : false);
}
}
}
@@ -1919,7 +1809,7 @@ private function loadTestsFromFixtureFiles($testsFile)
public function testCanParseVeryLongValue()
{
$longStringWithSpaces = str_repeat('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ', 20000);
- $trickyVal = ['x' => $longStringWithSpaces];
+ $trickyVal = array('x' => $longStringWithSpaces);
$yamlString = Yaml::dump($trickyVal);
$arrayFromYaml = $this->parser->parse($yamlString);
@@ -1927,10 +1817,12 @@ public function testCanParseVeryLongValue()
$this->assertEquals($trickyVal, $arrayFromYaml);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage Reference "foo" does not exist at line 2
+ */
public function testParserCleansUpReferencesBetweenRuns()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('Reference "foo" does not exist at line 2');
$yaml = << [
- 'foo' => [
- 'from' => [
+ $expected = array(
+ 'transitions' => array(
+ 'foo' => array(
+ 'from' => array(
'bar',
- ],
+ ),
'to' => 'baz',
- ],
- ],
- ];
+ ),
+ ),
+ );
$this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT));
}
/**
* @group legacy
- * @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 2.
- * @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 4.
- * @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 5.
+ * @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since version 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 2.
+ * @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since version 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 4.
+ * @expectedDeprecation The !php/const: tag to indicate dumped PHP constants is deprecated since version 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead on line 5.
*/
public function testDeprecatedPhpConstantTagMappingKey()
{
@@ -1984,23 +1876,23 @@ public function testDeprecatedPhpConstantTagMappingKey()
- !php/const:Symfony\Component\Yaml\Tests\B::BAR
to: !php/const:Symfony\Component\Yaml\Tests\B::BAZ
YAML;
- $expected = [
- 'transitions' => [
- 'foo' => [
- 'from' => [
+ $expected = array(
+ 'transitions' => array(
+ 'foo' => array(
+ 'from' => array(
'bar',
- ],
+ ),
'to' => 'baz',
- ],
- ],
- ];
+ ),
+ ),
+ );
$this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT));
}
/**
* @group legacy
- * @expectedDeprecation Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since Symfony 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.
+ * @expectedDeprecation Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated since version 3.4 as it will be removed in 4.0. Quote your keys when they are evaluable instead.
*/
public function testPhpConstantTagMappingKeyWithKeysCastToStrings()
{
@@ -2011,48 +1903,20 @@ public function testPhpConstantTagMappingKeyWithKeysCastToStrings()
- !php/const 'Symfony\Component\Yaml\Tests\B::BAR'
to: !php/const 'Symfony\Component\Yaml\Tests\B::BAZ'
YAML;
- $expected = [
- 'transitions' => [
- 'foo' => [
- 'from' => [
+ $expected = array(
+ 'transitions' => array(
+ 'foo' => array(
+ 'from' => array(
'bar',
- ],
+ ),
'to' => 'baz',
- ],
- ],
- ];
+ ),
+ ),
+ );
$this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT | Yaml::PARSE_KEYS_AS_STRINGS));
}
- public function testPhpConstantTagMappingAsScalarKey()
- {
- $yaml = <<assertSame([
- 'map1' => [['foo' => 'value_0', 'bar' => 'value_1']],
- 'map2' => [['foo' => 'value_0', 'bar' => 'value_1']],
- ], $this->parser->parse($yaml, Yaml::PARSE_CONSTANT));
- }
-
- public function testTagMappingAsScalarKey()
- {
- $yaml = <<assertSame([
- 'map1' => [['0' => 'value_0', '1' => 'value_1']],
- ], $this->parser->parse($yaml));
- }
-
public function testMergeKeysWhenMappingsAreParsedAsObjects()
{
$yaml = << (object) [
+ $expected = (object) array(
+ 'foo' => (object) array(
'bar' => 1,
- ],
- 'bar' => (object) [
+ ),
+ 'bar' => (object) array(
'baz' => 2,
'bar' => 1,
- ],
- 'baz' => (object) [
+ ),
+ 'baz' => (object) array(
'baz_foo' => 3,
'baz_bar' => 4,
- ],
- 'foobar' => (object) [
+ ),
+ 'foobar' => (object) array(
'bar' => null,
'baz' => 2,
- ],
- ];
+ ),
+ );
$this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP));
}
@@ -2099,28 +1963,28 @@ public function testFilenamesAreParsedAsStringsWithoutFlag()
public function testParseFile()
{
- $this->assertIsArray($this->parser->parseFile(__DIR__.'/Fixtures/index.yml'));
+ $this->assertInternalType('array', $this->parser->parseFile(__DIR__.'/Fixtures/index.yml'));
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessageRegExp #^File ".+/Fixtures/nonexistent.yml" does not exist\.$#
+ */
public function testParsingNonExistentFilesThrowsException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessageMatches('#^File ".+/Fixtures/nonexistent.yml" does not exist\.$#');
$this->parser->parseFile(__DIR__.'/Fixtures/nonexistent.yml');
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessageRegExp #^File ".+/Fixtures/not_readable.yml" cannot be read\.$#
+ */
public function testParsingNotReadableFilesThrowsException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessageMatches('#^File ".+/Fixtures/not_readable.yml" cannot be read\.$#');
- if ('\\' === \DIRECTORY_SEPARATOR) {
+ if ('\\' === DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported on Windows');
}
- if (!getenv('USER') || 'root' === getenv('USER')) {
- $this->markTestSkipped('This test will fail if run under superuser');
- }
-
$file = __DIR__.'/Fixtures/not_readable.yml';
chmod($file, 0200);
@@ -2139,18 +2003,18 @@ public function testParseReferencesOnMergeKeys()
d: quux
<<: *quux
YAML;
- $expected = [
- 'mergekeyrefdef' => [
+ $expected = array(
+ 'mergekeyrefdef' => array(
'a' => 'foo',
'b' => 'bar',
'c' => 'baz',
- ],
- 'mergekeyderef' => [
+ ),
+ 'mergekeyderef' => array(
'd' => 'quux',
'b' => 'bar',
'c' => 'baz',
- ],
- ];
+ ),
+ );
$this->assertSame($expected, $this->parser->parse($yaml));
}
@@ -2167,228 +2031,33 @@ public function testParseReferencesOnMergeKeysWithMappingsParsedAsObjects()
d: quux
<<: *quux
YAML;
- $expected = (object) [
- 'mergekeyrefdef' => (object) [
+ $expected = (object) array(
+ 'mergekeyrefdef' => (object) array(
'a' => 'foo',
'b' => 'bar',
'c' => 'baz',
- ],
- 'mergekeyderef' => (object) [
+ ),
+ 'mergekeyderef' => (object) array(
'd' => 'quux',
'b' => 'bar',
'c' => 'baz',
- ],
- ];
+ ),
+ );
$this->assertEquals($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP));
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage Reference "foo" does not exist
+ */
public function testEvalRefException()
{
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('Reference "foo" does not exist');
$yaml = <<parser->parse($yaml);
}
-
- /**
- * @dataProvider circularReferenceProvider
- */
- public function testDetectCircularReferences($yaml)
- {
- $this->expectException('Symfony\Component\Yaml\Exception\ParseException');
- $this->expectExceptionMessage('Circular reference [foo, bar, foo] detected');
- $this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS);
- }
-
- public function circularReferenceProvider()
- {
- $tests = [];
-
- $yaml = <<assertSame($expected, $this->parser->parse($yaml));
- }
-
- public function indentedMappingData()
- {
- $tests = [];
-
- $yaml = << [
- [
- 'bar' => 'foobar',
- 'baz' => 'foobaz',
- ],
- ],
- ];
- $tests['comment line is first line in indented block'] = [$yaml, $expected];
-
- $yaml = << [
- [
- 'bar' => [
- 'baz' => [1, 2, 3],
- ],
- ],
- ],
- ];
- $tests['mapping value on new line starting with a comment line'] = [$yaml, $expected];
-
- $yaml = << [
- [
- 'bar' => 'foobar',
- ],
- ],
- ];
- $tests['mapping in sequence starting on a new line'] = [$yaml, $expected];
-
- $yaml = << [
- 'bar' => 'baz',
- ],
- ];
- $tests['blank line at the beginning of an indented mapping value'] = [$yaml, $expected];
-
- return $tests;
- }
-
- public function testMultiLineComment()
- {
- $yaml = <<assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
- }
-
- public function testParseValueWithModifiers()
- {
- $yaml = <<assertSame(
- [
- 'parameters' => [
- 'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']),
- ],
- ],
- $this->parser->parse($yaml)
- );
- }
-
- public function testParseValueWithNegativeModifiers()
- {
- $yaml = <<assertSame(
- [
- 'parameters' => [
- 'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']),
- ],
- ],
- $this->parser->parse($yaml)
- );
- }
-
- /**
- * This is a regression test for a bug where a YAML block with a nested multiline string using | was parsed without
- * a trailing \n when a shorter YAML document was parsed before.
- *
- * When a shorter document was parsed before, the nested string did not have a \n at the end of the string, because
- * the Parser thought it was the end of the file, even though it is not.
- */
- public function testParsingMultipleDocuments()
- {
- $shortDocument = 'foo: bar';
- $longDocument = <<parser->parse($shortDocument);
-
- // After the total number of lines has been reset the result will be the same as if a new parser was used
- // (before, there was no \n after row2)
- $this->assertSame(['a' => ['b' => "row\nrow2\n"], 'c' => 'd'], $this->parser->parse($longDocument));
- }
}
class B
diff --git a/inc.lib/vendor/symfony/yaml/Tests/YamlTest.php b/inc.lib/vendor/symfony/yaml/Tests/YamlTest.php
index 7be12664..3f6c2525 100644
--- a/inc.lib/vendor/symfony/yaml/Tests/YamlTest.php
+++ b/inc.lib/vendor/symfony/yaml/Tests/YamlTest.php
@@ -18,23 +18,27 @@ class YamlTest extends TestCase
{
public function testParseAndDump()
{
- $data = ['lorem' => 'ipsum', 'dolor' => 'sit'];
+ $data = array('lorem' => 'ipsum', 'dolor' => 'sit');
$yml = Yaml::dump($data);
$parsed = Yaml::parse($yml);
$this->assertEquals($data, $parsed);
}
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage The indentation must be greater than zero
+ */
public function testZeroIndentationThrowsException()
{
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage('The indentation must be greater than zero');
- Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, 0);
+ Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, 0);
}
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage The indentation must be greater than zero
+ */
public function testNegativeIndentationThrowsException()
{
- $this->expectException('InvalidArgumentException');
- $this->expectExceptionMessage('The indentation must be greater than zero');
- Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, -4);
+ Yaml::dump(array('lorem' => 'ipsum', 'dolor' => 'sit'), 2, -4);
}
}
diff --git a/inc.lib/vendor/symfony/yaml/Unescaper.php b/inc.lib/vendor/symfony/yaml/Unescaper.php
index 6a12999d..6e863e12 100644
--- a/inc.lib/vendor/symfony/yaml/Unescaper.php
+++ b/inc.lib/vendor/symfony/yaml/Unescaper.php
@@ -128,15 +128,15 @@ private function unescapeCharacter($value)
private static function utf8chr($c)
{
if (0x80 > $c %= 0x200000) {
- return \chr($c);
+ return chr($c);
}
if (0x800 > $c) {
- return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F);
+ return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F);
}
if (0x10000 > $c) {
- return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F);
+ return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
}
- return \chr(0xF0 | $c >> 18).\chr(0x80 | $c >> 12 & 0x3F).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F);
+ return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
}
}
diff --git a/inc.lib/vendor/symfony/yaml/Yaml.php b/inc.lib/vendor/symfony/yaml/Yaml.php
index 87190833..24e3e95c 100644
--- a/inc.lib/vendor/symfony/yaml/Yaml.php
+++ b/inc.lib/vendor/symfony/yaml/Yaml.php
@@ -42,10 +42,11 @@ class Yaml
/**
* Parses a YAML file into a PHP value.
*
- * Usage:
- *
- * $array = Yaml::parseFile('config.yml');
- * print_r($array);
+ * Usage:
+ *
+ * $array = Yaml::parseFile('config.yml');
+ * print_r($array);
+ *
*
* @param string $filename The path to the YAML file to be parsed
* @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
@@ -79,8 +80,8 @@ public static function parseFile($filename, $flags = 0)
*/
public static function parse($input, $flags = 0)
{
- if (\is_bool($flags)) {
- @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED);
+ if (is_bool($flags)) {
+ @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
if ($flags) {
$flags = self::PARSE_EXCEPTION_ON_INVALID_TYPE;
@@ -89,16 +90,16 @@ public static function parse($input, $flags = 0)
}
}
- if (\func_num_args() >= 3) {
- @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_OBJECT flag instead.', \E_USER_DEPRECATED);
+ if (func_num_args() >= 3) {
+ @trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the PARSE_OBJECT flag instead.', E_USER_DEPRECATED);
if (func_get_arg(2)) {
$flags |= self::PARSE_OBJECT;
}
}
- if (\func_num_args() >= 4) {
- @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', \E_USER_DEPRECATED);
+ if (func_num_args() >= 4) {
+ @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', E_USER_DEPRECATED);
if (func_get_arg(3)) {
$flags |= self::PARSE_OBJECT_FOR_MAP;
@@ -125,8 +126,8 @@ public static function parse($input, $flags = 0)
*/
public static function dump($input, $inline = 2, $indent = 4, $flags = 0)
{
- if (\is_bool($flags)) {
- @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED);
+ if (is_bool($flags)) {
+ @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
if ($flags) {
$flags = self::DUMP_EXCEPTION_ON_INVALID_TYPE;
@@ -135,8 +136,8 @@ public static function dump($input, $inline = 2, $indent = 4, $flags = 0)
}
}
- if (\func_num_args() >= 5) {
- @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_OBJECT flag instead.', \E_USER_DEPRECATED);
+ if (func_num_args() >= 5) {
+ @trigger_error('Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the DUMP_OBJECT flag instead.', E_USER_DEPRECATED);
if (func_get_arg(4)) {
$flags |= self::DUMP_OBJECT;
diff --git a/inc.lib/vendor/symfony/yaml/composer.json b/inc.lib/vendor/symfony/yaml/composer.json
index b2f0286e..a31a2cef 100644
--- a/inc.lib/vendor/symfony/yaml/composer.json
+++ b/inc.lib/vendor/symfony/yaml/composer.json
@@ -16,8 +16,7 @@
}
],
"require": {
- "php": "^5.5.9|>=7.0.8",
- "symfony/polyfill-ctype": "~1.8"
+ "php": "^5.5.9|>=7.0.8"
},
"require-dev": {
"symfony/console": "~3.4|~4.0"
@@ -34,5 +33,10 @@
"/Tests/"
]
},
- "minimum-stability": "dev"
+ "minimum-stability": "dev",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.4-dev"
+ }
+ }
}
diff --git a/inc.lib/vendor/symfony/yaml/phpunit.xml.dist b/inc.lib/vendor/symfony/yaml/phpunit.xml.dist
index b5d4d914..7c732f8a 100644
--- a/inc.lib/vendor/symfony/yaml/phpunit.xml.dist
+++ b/inc.lib/vendor/symfony/yaml/phpunit.xml.dist
@@ -1,7 +1,7 @@