mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Small code cleanup
This commit is contained in:
parent
6e1cf74908
commit
9da4fd569b
2 changed files with 7 additions and 7 deletions
|
|
@ -32,7 +32,7 @@ abstract class Collection extends \ArrayObject implements \JsonSerializable
|
||||||
{
|
{
|
||||||
if ($bToTop) {
|
if ($bToTop) {
|
||||||
$array = $this->getArrayCopy();
|
$array = $this->getArrayCopy();
|
||||||
array_unshift($array, $mItem);
|
\array_unshift($array, $mItem);
|
||||||
$this->exchangeArray($array);
|
$this->exchangeArray($array);
|
||||||
} else {
|
} else {
|
||||||
parent::append($mItem);
|
parent::append($mItem);
|
||||||
|
|
@ -53,23 +53,23 @@ abstract class Collection extends \ArrayObject implements \JsonSerializable
|
||||||
public function Slice(int $offset, int $length = null, bool $preserve_keys = false)
|
public function Slice(int $offset, int $length = null, bool $preserve_keys = false)
|
||||||
{
|
{
|
||||||
return new static(
|
return new static(
|
||||||
array_slice($this->getArrayCopy(), $offset, $length, $preserve_keys)
|
\array_slice($this->getArrayCopy(), $offset, $length, $preserve_keys)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Crop(int $length = null, int $offset = 0, bool $preserve_keys = false)
|
public function Crop(int $length = null, int $offset = 0, bool $preserve_keys = false)
|
||||||
{
|
{
|
||||||
$this->exchangeArray(
|
$this->exchangeArray(
|
||||||
array_slice($this->getArrayCopy(), $offset, $length, $preserve_keys)
|
\array_slice($this->getArrayCopy(), $offset, $length, $preserve_keys)
|
||||||
);
|
);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
$aNames = explode('\\', get_class($this));
|
$aNames = \explode('\\', \get_class($this));
|
||||||
return array(
|
return array(
|
||||||
'@Object' => 'Collection/' . end($aNames),
|
'@Object' => 'Collection/' . \end($aNames),
|
||||||
'@Count' => $this->Count(),
|
'@Count' => $this->Count(),
|
||||||
'@Collection' => $this->getArrayCopy()
|
'@Collection' => $this->getArrayCopy()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ class Exception extends \Exception
|
||||||
{
|
{
|
||||||
public function __construct(string $sMessage = '', int $iCode = 0, \Throwable $oPrevious = null)
|
public function __construct(string $sMessage = '', int $iCode = 0, \Throwable $oPrevious = null)
|
||||||
{
|
{
|
||||||
$sMessage = 0 === strlen($sMessage) ? str_replace('\\', '-', get_class($this)).' ('.
|
$sMessage = \strlen($sMessage) ? $sMessage
|
||||||
basename($this->getFile()).' ~ '.$this->getLine().')' : $sMessage;
|
: \str_replace('\\', '-', \get_class($this)).' ('.\basename($this->getFile()).' ~ '.$this->getLine().')';
|
||||||
|
|
||||||
parent::__construct($sMessage, $iCode, $oPrevious);
|
parent::__construct($sMessage, $iCode, $oPrevious);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue