-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Igor Karpov
committed
Apr 23, 2019
1 parent
1248341
commit e7d5fa2
Showing
77 changed files
with
19,741 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
227 changes: 227 additions & 0 deletions
227
...tion/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/CharacterStream.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of SwiftMailer. | ||
* (c) 2004-2009 Chris Corbyn | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* A CharacterStream implementation which stores characters in an internal array. | ||
* | ||
* @author Xavier De Cock <xdecock@gmail.com> | ||
*/ | ||
class Swift_CharacterStream_CharacterStream implements Swift_CharacterStream | ||
{ | ||
/** | ||
* The char reader (lazy-loaded) for the current charset. | ||
* | ||
* @var Swift_CharacterReader | ||
*/ | ||
private $charReader; | ||
|
||
/** | ||
* A factory for creating CharacterReader instances. | ||
* | ||
* @var Swift_CharacterReaderFactory | ||
*/ | ||
private $charReaderFactory; | ||
|
||
/** | ||
* The character set this stream is using. | ||
* | ||
* @var string | ||
*/ | ||
private $charset; | ||
|
||
/** | ||
* The data's stored as-is. | ||
* | ||
* @var string | ||
*/ | ||
private $datas = ''; | ||
|
||
/** | ||
* Number of bytes in the stream. | ||
* | ||
* @var int | ||
*/ | ||
private $datasSize = 0; | ||
|
||
/** | ||
* Map. | ||
* | ||
* @var mixed | ||
*/ | ||
private $map; | ||
|
||
/** | ||
* Map Type. | ||
* | ||
* @var int | ||
*/ | ||
private $mapType = 0; | ||
|
||
/** | ||
* Number of characters in the stream. | ||
* | ||
* @var int | ||
*/ | ||
private $charCount = 0; | ||
|
||
/** | ||
* Position in the stream. | ||
* | ||
* @var int | ||
*/ | ||
private $currentPos = 0; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param string $charset | ||
*/ | ||
public function __construct(Swift_CharacterReaderFactory $factory, $charset) | ||
{ | ||
$this->setCharacterReaderFactory($factory); | ||
$this->setCharacterSet($charset); | ||
} | ||
|
||
/* -- Changing parameters of the stream -- */ | ||
|
||
/** | ||
* Set the character set used in this CharacterStream. | ||
* | ||
* @param string $charset | ||
*/ | ||
public function setCharacterSet($charset) | ||
{ | ||
$this->charset = $charset; | ||
$this->charReader = null; | ||
$this->mapType = 0; | ||
} | ||
|
||
/** | ||
* Set the CharacterReaderFactory for multi charset support. | ||
*/ | ||
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory) | ||
{ | ||
$this->charReaderFactory = $factory; | ||
} | ||
|
||
public function flushContents() | ||
{ | ||
$this->datas = null; | ||
$this->map = null; | ||
$this->charCount = 0; | ||
$this->currentPos = 0; | ||
$this->datasSize = 0; | ||
} | ||
|
||
public function importByteStream(Swift_OutputByteStream $os) | ||
{ | ||
$this->flushContents(); | ||
$blocks = 512; | ||
$os->setReadPointer(0); | ||
while (false !== ($read = $os->read($blocks))) { | ||
$this->write($read); | ||
} | ||
} | ||
|
||
public function importString($string) | ||
{ | ||
$this->flushContents(); | ||
$this->write($string); | ||
} | ||
|
||
public function read($length) | ||
{ | ||
if ($this->currentPos >= $this->charCount) { | ||
return false; | ||
} | ||
$ret = false; | ||
$length = ($this->currentPos + $length > $this->charCount) ? $this->charCount - $this->currentPos : $length; | ||
switch ($this->mapType) { | ||
case Swift_CharacterReader::MAP_TYPE_FIXED_LEN: | ||
$len = $length * $this->map; | ||
$ret = substr($this->datas, | ||
$this->currentPos * $this->map, | ||
$len); | ||
$this->currentPos += $length; | ||
break; | ||
|
||
case Swift_CharacterReader::MAP_TYPE_INVALID: | ||
$ret = ''; | ||
for (; $this->currentPos < $length; ++$this->currentPos) { | ||
if (isset($this->map[$this->currentPos])) { | ||
$ret .= '?'; | ||
} else { | ||
$ret .= $this->datas[$this->currentPos]; | ||
} | ||
} | ||
break; | ||
|
||
case Swift_CharacterReader::MAP_TYPE_POSITIONS: | ||
$end = $this->currentPos + $length; | ||
$end = $end > $this->charCount ? $this->charCount : $end; | ||
$ret = ''; | ||
$start = 0; | ||
if ($this->currentPos > 0) { | ||
$start = $this->map['p'][$this->currentPos - 1]; | ||
} | ||
$to = $start; | ||
for (; $this->currentPos < $end; ++$this->currentPos) { | ||
if (isset($this->map['i'][$this->currentPos])) { | ||
$ret .= substr($this->datas, $start, $to - $start).'?'; | ||
$start = $this->map['p'][$this->currentPos]; | ||
} else { | ||
$to = $this->map['p'][$this->currentPos]; | ||
} | ||
} | ||
$ret .= substr($this->datas, $start, $to - $start); | ||
break; | ||
} | ||
|
||
return $ret; | ||
} | ||
|
||
public function readBytes($length) | ||
{ | ||
$read = $this->read($length); | ||
if (false !== $read) { | ||
$ret = array_map('ord', str_split($read, 1)); | ||
|
||
return $ret; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public function setPointer($charOffset) | ||
{ | ||
if ($this->charCount < $charOffset) { | ||
$charOffset = $this->charCount; | ||
} | ||
$this->currentPos = $charOffset; | ||
} | ||
|
||
public function write($chars) | ||
{ | ||
if (!isset($this->charReader)) { | ||
$this->charReader = $this->charReaderFactory->getReaderFor( | ||
$this->charset); | ||
$this->map = []; | ||
$this->mapType = $this->charReader->getMapType(); | ||
} | ||
$ignored = ''; | ||
$this->datas .= $chars; | ||
$this->charCount += $this->charReader->getCharPositions(substr($this->datas, $this->datasSize), $this->datasSize, $this->map, $ignored); | ||
if (false !== $ignored) { | ||
$this->datasSize = strlen($this->datas) - strlen($ignored); | ||
} else { | ||
$this->datasSize = strlen($this->datas); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
application/vendor/symfony/debug/Tests/Fixtures/DefinitionInEvaluatedCode.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\Debug\Tests\Fixtures; | ||
|
||
eval(' | ||
namespace Symfony\Component\Debug\Tests\Fixtures; | ||
class DefinitionInEvaluatedCode | ||
{ | ||
} | ||
'); |
22 changes: 22 additions & 0 deletions
22
application/vendor/symfony/debug/Tests/Fixtures/ErrorHandlerThatUsesThePreviousOne.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\Debug\Tests\Fixtures; | ||
|
||
class ErrorHandlerThatUsesThePreviousOne | ||
{ | ||
private static $previous; | ||
|
||
public static function register() | ||
{ | ||
$handler = new static(); | ||
|
||
self::$previous = set_error_handler([$handler, 'handleError']); | ||
|
||
return $handler; | ||
} | ||
|
||
public function handleError($type, $message, $file, $line, $context) | ||
{ | ||
return \call_user_func(self::$previous, $type, $message, $file, $line, $context); | ||
} | ||
} |
Oops, something went wrong.