Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -0,0 +1,21 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class AuthorElement extends ManifestElement {
public function getName() {
return $this->getAttributeValue('name');
}
public function getEmail() {
return $this->getAttributeValue('email');
}
}

View File

@@ -0,0 +1,19 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class AuthorElementCollection extends ElementCollection {
public function current() {
return new AuthorElement(
$this->getCurrentElement()
);
}
}

View File

@@ -0,0 +1,19 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class BundlesElement extends ManifestElement {
public function getComponentElements() {
return new ComponentElementCollection(
$this->getChildrenByName('component')
);
}
}

View File

@@ -0,0 +1,21 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class ComponentElement extends ManifestElement {
public function getName() {
return $this->getAttributeValue('name');
}
public function getVersion() {
return $this->getAttributeValue('version');
}
}

View File

@@ -0,0 +1,19 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class ComponentElementCollection extends ElementCollection {
public function current() {
return new ComponentElement(
$this->getCurrentElement()
);
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class ContainsElement extends ManifestElement {
public function getName() {
return $this->getAttributeValue('name');
}
public function getVersion() {
return $this->getAttributeValue('version');
}
public function getType() {
return $this->getAttributeValue('type');
}
public function getExtensionElement() {
return new ExtensionElement(
$this->getChildByName('extension')
);
}
}

View File

@@ -0,0 +1,25 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class CopyrightElement extends ManifestElement {
public function getAuthorElements() {
return new AuthorElementCollection(
$this->getChildrenByName('author')
);
}
public function getLicenseElement() {
return new LicenseElement(
$this->getChildByName('license')
);
}
}

View File

@@ -0,0 +1,58 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
use DOMElement;
use DOMNodeList;
abstract class ElementCollection implements \Iterator {
/**
* @var DOMNodeList
*/
private $nodeList;
private $position;
/**
* ElementCollection constructor.
*
* @param DOMNodeList $nodeList
*/
public function __construct(DOMNodeList $nodeList) {
$this->nodeList = $nodeList;
$this->position = 0;
}
abstract public function current();
/**
* @return DOMElement
*/
protected function getCurrentElement() {
return $this->nodeList->item($this->position);
}
public function next() {
$this->position++;
}
public function key() {
return $this->position;
}
public function valid() {
return $this->position < $this->nodeList->length;
}
public function rewind() {
$this->position = 0;
}
}

View File

@@ -0,0 +1,17 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class ExtElement extends ManifestElement {
public function getName() {
return $this->getAttributeValue('name');
}
}

View File

@@ -0,0 +1,20 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class ExtElementCollection extends ElementCollection {
public function current() {
return new ExtElement(
$this->getCurrentElement()
);
}
}

View File

@@ -0,0 +1,21 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class ExtensionElement extends ManifestElement {
public function getFor() {
return $this->getAttributeValue('for');
}
public function getCompatible() {
return $this->getAttributeValue('compatible');
}
}

View File

@@ -0,0 +1,21 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class LicenseElement extends ManifestElement {
public function getType() {
return $this->getAttributeValue('type');
}
public function getUrl() {
return $this->getAttributeValue('url');
}
}

View File

@@ -0,0 +1,118 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
use DOMDocument;
use DOMElement;
class ManifestDocument {
const XMLNS = 'https://phar.io/xml/manifest/1.0';
/**
* @var DOMDocument
*/
private $dom;
/**
* ManifestDocument constructor.
*
* @param DOMDocument $dom
*/
private function __construct(DOMDocument $dom) {
$this->ensureCorrectDocumentType($dom);
$this->dom = $dom;
}
public static function fromFile($filename) {
if (!file_exists($filename)) {
throw new ManifestDocumentException(
sprintf('File "%s" not found', $filename)
);
}
return self::fromString(
file_get_contents($filename)
);
}
public static function fromString($xmlString) {
$prev = libxml_use_internal_errors(true);
libxml_clear_errors();
$dom = new DOMDocument();
$dom->loadXML($xmlString);
$errors = libxml_get_errors();
libxml_use_internal_errors($prev);
if (count($errors) !== 0) {
throw new ManifestDocumentLoadingException($errors);
}
return new self($dom);
}
public function getContainsElement() {
return new ContainsElement(
$this->fetchElementByName('contains')
);
}
public function getCopyrightElement() {
return new CopyrightElement(
$this->fetchElementByName('copyright')
);
}
public function getRequiresElement() {
return new RequiresElement(
$this->fetchElementByName('requires')
);
}
public function hasBundlesElement() {
return $this->dom->getElementsByTagNameNS(self::XMLNS, 'bundles')->length === 1;
}
public function getBundlesElement() {
return new BundlesElement(
$this->fetchElementByName('bundles')
);
}
private function ensureCorrectDocumentType(DOMDocument $dom) {
$root = $dom->documentElement;
if ($root->localName !== 'phar' || $root->namespaceURI !== self::XMLNS) {
throw new ManifestDocumentException('Not a phar.io manifest document');
}
}
/**
* @param $elementName
*
* @return DOMElement
*
* @throws ManifestDocumentException
*/
private function fetchElementByName($elementName) {
$element = $this->dom->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0);
if (!$element instanceof DOMElement) {
throw new ManifestDocumentException(
sprintf('Element %s missing', $elementName)
);
}
return $element;
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
use LibXMLError;
class ManifestDocumentLoadingException extends \Exception implements Exception {
/**
* @var LibXMLError[]
*/
private $libxmlErrors;
/**
* ManifestDocumentLoadingException constructor.
*
* @param LibXMLError[] $libxmlErrors
*/
public function __construct(array $libxmlErrors) {
$this->libxmlErrors = $libxmlErrors;
$first = $this->libxmlErrors[0];
parent::__construct(
sprintf(
'%s (Line: %d / Column: %d / File: %s)',
$first->message,
$first->line,
$first->column,
$first->file
),
$first->code
);
}
/**
* @return LibXMLError[]
*/
public function getLibxmlErrors() {
return $this->libxmlErrors;
}
}

View File

@@ -0,0 +1,100 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
use DOMElement;
use DOMNodeList;
class ManifestElement {
const XMLNS = 'https://phar.io/xml/manifest/1.0';
/**
* @var DOMElement
*/
private $element;
/**
* ContainsElement constructor.
*
* @param DOMElement $element
*/
public function __construct(DOMElement $element) {
$this->element = $element;
}
/**
* @param string $name
*
* @return string
*
* @throws ManifestElementException
*/
protected function getAttributeValue($name) {
if (!$this->element->hasAttribute($name)) {
throw new ManifestElementException(
sprintf(
'Attribute %s not set on element %s',
$name,
$this->element->localName
)
);
}
return $this->element->getAttribute($name);
}
/**
* @param $elementName
*
* @return DOMElement
*
* @throws ManifestElementException
*/
protected function getChildByName($elementName) {
$element = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0);
if (!$element instanceof DOMElement) {
throw new ManifestElementException(
sprintf('Element %s missing', $elementName)
);
}
return $element;
}
/**
* @param $elementName
*
* @return DOMNodeList
*
* @throws ManifestElementException
*/
protected function getChildrenByName($elementName) {
$elementList = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName);
if ($elementList->length === 0) {
throw new ManifestElementException(
sprintf('Element(s) %s missing', $elementName)
);
}
return $elementList;
}
/**
* @param string $elementName
*
* @return bool
*/
protected function hasChild($elementName) {
return $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->length !== 0;
}
}

View File

@@ -0,0 +1,27 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class PhpElement extends ManifestElement {
public function getVersion() {
return $this->getAttributeValue('version');
}
public function hasExtElements() {
return $this->hasChild('ext');
}
public function getExtElements() {
return new ExtElementCollection(
$this->getChildrenByName('ext')
);
}
}

View File

@@ -0,0 +1,19 @@
<?php
/*
* This file is part of PharIo\Manifest.
*
* (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Manifest;
class RequiresElement extends ManifestElement {
public function getPHPElement() {
return new PhpElement(
$this->getChildByName('php')
);
}
}