mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-26 12:52:36 +00:00
Updated Rector to commit 0d99693c36
0d99693c36
Fix crash with pestphp (#69)
This commit is contained in:
parent
4fea0214d5
commit
3284224db9
|
@ -100,6 +100,5 @@ return static function (\RectorPrefix20210518\Symfony\Component\DependencyInject
|
|||
$services->set(\Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider::class)->factory([\RectorPrefix20210518\Symfony\Component\DependencyInjection\Loader\Configurator\service(\Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory::class), 'createDynamicSourceLocatorProvider']);
|
||||
$services->set(\RectorPrefix20210518\Ergebnis\Json\Printer\Printer::class);
|
||||
$services->alias(\RectorPrefix20210518\Ergebnis\Json\Printer\PrinterInterface::class, \RectorPrefix20210518\Ergebnis\Json\Printer\Printer::class);
|
||||
$services->set(\RectorPrefix20210518\PrettyXml\Formatter::class);
|
||||
$services->set(\RectorPrefix20210518\Idiosyncratic\EditorConfig\EditorConfig::class);
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\FileFormatter\Formatter;
|
||||
|
||||
use RectorPrefix20210518\PrettyXml\Formatter;
|
||||
use RectorPrefix20210518\Nette\Utils\Strings;
|
||||
use Rector\Core\ValueObject\Application\File;
|
||||
use Rector\FileFormatter\Contract\Formatter\FileFormatterInterface;
|
||||
use Rector\FileFormatter\ValueObject\EditorConfigConfiguration;
|
||||
|
@ -15,13 +15,21 @@ use Rector\FileFormatter\ValueObjectFactory\EditorConfigConfigurationBuilder;
|
|||
final class XmlFileFormatter implements \Rector\FileFormatter\Contract\Formatter\FileFormatterInterface
|
||||
{
|
||||
/**
|
||||
* @var \PrettyXml\Formatter
|
||||
* @var int|null
|
||||
*/
|
||||
private $xmlFormatter;
|
||||
public function __construct(\RectorPrefix20210518\PrettyXml\Formatter $xmlFormatter)
|
||||
{
|
||||
$this->xmlFormatter = $xmlFormatter;
|
||||
}
|
||||
private $depth;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $indent = 4;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $padChar = ' ';
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $preserveWhitespace = \false;
|
||||
public function supports(\Rector\Core\ValueObject\Application\File $file) : bool
|
||||
{
|
||||
$smartFileInfo = $file->getSmartFileInfo();
|
||||
|
@ -29,9 +37,9 @@ final class XmlFileFormatter implements \Rector\FileFormatter\Contract\Formatter
|
|||
}
|
||||
public function format(\Rector\Core\ValueObject\Application\File $file, \Rector\FileFormatter\ValueObject\EditorConfigConfiguration $editorConfigConfiguration) : void
|
||||
{
|
||||
$this->xmlFormatter->setIndentCharacter($editorConfigConfiguration->getIndentStyleCharacter());
|
||||
$this->xmlFormatter->setIndentSize($editorConfigConfiguration->getIndentSize());
|
||||
$newFileContent = $this->xmlFormatter->format($file->getFileContent());
|
||||
$this->padChar = $editorConfigConfiguration->getIndentStyleCharacter();
|
||||
$this->indent = $editorConfigConfiguration->getIndentSize();
|
||||
$newFileContent = $this->formatXml($file->getFileContent());
|
||||
$newFileContent .= $editorConfigConfiguration->getFinalNewline();
|
||||
$file->changeFileContent($newFileContent);
|
||||
}
|
||||
|
@ -41,4 +49,79 @@ final class XmlFileFormatter implements \Rector\FileFormatter\Contract\Formatter
|
|||
$editorConfigConfigurationBuilder->withIndent(\Rector\FileFormatter\ValueObject\Indent::createTabWithSize(1));
|
||||
return $editorConfigConfigurationBuilder;
|
||||
}
|
||||
private function formatXml(string $xml) : string
|
||||
{
|
||||
$output = '';
|
||||
$this->depth = 0;
|
||||
$parts = $this->getXmlParts($xml);
|
||||
if (\strpos($parts[0], '<?xml') === 0) {
|
||||
$output = \array_shift($parts) . \PHP_EOL;
|
||||
}
|
||||
foreach ($parts as $part) {
|
||||
$output .= $this->getOutputForPart($part);
|
||||
}
|
||||
return \trim($output);
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getXmlParts(string $xml) : array
|
||||
{
|
||||
$xmlParts = '#(>)(<)(\\/*)#';
|
||||
$withNewLines = \RectorPrefix20210518\Nette\Utils\Strings::replace(\trim($xml), $xmlParts, "\$1\n\$2\$3");
|
||||
return \explode("\n", $withNewLines);
|
||||
}
|
||||
private function getOutputForPart(string $part) : string
|
||||
{
|
||||
$output = '';
|
||||
$this->runPre($part);
|
||||
if ($this->preserveWhitespace) {
|
||||
$output .= $part . \PHP_EOL;
|
||||
} else {
|
||||
$part = \trim($part);
|
||||
$output .= $this->getPaddedString($part) . \PHP_EOL;
|
||||
}
|
||||
$this->runPost($part);
|
||||
return $output;
|
||||
}
|
||||
private function runPre(string $part) : void
|
||||
{
|
||||
if ($this->isClosingTag($part)) {
|
||||
--$this->depth;
|
||||
}
|
||||
}
|
||||
private function runPost(string $part) : void
|
||||
{
|
||||
if ($this->isOpeningTag($part)) {
|
||||
++$this->depth;
|
||||
}
|
||||
if ($this->isClosingCdataTag($part)) {
|
||||
$this->preserveWhitespace = \false;
|
||||
}
|
||||
if ($this->isOpeningCdataTag($part)) {
|
||||
$this->preserveWhitespace = \true;
|
||||
}
|
||||
}
|
||||
private function getPaddedString(string $part) : string
|
||||
{
|
||||
return \str_pad($part, \strlen($part) + $this->depth * $this->indent, $this->padChar, \STR_PAD_LEFT);
|
||||
}
|
||||
private function isOpeningTag(string $part) : bool
|
||||
{
|
||||
$isOpeningTag = '#^<[^\\/]*>$#';
|
||||
return (bool) \RectorPrefix20210518\Nette\Utils\Strings::match($part, $isOpeningTag);
|
||||
}
|
||||
private function isClosingTag(string $part) : bool
|
||||
{
|
||||
$isClosingTag = '#^\\s*<\\/#';
|
||||
return (bool) \RectorPrefix20210518\Nette\Utils\Strings::match($part, $isClosingTag);
|
||||
}
|
||||
private function isOpeningCdataTag(string $part) : bool
|
||||
{
|
||||
return \RectorPrefix20210518\Nette\Utils\Strings::contains($part, '<![CDATA[');
|
||||
}
|
||||
private function isClosingCdataTag(string $part) : bool
|
||||
{
|
||||
return \RectorPrefix20210518\Nette\Utils\Strings::contains($part, ']]>');
|
||||
}
|
||||
}
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe::getLoader();
|
||||
return ComposerAutoloaderInit0e03e1fd7e22f066b2f5b697c50ea7a0::getLoader();
|
||||
|
|
2
vendor/composer/InstalledVersions.php
vendored
2
vendor/composer/InstalledVersions.php
vendored
File diff suppressed because one or more lines are too long
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
|
@ -460,7 +460,6 @@ return array(
|
|||
'RectorPrefix20210518\\Nette\\Utils\\UnknownImageFileException' => $vendorDir . '/nette/utils/src/Utils/exceptions.php',
|
||||
'RectorPrefix20210518\\Nette\\Utils\\Validators' => $vendorDir . '/nette/utils/src/Utils/Validators.php',
|
||||
'RectorPrefix20210518\\Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
|
||||
'RectorPrefix20210518\\PrettyXml\\Formatter' => $vendorDir . '/shanethehat/pretty-xml/src/PrettyXml/Formatter.php',
|
||||
'RectorPrefix20210518\\Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php',
|
||||
'RectorPrefix20210518\\Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php',
|
||||
'RectorPrefix20210518\\Psr\\Container\\NotFoundExceptionInterface' => $vendorDir . '/psr/container/src/NotFoundExceptionInterface.php',
|
||||
|
|
1
vendor/composer/autoload_psr4.php
vendored
1
vendor/composer/autoload_psr4.php
vendored
|
@ -56,7 +56,6 @@ return array(
|
|||
'RectorPrefix20210518\\Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
||||
'RectorPrefix20210518\\Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
|
||||
'RectorPrefix20210518\\Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
||||
'RectorPrefix20210518\\PrettyXml\\' => array($vendorDir . '/shanethehat/pretty-xml/src/PrettyXml'),
|
||||
'RectorPrefix20210518\\Idiosyncratic\\EditorConfig\\' => array($vendorDir . '/idiosyncratic/editorconfig/src'),
|
||||
'RectorPrefix20210518\\Ergebnis\\Json\\Printer\\' => array($vendorDir . '/ergebnis/json-printer/src'),
|
||||
'RectorPrefix20210518\\Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'),
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe
|
||||
class ComposerAutoloaderInit0e03e1fd7e22f066b2f5b697c50ea7a0
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0e03e1fd7e22f066b2f5b697c50ea7a0', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0e03e1fd7e22f066b2f5b697c50ea7a0', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0e03e1fd7e22f066b2f5b697c50ea7a0::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit0e03e1fd7e22f066b2f5b697c50ea7a0::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequirefb933298d5e83dc5192f4c302fe5fbbe($fileIdentifier, $file);
|
||||
composerRequire0e03e1fd7e22f066b2f5b697c50ea7a0($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequirefb933298d5e83dc5192f4c302fe5fbbe($fileIdentifier, $file)
|
||||
function composerRequire0e03e1fd7e22f066b2f5b697c50ea7a0($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
|
14
vendor/composer/autoload_static.php
vendored
14
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe
|
||||
class ComposerStaticInit0e03e1fd7e22f066b2f5b697c50ea7a0
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -79,7 +79,6 @@ class ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe
|
|||
'RectorPrefix20210518\\Psr\\Log\\' => 29,
|
||||
'RectorPrefix20210518\\Psr\\EventDispatcher\\' => 41,
|
||||
'RectorPrefix20210518\\Psr\\Container\\' => 35,
|
||||
'RectorPrefix20210518\\PrettyXml\\' => 31,
|
||||
'RectorPrefix20210518\\Idiosyncratic\\EditorConfig\\' => 48,
|
||||
'RectorPrefix20210518\\Ergebnis\\Json\\Printer\\' => 43,
|
||||
'RectorPrefix20210518\\Doctrine\\Inflector\\' => 40,
|
||||
|
@ -296,10 +295,6 @@ class ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe
|
|||
array (
|
||||
0 => __DIR__ . '/..' . '/psr/container/src',
|
||||
),
|
||||
'RectorPrefix20210518\\PrettyXml\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/shanethehat/pretty-xml/src/PrettyXml',
|
||||
),
|
||||
'RectorPrefix20210518\\Idiosyncratic\\EditorConfig\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/idiosyncratic/editorconfig/src',
|
||||
|
@ -789,7 +784,6 @@ class ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe
|
|||
'RectorPrefix20210518\\Nette\\Utils\\UnknownImageFileException' => __DIR__ . '/..' . '/nette/utils/src/Utils/exceptions.php',
|
||||
'RectorPrefix20210518\\Nette\\Utils\\Validators' => __DIR__ . '/..' . '/nette/utils/src/Utils/Validators.php',
|
||||
'RectorPrefix20210518\\Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
|
||||
'RectorPrefix20210518\\PrettyXml\\Formatter' => __DIR__ . '/..' . '/shanethehat/pretty-xml/src/PrettyXml/Formatter.php',
|
||||
'RectorPrefix20210518\\Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php',
|
||||
'RectorPrefix20210518\\Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php',
|
||||
'RectorPrefix20210518\\Psr\\Container\\NotFoundExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/NotFoundExceptionInterface.php',
|
||||
|
@ -3454,9 +3448,9 @@ class ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitfb933298d5e83dc5192f4c302fe5fbbe::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0e03e1fd7e22f066b2f5b697c50ea7a0::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0e03e1fd7e22f066b2f5b697c50ea7a0::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0e03e1fd7e22f066b2f5b697c50ea7a0::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
50
vendor/composer/installed.json
vendored
50
vendor/composer/installed.json
vendored
|
@ -1685,56 +1685,6 @@
|
|||
],
|
||||
"install-path": "..\/sebastian\/diff"
|
||||
},
|
||||
{
|
||||
"name": "shanethehat\/pretty-xml",
|
||||
"version": "1.0.2",
|
||||
"version_normalized": "1.0.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/shanethehat\/pretty-xml.git",
|
||||
"reference": "2b063c6544c8dc9563c53cb72eb06d1d74c9e75f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/shanethehat\/pretty-xml\/zipball\/2b063c6544c8dc9563c53cb72eb06d1d74c9e75f",
|
||||
"reference": "2b063c6544c8dc9563c53cb72eb06d1d74c9e75f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require-dev": {
|
||||
"behat\/behat": "~3.0",
|
||||
"bossa\/phpspec2-expect": "*",
|
||||
"phpspec\/phpspec": "~2.0"
|
||||
},
|
||||
"time": "2015-08-10T14:22:54+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210518\\PrettyXml\\": "src\/PrettyXml\/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https:\/\/packagist.org\/downloads\/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Shane Auckland",
|
||||
"email": "shane.auckland@gmail.com",
|
||||
"homepage": "http:\/\/shaneauckland.co.uk"
|
||||
}
|
||||
],
|
||||
"description": "Library for pretty-printing XML",
|
||||
"keywords": [
|
||||
"pretty",
|
||||
"xml"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/shanethehat\/pretty-xml\/issues",
|
||||
"source": "https:\/\/github.com\/shanethehat\/pretty-xml\/tree\/master"
|
||||
},
|
||||
"install-path": "..\/shanethehat\/pretty-xml"
|
||||
},
|
||||
{
|
||||
"name": "symfony\/config",
|
||||
"version": "v5.2.8",
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
18
vendor/scoper-autoload.php
vendored
18
vendor/scoper-autoload.php
vendored
|
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
|||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210518\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe', false) && !interface_exists('ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe', false) && !trait_exists('ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe', false)) {
|
||||
spl_autoload_call('RectorPrefix20210518\ComposerAutoloaderInitfb933298d5e83dc5192f4c302fe5fbbe');
|
||||
if (!class_exists('ComposerAutoloaderInit0e03e1fd7e22f066b2f5b697c50ea7a0', false) && !interface_exists('ComposerAutoloaderInit0e03e1fd7e22f066b2f5b697c50ea7a0', false) && !trait_exists('ComposerAutoloaderInit0e03e1fd7e22f066b2f5b697c50ea7a0', false)) {
|
||||
spl_autoload_call('RectorPrefix20210518\ComposerAutoloaderInit0e03e1fd7e22f066b2f5b697c50ea7a0');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210518\Doctrine\Inflector\Inflector');
|
||||
|
@ -30,9 +30,6 @@ if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('D
|
|||
if (!class_exists('SomeFormType', false) && !interface_exists('SomeFormType', false) && !trait_exists('SomeFormType', false)) {
|
||||
spl_autoload_call('RectorPrefix20210518\SomeFormType');
|
||||
}
|
||||
if (!class_exists('FeatureContext', false) && !interface_exists('FeatureContext', false) && !trait_exists('FeatureContext', false)) {
|
||||
spl_autoload_call('RectorPrefix20210518\FeatureContext');
|
||||
}
|
||||
if (!class_exists('Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator', false) && !interface_exists('Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator', false) && !trait_exists('Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator', false)) {
|
||||
spl_autoload_call('RectorPrefix20210518\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator');
|
||||
}
|
||||
|
@ -95,9 +92,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210518\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequirefb933298d5e83dc5192f4c302fe5fbbe')) {
|
||||
function composerRequirefb933298d5e83dc5192f4c302fe5fbbe() {
|
||||
return \RectorPrefix20210518\composerRequirefb933298d5e83dc5192f4c302fe5fbbe(...func_get_args());
|
||||
if (!function_exists('composerRequire0e03e1fd7e22f066b2f5b697c50ea7a0')) {
|
||||
function composerRequire0e03e1fd7e22f066b2f5b697c50ea7a0() {
|
||||
return \RectorPrefix20210518\composerRequire0e03e1fd7e22f066b2f5b697c50ea7a0(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
@ -165,11 +162,6 @@ if (!function_exists('ensureDirExists')) {
|
|||
return \RectorPrefix20210518\ensureDirExists(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('expect')) {
|
||||
function expect() {
|
||||
return \RectorPrefix20210518\expect(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('setproctitle')) {
|
||||
function setproctitle() {
|
||||
return \RectorPrefix20210518\setproctitle(...func_get_args());
|
||||
|
|
57
vendor/shanethehat/pretty-xml/README.md
vendored
57
vendor/shanethehat/pretty-xml/README.md
vendored
|
@ -1,57 +0,0 @@
|
|||
# pretty-xml
|
||||
|
||||
A tiny library for pretty printing XML, inspired purely from DomDocument's lack of ability to configure indent distance.
|
||||
|
||||
[![Build Status](https://scrutinizer-ci.com/g/shanethehat/pretty-xml/badges/build.png?b=master)](https://scrutinizer-ci.com/g/shanethehat/pretty-xml/build-status/master)
|
||||
![Quality Score](https://scrutinizer-ci.com/g/shanethehat/pretty-xml/badges/quality-score.png?b=master)
|
||||
[![Latest Stable Version](https://poser.pugx.org/shanethehat/pretty-xml/v/stable)](https://packagist.org/packages/shanethehat/pretty-xml)
|
||||
[![Total Downloads](https://poser.pugx.org/shanethehat/pretty-xml/downloads)](https://packagist.org/packages/shanethehat/pretty-xml)
|
||||
|
||||
## Usage
|
||||
|
||||
Install by adding to your composer.json:
|
||||
|
||||
```
|
||||
{
|
||||
"require": {
|
||||
"shanethehat/pretty-xml": "~1.0.1"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To use, just give it a badly indented (but well formed) XML string:
|
||||
|
||||
```
|
||||
use PrettyXml\Formatter;
|
||||
|
||||
$formatter = new Formatter();
|
||||
echo $formatter->format('<?xml version="1.0" encoding="UTF-8"?><foo><bar>Baz</bar></foo>');
|
||||
```
|
||||
|
||||
You can also change the size of the indent: ```$formatter->setIndentSize(2);```
|
||||
|
||||
And you can change the indent character: ```$formatter->getIndentCharacter("\t");```
|
||||
|
||||
## License and Authors
|
||||
|
||||
Authors: <https://github.com/shanethehat/pretty-xml/contributors>
|
||||
|
||||
Copyright (C) 2014
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
30
vendor/shanethehat/pretty-xml/composer.json
vendored
30
vendor/shanethehat/pretty-xml/composer.json
vendored
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"name": "shanethehat\/pretty-xml",
|
||||
"description": "Library for pretty-printing XML",
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"xml",
|
||||
"pretty"
|
||||
],
|
||||
"require-dev": {
|
||||
"phpspec\/phpspec": "~2.0",
|
||||
"behat\/behat": "~3.0",
|
||||
"bossa\/phpspec2-expect": "*"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Shane Auckland",
|
||||
"email": "shane.auckland@gmail.com",
|
||||
"homepage": "http:\/\/shaneauckland.co.uk"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RectorPrefix20210518\\PrettyXml\\": "src\/PrettyXml\/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
}
|
||||
}
|
926
vendor/shanethehat/pretty-xml/composer.lock
generated
vendored
926
vendor/shanethehat/pretty-xml/composer.lock
generated
vendored
|
@ -1,926 +0,0 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "32608632e763319111ca4f5884aaf85c",
|
||||
"packages": [
|
||||
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "behat/behat",
|
||||
"version": "v3.0.13",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Behat/Behat.git",
|
||||
"reference": "349a6f8188a7d1ad01909d4cd4a73747cd74d09d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Behat/Behat/zipball/349a6f8188a7d1ad01909d4cd4a73747cd74d09d",
|
||||
"reference": "349a6f8188a7d1ad01909d4cd4a73747cd74d09d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"behat/gherkin": "~4.3",
|
||||
"behat/transliterator": "~1.0",
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=5.3.3",
|
||||
"symfony/class-loader": "~2.1",
|
||||
"symfony/config": "~2.3",
|
||||
"symfony/console": "~2.1",
|
||||
"symfony/dependency-injection": "~2.1",
|
||||
"symfony/event-dispatcher": "~2.1",
|
||||
"symfony/translation": "~2.1",
|
||||
"symfony/yaml": "~2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/prophecy-phpunit": "~1.0",
|
||||
"phpunit/phpunit": "~4.0.7",
|
||||
"symfony/process": "~2.1"
|
||||
},
|
||||
"suggest": {
|
||||
"behat/mink-extension": "for integration with Mink testing framework",
|
||||
"behat/symfony2-extension": "for integration with Symfony2 web framework",
|
||||
"behat/yii-extension": "for integration with Yii web framework"
|
||||
},
|
||||
"bin": [
|
||||
"bin/behat"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Behat\\Behat": "src/",
|
||||
"Behat\\Testwork": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Konstantin Kudryashov",
|
||||
"email": "ever.zet@gmail.com",
|
||||
"homepage": "http://everzet.com"
|
||||
}
|
||||
],
|
||||
"description": "Scenario-oriented BDD framework for PHP 5.3",
|
||||
"homepage": "http://behat.org/",
|
||||
"keywords": [
|
||||
"Agile",
|
||||
"BDD",
|
||||
"ScenarioBDD",
|
||||
"Scrum",
|
||||
"StoryBDD",
|
||||
"User story",
|
||||
"business",
|
||||
"development",
|
||||
"documentation",
|
||||
"examples",
|
||||
"symfony",
|
||||
"testing"
|
||||
],
|
||||
"time": "2014-08-28 10:31:09"
|
||||
},
|
||||
{
|
||||
"name": "behat/gherkin",
|
||||
"version": "v4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Behat/Gherkin.git",
|
||||
"reference": "43777c51058b77bcd84a8775b7a6ad05e986b5db"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Behat/Gherkin/zipball/43777c51058b77bcd84a8775b7a6ad05e986b5db",
|
||||
"reference": "43777c51058b77bcd84a8775b7a6ad05e986b5db",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"symfony/yaml": "~2.1"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/yaml": "If you want to parse features, represented in YAML files"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Behat\\Gherkin": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Konstantin Kudryashov",
|
||||
"email": "ever.zet@gmail.com",
|
||||
"homepage": "http://everzet.com"
|
||||
}
|
||||
],
|
||||
"description": "Gherkin DSL parser for PHP 5.3",
|
||||
"homepage": "http://behat.org/",
|
||||
"keywords": [
|
||||
"BDD",
|
||||
"Behat",
|
||||
"Cucumber",
|
||||
"DSL",
|
||||
"gherkin",
|
||||
"parser"
|
||||
],
|
||||
"time": "2014-06-06 01:24:32"
|
||||
},
|
||||
{
|
||||
"name": "behat/transliterator",
|
||||
"version": "v1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Behat/Transliterator.git",
|
||||
"reference": "c93521d3462a554332d1ef5bb0e9b5b8ca4106c4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Behat/Transliterator/zipball/c93521d3462a554332d1ef5bb0e9b5b8ca4106c4",
|
||||
"reference": "c93521d3462a554332d1ef5bb0e9b5b8ca4106c4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Behat\\Transliterator": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Artistic-1.0"
|
||||
],
|
||||
"description": "String transliterator",
|
||||
"keywords": [
|
||||
"i18n",
|
||||
"slug",
|
||||
"transliterator"
|
||||
],
|
||||
"time": "2014-05-15 22:08:22"
|
||||
},
|
||||
{
|
||||
"name": "bossa/phpspec2-expect",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/BossaConsulting/phpspec2-expect.git",
|
||||
"reference": "c7e38fb9dc1c87bc69b008559fb98bd25335d66c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/BossaConsulting/phpspec2-expect/zipball/c7e38fb9dc1c87bc69b008559fb98bd25335d66c",
|
||||
"reference": "c7e38fb9dc1c87bc69b008559fb98bd25335d66c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"phpspec/phpspec": ">=2.0.0-RC3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"expect.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marcello Duarte",
|
||||
"homepage": "http://marcelloduarte.net/"
|
||||
}
|
||||
],
|
||||
"description": "Helper that decorates any SUS with a phpspec lazy object wrapper",
|
||||
"keywords": [
|
||||
"BDD",
|
||||
"SpecBDD",
|
||||
"TDD",
|
||||
"spec",
|
||||
"specification"
|
||||
],
|
||||
"time": "2014-02-21 11:29:39"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
"version": "2.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
||||
"reference": "38743b677965c48a637097b2746a281264ae2347"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/38743b677965c48a637097b2746a281264ae2347",
|
||||
"reference": "38743b677965c48a637097b2746a281264ae2347",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*@stable"
|
||||
},
|
||||
"suggest": {
|
||||
"dflydev/markdown": "1.0.*",
|
||||
"erusev/parsedown": "~0.7"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"phpDocumentor": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mike van Riel",
|
||||
"email": "mike.vanriel@naenius.com"
|
||||
}
|
||||
],
|
||||
"time": "2014-08-09 10:27:07"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/php-diff",
|
||||
"version": "v1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpspec/php-diff.git",
|
||||
"reference": "30e103d19519fe678ae64a60d77884ef3d71b28a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpspec/php-diff/zipball/30e103d19519fe678ae64a60d77884ef3d71b28a",
|
||||
"reference": "30e103d19519fe678ae64a60d77884ef3d71b28a",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Diff": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Chris Boulton",
|
||||
"homepage": "http://github.com/chrisboulton",
|
||||
"role": "Original developer"
|
||||
}
|
||||
],
|
||||
"description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).",
|
||||
"time": "2013-11-01 13:02:21"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/phpspec",
|
||||
"version": "2.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpspec/phpspec.git",
|
||||
"reference": "61712147412cb647b6cb68b19833a60bfda759a1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpspec/phpspec/zipball/61712147412cb647b6cb68b19833a60bfda759a1",
|
||||
"reference": "61712147412cb647b6cb68b19833a60bfda759a1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"phpspec/php-diff": "~1.0.0",
|
||||
"phpspec/prophecy": "~1.1",
|
||||
"symfony/console": "~2.1",
|
||||
"symfony/event-dispatcher": "~2.1",
|
||||
"symfony/finder": "~2.1",
|
||||
"symfony/yaml": "~2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"behat/behat": "~2.5",
|
||||
"bossa/phpspec2-expect": "dev-master",
|
||||
"symfony/filesystem": "~2.1"
|
||||
},
|
||||
"suggest": {
|
||||
"phpspec/nyan-formatters": "~1.0 – Adds Nyan formatters"
|
||||
},
|
||||
"bin": [
|
||||
"bin/phpspec"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"PhpSpec": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Konstantin Kudryashov",
|
||||
"email": "ever.zet@gmail.com",
|
||||
"homepage": "http://everzet.com"
|
||||
},
|
||||
{
|
||||
"name": "Marcello Duarte",
|
||||
"homepage": "http://marcelloduarte.net/"
|
||||
}
|
||||
],
|
||||
"description": "Specification-oriented BDD framework for PHP 5.3+",
|
||||
"homepage": "http://phpspec.net/",
|
||||
"keywords": [
|
||||
"BDD",
|
||||
"SpecBDD",
|
||||
"TDD",
|
||||
"spec",
|
||||
"specification",
|
||||
"testing",
|
||||
"tests"
|
||||
],
|
||||
"time": "2014-07-01 14:09:19"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
"version": "v1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpspec/prophecy.git",
|
||||
"reference": "328484c88ed3cd7d1980b624bb98fa635f212ec9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/328484c88ed3cd7d1980b624bb98fa635f212ec9",
|
||||
"reference": "328484c88ed3cd7d1980b624bb98fa635f212ec9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"phpdocumentor/reflection-docblock": "~2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/phpspec": "~2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Prophecy\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Konstantin Kudryashov",
|
||||
"email": "ever.zet@gmail.com",
|
||||
"homepage": "http://everzet.com"
|
||||
},
|
||||
{
|
||||
"name": "Marcello Duarte",
|
||||
"email": "marcello.duarte@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Highly opinionated mocking framework for PHP 5.3+",
|
||||
"homepage": "http://phpspec.org",
|
||||
"keywords": [
|
||||
"Double",
|
||||
"Dummy",
|
||||
"fake",
|
||||
"mock",
|
||||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"time": "2014-07-18 21:26:55"
|
||||
},
|
||||
{
|
||||
"name": "symfony/class-loader",
|
||||
"version": "v2.5.4",
|
||||
"target-dir": "Symfony/Component/ClassLoader",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/ClassLoader.git",
|
||||
"reference": "9acd88cd723cdd31d0c9ac3fafef0137e6a0e2ad"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/ClassLoader/zipball/9acd88cd723cdd31d0c9ac3fafef0137e6a0e2ad",
|
||||
"reference": "9acd88cd723cdd31d0c9ac3fafef0137e6a0e2ad",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/finder": "~2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\ClassLoader\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony ClassLoader Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-08-31 03:22:04"
|
||||
},
|
||||
{
|
||||
"name": "symfony/config",
|
||||
"version": "v2.5.4",
|
||||
"target-dir": "Symfony/Component/Config",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Config.git",
|
||||
"reference": "080eabdc256c1d7a3a7cf6296271edb68eb1ab2b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Config/zipball/080eabdc256c1d7a3a7cf6296271edb68eb1ab2b",
|
||||
"reference": "080eabdc256c1d7a3a7cf6296271edb68eb1ab2b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/filesystem": "~2.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Config\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Config Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-08-31 03:22:04"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v2.5.4",
|
||||
"target-dir": "Symfony/Component/Console",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Console.git",
|
||||
"reference": "748beed2a1e73179c3f5154d33fe6ae100c1aeb1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Console/zipball/748beed2a1e73179c3f5154d33fe6ae100c1aeb1",
|
||||
"reference": "748beed2a1e73179c3f5154d33fe6ae100c1aeb1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/event-dispatcher": "~2.1"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "For using the console logger",
|
||||
"symfony/event-dispatcher": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Console\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-08-14 16:10:54"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
"version": "v2.5.4",
|
||||
"target-dir": "Symfony/Component/DependencyInjection",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/DependencyInjection.git",
|
||||
"reference": "dcfdfbfdab2dc5bf00e5274719126a3079c6d02c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/dcfdfbfdab2dc5bf00e5274719126a3079c6d02c",
|
||||
"reference": "dcfdfbfdab2dc5bf00e5274719126a3079c6d02c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.2",
|
||||
"symfony/expression-language": "~2.4",
|
||||
"symfony/yaml": "~2.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/config": "",
|
||||
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them",
|
||||
"symfony/yaml": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\DependencyInjection\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony DependencyInjection Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-08-31 03:22:04"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v2.5.4",
|
||||
"target-dir": "Symfony/Component/EventDispatcher",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/EventDispatcher.git",
|
||||
"reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/8faf5cc7e80fde74a650a36e60d32ce3c3e0457b",
|
||||
"reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.0",
|
||||
"symfony/dependency-injection": "~2.0",
|
||||
"symfony/stopwatch": "~2.2"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/dependency-injection": "",
|
||||
"symfony/http-kernel": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\EventDispatcher\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-07-28 13:20:46"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v2.5.4",
|
||||
"target-dir": "Symfony/Component/Filesystem",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Filesystem.git",
|
||||
"reference": "a765efd199e02ff4001c115c318e219030be9364"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Filesystem/zipball/a765efd199e02ff4001c115c318e219030be9364",
|
||||
"reference": "a765efd199e02ff4001c115c318e219030be9364",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Filesystem\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-09-03 09:00:14"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v2.5.4",
|
||||
"target-dir": "Symfony/Component/Finder",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Finder.git",
|
||||
"reference": "f40854d1a19c339c7f969f8f6d6d6e9153311c4c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Finder/zipball/f40854d1a19c339c7f969f8f6d6d6e9153311c4c",
|
||||
"reference": "f40854d1a19c339c7f969f8f6d6d6e9153311c4c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Finder\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-09-03 09:00:14"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v2.5.4",
|
||||
"target-dir": "Symfony/Component/Translation",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Translation.git",
|
||||
"reference": "7526ad65f1961b2422ab33e4d3b05f92be16e5e2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Translation/zipball/7526ad65f1961b2422ab33e4d3b05f92be16e5e2",
|
||||
"reference": "7526ad65f1961b2422ab33e4d3b05f92be16e5e2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.0",
|
||||
"symfony/yaml": "~2.2"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/config": "",
|
||||
"symfony/yaml": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Translation\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-09-03 09:00:14"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v2.5.4",
|
||||
"target-dir": "Symfony/Component/Yaml",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Yaml.git",
|
||||
"reference": "01a7695bcfb013d0a15c6757e15aae120342986f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Yaml/zipball/01a7695bcfb013d0a15c6757e15aae120342986f",
|
||||
"reference": "01a7695bcfb013d0a15c6757e15aae120342986f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Yaml\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "http://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2014-08-31 03:22:04"
|
||||
}
|
||||
],
|
||||
"aliases": [
|
||||
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [
|
||||
|
||||
],
|
||||
"prefer-stable": false,
|
||||
"platform": [
|
||||
|
||||
],
|
||||
"platform-dev": [
|
||||
|
||||
]
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RectorPrefix20210518;
|
||||
|
||||
use RectorPrefix20210518\Behat\Behat\Tester\Exception\PendingException;
|
||||
use RectorPrefix20210518\Behat\Behat\Context\SnippetAcceptingContext;
|
||||
use RectorPrefix20210518\PrettyXml\Formatter;
|
||||
/**
|
||||
* Behat context class.
|
||||
*/
|
||||
class FeatureContext implements \RectorPrefix20210518\Behat\Behat\Context\SnippetAcceptingContext
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $fixtureType;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $formattedXml;
|
||||
/**
|
||||
* @Given I have a :type xml file
|
||||
*/
|
||||
public function iHaveAXmlFile($type)
|
||||
{
|
||||
$this->fixtureType = \str_replace(' ', '_', \strtolower($type));
|
||||
}
|
||||
/**
|
||||
* @When it is formatted by PrettyXML
|
||||
*/
|
||||
public function itIsFormattedByPrettyXml()
|
||||
{
|
||||
$formatter = new \RectorPrefix20210518\PrettyXml\Formatter();
|
||||
$this->formattedXml = $formatter->format($this->getBeforeXml());
|
||||
}
|
||||
/**
|
||||
* @Then it should be correctly formatted
|
||||
*/
|
||||
public function itShouldBeCorrectlyFormatted()
|
||||
{
|
||||
\RectorPrefix20210518\expect($this->formattedXml)->toBe($this->getAfterXml());
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getBeforeXml()
|
||||
{
|
||||
return \file_get_contents(\sprintf('%s/fixtures/before/%s.xml', __DIR__, $this->fixtureType));
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getAfterXml()
|
||||
{
|
||||
return \file_get_contents(\sprintf('%s/fixtures/after/%s.xml', __DIR__, $this->fixtureType));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Behat context class.
|
||||
*/
|
||||
\class_alias('RectorPrefix20210518\\FeatureContext', 'FeatureContext', \false);
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config>
|
||||
<modules>
|
||||
<Behat_Spec>
|
||||
<version>0.1.0</version>
|
||||
</Behat_Spec>
|
||||
</modules>
|
||||
<global>
|
||||
<blocks>
|
||||
<behat_spec>
|
||||
<class>Behat_Spec_Block</class>
|
||||
</behat_spec>
|
||||
</blocks>
|
||||
<helpers>
|
||||
<behat_spec>
|
||||
<class>Behat_Spec_Helper</class>
|
||||
</behat_spec>
|
||||
</helpers>
|
||||
<models>
|
||||
<behat_spec>
|
||||
<class>Behat_Spec_Model</class>
|
||||
<resourceModel>behat_spec_resource</resourceModel>
|
||||
</behat_spec>
|
||||
<behat_spec_resource>
|
||||
<class>Behat_Spec_Model_Resource</class>
|
||||
</behat_spec_resource>
|
||||
</models>
|
||||
</global>
|
||||
<config>
|
||||
<frontend>
|
||||
<routers>
|
||||
<spec>
|
||||
<use>standard</use>
|
||||
<args>
|
||||
<module>Behat_Spec</module>
|
||||
<frontName>spec</frontName>
|
||||
</args>
|
||||
</spec>
|
||||
</routers>
|
||||
</frontend>
|
||||
</config>
|
||||
</config>
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config>
|
||||
<modules>
|
||||
<Behat_Spec>
|
||||
<version>0.1.0</version>
|
||||
</Behat_Spec>
|
||||
</modules>
|
||||
<global>
|
||||
<blocks>
|
||||
<behat_spec>
|
||||
<class>Behat_Spec_Block</class>
|
||||
</behat_spec>
|
||||
</blocks>
|
||||
<helpers>
|
||||
<behat_spec>
|
||||
<class>Behat_Spec_Helper</class>
|
||||
</behat_spec>
|
||||
</helpers>
|
||||
<models>
|
||||
<behat_spec>
|
||||
<class>Behat_Spec_Model</class>
|
||||
<resourceModel>behat_spec_resource</resourceModel>
|
||||
</behat_spec>
|
||||
<behat_spec_resource>
|
||||
<class>Behat_Spec_Model_Resource</class>
|
||||
</behat_spec_resource>
|
||||
</models>
|
||||
</global>
|
||||
<config>
|
||||
<frontend>
|
||||
<routers>
|
||||
<spec>
|
||||
<use>standard</use>
|
||||
<args>
|
||||
<module>Behat_Spec</module>
|
||||
<frontName>spec</frontName>
|
||||
</args>
|
||||
</spec>
|
||||
</routers>
|
||||
</frontend>
|
||||
</config>
|
||||
</config>
|
|
@ -1,9 +0,0 @@
|
|||
Feature: PrettyXML can format XML files for common applications
|
||||
In order to have readable code
|
||||
As an application developer
|
||||
I want PrettyXML to correctly format XML for common applications
|
||||
|
||||
Scenario: It can format a simple Magento config file
|
||||
Given I have a "simple magento config" xml file
|
||||
When it is formatted by PrettyXML
|
||||
Then it should be correctly formatted
|
|
@ -1,159 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RectorPrefix20210518\spec\PrettyXml;
|
||||
|
||||
use RectorPrefix20210518\PhpSpec\ObjectBehavior;
|
||||
class FormatterSpec extends \RectorPrefix20210518\PhpSpec\ObjectBehavior
|
||||
{
|
||||
function it_should_indent_a_nested_element()
|
||||
{
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo><bar>Baz</bar></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar>Baz</bar>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_indent_a_very_nested_element()
|
||||
{
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo><bar><bacon><bob>Baz</bob></bacon></bar></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar>
|
||||
<bacon>
|
||||
<bob>Baz</bob>
|
||||
</bacon>
|
||||
</bar>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_indent_two_nested_elements()
|
||||
{
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo><bar>Baz</bar><egg>Bacon</egg></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar>Baz</bar>
|
||||
<egg>Bacon</egg>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_indent_a_nested_empty_element()
|
||||
{
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo><bar /></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar />
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_indent_double_nested_elements()
|
||||
{
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo><bar><egg /></bar></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar>
|
||||
<egg />
|
||||
</bar>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_indent_a_nested_element_with_an_attribute()
|
||||
{
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo><bar a="b">Baz</bar></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar a="b">Baz</bar>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_indent_a_nested_element_when_parent_has_attributes()
|
||||
{
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo a="b"><bar>Baz</bar></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo a="b">
|
||||
<bar>Baz</bar>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_change_the_size_of_the_indent()
|
||||
{
|
||||
$this->setIndentSize(2);
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo><bar>Baz</bar></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar>Baz</bar>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_change_the_indent_character()
|
||||
{
|
||||
$this->setIndentCharacter('_');
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo><bar>Baz</bar></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
____<bar>Baz</bar>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_remove_existing_excess_whitespace()
|
||||
{
|
||||
$this->format(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar>Baz</bar>
|
||||
<egg>
|
||||
<bacon>Yum</bacon>
|
||||
</egg>
|
||||
</foo>
|
||||
XML
|
||||
)->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar>Baz</bar>
|
||||
<egg>
|
||||
<bacon>Yum</bacon>
|
||||
</egg>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_respects_whitespace_in_cdata_tags()
|
||||
{
|
||||
$this->format(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?><foo>
|
||||
<bar><![CDATA[some
|
||||
whitespaced words
|
||||
blah]]></bar></foo>
|
||||
XML
|
||||
)->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar>
|
||||
<![CDATA[some
|
||||
whitespaced words
|
||||
blah]]>
|
||||
</bar>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
function it_should_support_underscores_in_tag_names()
|
||||
{
|
||||
$this->format('<?xml version="1.0" encoding="UTF-8"?><foo><foo_bar>Baz</foo_bar></foo>')->shouldReturn(<<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<foo_bar>Baz</foo_bar>
|
||||
</foo>
|
||||
XML
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RectorPrefix20210518\PrettyXml;
|
||||
|
||||
class Formatter
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $depth;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $indent = 4;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $padChar = ' ';
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $preserveWhitespace = \false;
|
||||
/**
|
||||
* @param int $indent
|
||||
*/
|
||||
public function setIndentSize($indent)
|
||||
{
|
||||
$this->indent = \intval($indent);
|
||||
}
|
||||
/**
|
||||
* @param string $indentCharacter
|
||||
*/
|
||||
public function setIndentCharacter($indentCharacter)
|
||||
{
|
||||
$this->padChar = $indentCharacter;
|
||||
}
|
||||
/**
|
||||
* @param string $xml
|
||||
* @return string
|
||||
*/
|
||||
public function format($xml)
|
||||
{
|
||||
$output = '';
|
||||
$this->depth = 0;
|
||||
$parts = $this->getXmlParts($xml);
|
||||
if (\strpos($parts[0], '<?xml') === 0) {
|
||||
$output = \array_shift($parts) . \PHP_EOL;
|
||||
}
|
||||
foreach ($parts as $part) {
|
||||
$output .= $this->getOutputForPart($part);
|
||||
}
|
||||
return \trim($output);
|
||||
}
|
||||
/**
|
||||
* @param string $xml
|
||||
* @return array
|
||||
*/
|
||||
private function getXmlParts($xml)
|
||||
{
|
||||
$withNewLines = \preg_replace('/(>)(<)(\\/*)/', "\$1\n\$2\$3", \trim($xml));
|
||||
return \explode("\n", $withNewLines);
|
||||
}
|
||||
/**
|
||||
* @param string $part
|
||||
* @return string
|
||||
*/
|
||||
private function getOutputForPart($part)
|
||||
{
|
||||
$output = '';
|
||||
$this->runPre($part);
|
||||
if ($this->preserveWhitespace) {
|
||||
$output .= $part . \PHP_EOL;
|
||||
} else {
|
||||
$part = \trim($part);
|
||||
$output .= $this->getPaddedString($part) . \PHP_EOL;
|
||||
}
|
||||
$this->runPost($part);
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* @param string $part
|
||||
*/
|
||||
private function runPre($part)
|
||||
{
|
||||
if ($this->isClosingTag($part)) {
|
||||
$this->depth--;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param string $part
|
||||
*/
|
||||
private function runPost($part)
|
||||
{
|
||||
if ($this->isOpeningTag($part)) {
|
||||
$this->depth++;
|
||||
}
|
||||
if ($this->isClosingCdataTag($part)) {
|
||||
$this->preserveWhitespace = \false;
|
||||
}
|
||||
if ($this->isOpeningCdataTag($part)) {
|
||||
$this->preserveWhitespace = \true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param string $part
|
||||
* @return string
|
||||
*/
|
||||
private function getPaddedString($part)
|
||||
{
|
||||
return \str_pad($part, \strlen($part) + $this->depth * $this->indent, $this->padChar, \STR_PAD_LEFT);
|
||||
}
|
||||
/**
|
||||
* @param string $part
|
||||
* @return boolean
|
||||
*/
|
||||
private function isOpeningTag($part)
|
||||
{
|
||||
return (bool) \preg_match('/^<[^\\/]*>$/', $part);
|
||||
}
|
||||
/**
|
||||
* @param string $part
|
||||
* @return boolean
|
||||
*/
|
||||
private function isClosingTag($part)
|
||||
{
|
||||
return (bool) \preg_match('/^\\s*<\\//', $part);
|
||||
}
|
||||
/**
|
||||
* @param string $part
|
||||
* @return boolean
|
||||
*/
|
||||
private function isOpeningCdataTag($part)
|
||||
{
|
||||
return \strpos($part, '<![CDATA[') !== \false;
|
||||
}
|
||||
/**
|
||||
* @param string $part
|
||||
* @return boolean
|
||||
*/
|
||||
private function isClosingCdataTag($part)
|
||||
{
|
||||
return \strpos($part, ']]>') !== \false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user