"ezyang/htmlpurifier": "^4.16",
"guzzlehttp/guzzle": "^7.7.0",
"guzzlehttp/psr7": "^2.5.0",
- "laminas/laminas-diactoros": "^3.0.0",
+ "laminas/laminas-diactoros": "^3.1.0",
"laminas/laminas-httphandlerrunner": "^2.7.0",
- "laminas/laminas-progressbar": "^2.11",
+ "laminas/laminas-progressbar": "^2.12",
"paragonie/constant_time_encoding": "^2.6.3",
"pelago/emogrifier": "^7.0.0",
"psr/clock": "^1.0",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "d814a85f0d1b746a068aee996edf2215",
+ "content-hash": "f22e1ed8363f1981362682c58a866a8a",
"packages": [
{
"name": "cuyz/valinor",
},
{
"name": "laminas/laminas-diactoros",
- "version": "3.0.0",
+ "version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-diactoros.git",
- "reference": "2515f4134258b1b418c23cb86606b8a09dd01aea"
+ "reference": "860660e0774719660699e2b851071555c7b7d45c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/2515f4134258b1b418c23cb86606b8a09dd01aea",
- "reference": "2515f4134258b1b418c23cb86606b8a09dd01aea",
+ "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/860660e0774719660699e2b851071555c7b7d45c",
+ "reference": "860660e0774719660699e2b851071555c7b7d45c",
"shasum": ""
},
"require": {
"type": "community_bridge"
}
],
- "time": "2023-05-04T21:18:23+00:00"
+ "time": "2023-08-01T12:40:44+00:00"
},
{
"name": "laminas/laminas-httphandlerrunner",
},
{
"name": "laminas/laminas-progressbar",
- "version": "2.11.0",
+ "version": "2.12.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-progressbar.git",
- "reference": "f4ab187791a64370825e9012b756e49d568230ea"
+ "reference": "a7cb86bd5cc7ce9a96700297776f567119d65834"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laminas/laminas-progressbar/zipball/f4ab187791a64370825e9012b756e49d568230ea",
- "reference": "f4ab187791a64370825e9012b756e49d568230ea",
+ "url": "https://api.github.com/repos/laminas/laminas-progressbar/zipball/a7cb86bd5cc7ce9a96700297776f567119d65834",
+ "reference": "a7cb86bd5cc7ce9a96700297776f567119d65834",
"shasum": ""
},
"require": {
"zendframework/zend-progressbar": "*"
},
"require-dev": {
- "laminas/laminas-coding-standard": "~1.0.0",
- "laminas/laminas-session": "^2.13",
+ "laminas/laminas-coding-standard": "~2.5.0",
+ "laminas/laminas-session": "^2.16",
"phpunit/phpunit": "^9.5.25"
},
"suggest": {
"type": "community_bridge"
}
],
- "time": "2022-10-25T14:08:59+00:00"
+ "time": "2023-08-01T13:29:34+00:00"
},
{
"name": "laminas/laminas-stdlib",
},
{
"name": "laminas/laminas-diactoros",
- "version": "3.0.0",
- "version_normalized": "3.0.0.0",
+ "version": "3.1.0",
+ "version_normalized": "3.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-diactoros.git",
- "reference": "2515f4134258b1b418c23cb86606b8a09dd01aea"
+ "reference": "860660e0774719660699e2b851071555c7b7d45c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/2515f4134258b1b418c23cb86606b8a09dd01aea",
- "reference": "2515f4134258b1b418c23cb86606b8a09dd01aea",
+ "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/860660e0774719660699e2b851071555c7b7d45c",
+ "reference": "860660e0774719660699e2b851071555c7b7d45c",
"shasum": ""
},
"require": {
"psalm/plugin-phpunit": "^0.18.4",
"vimeo/psalm": "^5.9"
},
- "time": "2023-05-04T21:18:23+00:00",
+ "time": "2023-08-01T12:40:44+00:00",
"type": "library",
"extra": {
"laminas": {
},
{
"name": "laminas/laminas-progressbar",
- "version": "2.11.0",
- "version_normalized": "2.11.0.0",
+ "version": "2.12.0",
+ "version_normalized": "2.12.0.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-progressbar.git",
- "reference": "f4ab187791a64370825e9012b756e49d568230ea"
+ "reference": "a7cb86bd5cc7ce9a96700297776f567119d65834"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laminas/laminas-progressbar/zipball/f4ab187791a64370825e9012b756e49d568230ea",
- "reference": "f4ab187791a64370825e9012b756e49d568230ea",
+ "url": "https://api.github.com/repos/laminas/laminas-progressbar/zipball/a7cb86bd5cc7ce9a96700297776f567119d65834",
+ "reference": "a7cb86bd5cc7ce9a96700297776f567119d65834",
"shasum": ""
},
"require": {
"zendframework/zend-progressbar": "*"
},
"require-dev": {
- "laminas/laminas-coding-standard": "~1.0.0",
- "laminas/laminas-session": "^2.13",
+ "laminas/laminas-coding-standard": "~2.5.0",
+ "laminas/laminas-session": "^2.16",
"phpunit/phpunit": "^9.5.25"
},
"suggest": {
"laminas/laminas-session": "To support progressbar persistent"
},
- "time": "2022-10-25T14:08:59+00:00",
+ "time": "2023-08-01T13:29:34+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
'dev_requirement' => false,
),
'laminas/laminas-diactoros' => array(
- 'pretty_version' => '3.0.0',
- 'version' => '3.0.0.0',
- 'reference' => '2515f4134258b1b418c23cb86606b8a09dd01aea',
+ 'pretty_version' => '3.1.0',
+ 'version' => '3.1.0.0',
+ 'reference' => '860660e0774719660699e2b851071555c7b7d45c',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-diactoros',
'aliases' => array(),
'dev_requirement' => false,
),
'laminas/laminas-progressbar' => array(
- 'pretty_version' => '2.11.0',
- 'version' => '2.11.0.0',
- 'reference' => 'f4ab187791a64370825e9012b756e49d568230ea',
+ 'pretty_version' => '2.12.0',
+ 'version' => '2.12.0.0',
+ 'reference' => 'a7cb86bd5cc7ce9a96700297776f567119d65834',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-progressbar',
'aliases' => array(),
[![Build Status](https://github.com/laminas/laminas-diactoros/workflows/Continuous%20Integration/badge.svg)](https://github.com/laminas/laminas-diactoros/actions/workflows/continuous-integration.yml)
> ## 🇷🇺 Русским гражданам
->
+>
> Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм.
->
+>
> У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую.
->
+>
> Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!"
->
+>
> ## 🇺🇸 To Citizens of Russia
->
+>
> We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism.
->
+>
> One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences.
->
+>
> You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!"
> Diactoros (pronunciation: `/dɪʌktɒrɒs/`): an epithet for Hermes, meaning literally, "the messenger."
namespace Laminas\Diactoros\Response;
+use JsonException;
use Laminas\Diactoros\Exception;
use Laminas\Diactoros\Response;
use Laminas\Diactoros\Stream;
use function is_object;
use function is_resource;
use function json_encode;
-use function json_last_error;
-use function json_last_error_msg;
use function sprintf;
-use const JSON_ERROR_NONE;
use const JSON_HEX_AMP;
use const JSON_HEX_APOS;
use const JSON_HEX_QUOT;
use const JSON_HEX_TAG;
+use const JSON_THROW_ON_ERROR;
use const JSON_UNESCAPED_SLASHES;
/**
// Clear json_last_error()
json_encode(null);
- $json = json_encode($data, $encodingOptions);
-
- if (JSON_ERROR_NONE !== json_last_error()) {
+ try {
+ return json_encode($data, $encodingOptions | JSON_THROW_ON_ERROR);
+ } catch (JsonException $e) {
throw new Exception\InvalidArgumentException(sprintf(
'Unable to encode data to JSON in %s: %s',
self::class,
- json_last_error_msg()
- ));
+ $e->getMessage()
+ ), 0, $e);
}
-
- return $json;
}
private function setPayload(mixed $data): void
+++ /dev/null
-{
- "ignore_php_platform_requirements": {
- "8.2": true
- }
-}
"forum": "https://discourse.laminas.dev"
},
"config": {
- "sort-packages": true
+ "sort-packages": true,
+ "platform": {
+ "php": "8.0.99"
+ },
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ }
},
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"laminas/laminas-stdlib": "^3.2.1"
},
"require-dev": {
- "laminas/laminas-coding-standard": "~1.0.0",
- "laminas/laminas-session": "^2.13",
+ "laminas/laminas-coding-standard": "~2.5.0",
+ "laminas/laminas-session": "^2.16",
"phpunit/phpunit": "^9.5.25"
},
"suggest": {
--- /dev/null
+{
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+ "extends": [
+ "local>laminas/.github:renovate-config"
+ ]
+}
use Laminas\Stdlib\ArrayUtils;
use Traversable;
+use function in_array;
+use function is_array;
+use function method_exists;
+use function strtolower;
+use function ucfirst;
+
/**
* Abstract class for Laminas\ProgressBar Adapters
*/
* @param float $max Max progress value
* @param float $percent Current percent value
* @param int $timeTaken Taken time in seconds
- * @param int $timeRemaining Remaining time in seconds
+ * @param int|null $timeRemaining Remaining time in seconds
* @param string $text Status text
* @return void
*/
namespace Laminas\ProgressBar\Adapter;
-use Laminas\ProgressBar\Adapter\Exception\RuntimeException;
+use Laminas\ProgressBar\Adapter\Exception\InvalidArgumentException;
use Laminas\Stdlib\ErrorHandler;
use Laminas\Stdlib\StringUtils;
+use Traversable;
use ValueError;
+use function array_diff;
+use function ceil;
+use function count;
+use function defined;
+use function fclose;
+use function floor;
+use function fopen;
+use function fwrite;
+use function implode;
+use function in_array;
+use function is_int;
+use function min;
+use function preg_match;
+use function round;
+use function shell_exec;
+use function sprintf;
+use function str_pad;
+use function str_repeat;
+use function strlen;
+use function substr;
+
+use const E_DEPRECATED;
+use const PHP_EOL;
+use const PHP_OS;
+use const STDOUT;
+use const STR_PAD_LEFT;
+use const STR_PAD_RIGHT;
+
/**
* Laminas\ProgressBar\Adapter\Console offers a text-based progressbar for console
* applications
/**
* Percentage value of the progress
*/
- const ELEMENT_PERCENT = 'ELEMENT_PERCENT';
+ public const ELEMENT_PERCENT = 'ELEMENT_PERCENT';
/**
* Visual value of the progress
*/
- const ELEMENT_BAR = 'ELEMENT_BAR';
+ public const ELEMENT_BAR = 'ELEMENT_BAR';
/**
* ETA of the progress
*/
- const ELEMENT_ETA = 'ELEMENT_ETA';
+ public const ELEMENT_ETA = 'ELEMENT_ETA';
/**
* Text part of the progress
*/
- const ELEMENT_TEXT = 'ELEMENT_TEXT';
+ public const ELEMENT_TEXT = 'ELEMENT_TEXT';
/**
* Finish action: End of Line
*/
- const FINISH_ACTION_EOL = 'FINISH_ACTION_EOL';
+ public const FINISH_ACTION_EOL = 'FINISH_ACTION_EOL';
/**
* Finish action: Clear Line
*/
- const FINISH_ACTION_CLEAR_LINE = 'FINISH_ACTION_CLEAR_LINE';
+ public const FINISH_ACTION_CLEAR_LINE = 'FINISH_ACTION_CLEAR_LINE';
/**
* Finish action: None
*/
- const FINISH_ACTION_NONE = 'FINISH_ACTION_NONE';
+ public const FINISH_ACTION_NONE = 'FINISH_ACTION_NONE';
/**
* Width of the progressbar
*
* @var int
*/
- protected $width = null;
+ protected $width;
/**
* Elements to display
*
* @var resource
*/
- protected $outputStream = null;
+ protected $outputStream;
/**
* Width of the text element
/**
* Defined by Laminas\ProgressBar adapter
*
- * @param array|\Traversable $options
+ * @param array|Traversable $options
*/
public function __construct($options = null)
{
* Set a different output-stream
*
* @param string $resource
- * @throws Exception\RuntimeException
+ * @throws RuntimeException
*/
public function setOutputStream($resource)
{
* Set the width of the progressbar
*
* @param int $width
- * @return \Laminas\ProgressBar\Adapter\Console
+ * @return Console
*/
public function setWidth($width = null)
{
* Set the elements to display with the progressbar
*
* @param array $elements
- * @throws \Laminas\ProgressBar\Adapter\Exception\InvalidArgumentException When an invalid element is found
- * in the array
- * @return \Laminas\ProgressBar\Adapter\Console
+ * @throws InvalidArgumentException When an invalid element is found in the array.
+ * @return Console
*/
public function setElements(array $elements)
{
- $allowedElements = [self::ELEMENT_PERCENT,
- self::ELEMENT_BAR,
- self::ELEMENT_ETA,
- self::ELEMENT_TEXT];
+ $allowedElements = [
+ self::ELEMENT_PERCENT,
+ self::ELEMENT_BAR,
+ self::ELEMENT_ETA,
+ self::ELEMENT_TEXT,
+ ];
if (count(array_diff($elements, $allowedElements)) > 0) {
- throw new Exception\InvalidArgumentException('Invalid element found in $elements array');
+ throw new InvalidArgumentException('Invalid element found in $elements array');
}
$this->elements = $elements;
* Set the left-hand character for the bar
*
* @param string $char
- * @throws \Laminas\ProgressBar\Adapter\Exception\InvalidArgumentException When character is empty
- * @return \Laminas\ProgressBar\Adapter\Console
+ * @throws InvalidArgumentException When character is empty.
+ * @return Console
*/
public function setBarLeftChar($char)
{
if (empty($char)) {
- throw new Exception\InvalidArgumentException('Character may not be empty');
+ throw new InvalidArgumentException('Character may not be empty');
}
$this->barLeftChar = (string) $char;
* Set the right-hand character for the bar
*
* @param string $char
- * @throws \Laminas\ProgressBar\Adapter\Exception\InvalidArgumentException When character is empty
- * @return \Laminas\ProgressBar\Adapter\Console
+ * @throws InvalidArgumentException When character is empty.
+ * @return Console
*/
public function setBarRightChar($char)
{
if (empty($char)) {
- throw new Exception\InvalidArgumentException('Character may not be empty');
+ throw new InvalidArgumentException('Character may not be empty');
}
$this->barRightChar = (string) $char;
* Set the indicator character for the bar
*
* @param string $char
- * @return \Laminas\ProgressBar\Adapter\Console
+ * @return Console
*/
public function setBarIndicatorChar($char)
{
* Set the width of the text element
*
* @param int $width
- * @return \Laminas\ProgressBar\Adapter\Console
+ * @return Console
*/
public function setTextWidth($width)
{
* Set the finish action
*
* @param string $action
- * @throws \Laminas\ProgressBar\Adapter\Exception\InvalidArgumentException When an invalid action is specified
- * @return \Laminas\ProgressBar\Adapter\Console
+ * @throws InvalidArgumentException When an invalid action is specified.
+ * @return Console
*/
public function setFinishAction($action)
{
- $allowedActions = [self::FINISH_ACTION_CLEAR_LINE,
- self::FINISH_ACTION_EOL,
- self::FINISH_ACTION_NONE];
+ $allowedActions = [
+ self::FINISH_ACTION_CLEAR_LINE,
+ self::FINISH_ACTION_EOL,
+ self::FINISH_ACTION_NONE,
+ ];
if (! in_array($action, $allowedActions)) {
- throw new Exception\InvalidArgumentException('Invalid finish action specified');
+ throw new InvalidArgumentException('Invalid finish action specified');
}
$this->finishAction = $action;
* @param float $max Max progress value
* @param float $percent Current percent value
* @param int $timeTaken Taken time in seconds
- * @param int $timeRemaining Remaining time in seconds
+ * @param int|null $timeRemaining Remaining time in seconds
* @param string $text Status text
* @return void
*/
if ($this->outputStarted) {
$data = str_repeat("\x08", $this->width);
} else {
- $data = '';
+ $data = '';
$this->outputStarted = true;
}
} else {
$hours = floor($timeRemaining / 3600);
$minutes = floor(($timeRemaining % 3600) / 60);
- $seconds = ($timeRemaining % 3600 % 60);
+ $seconds = $timeRemaining % 3600 % 60;
$etaFormatted = sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds);
}
break;
case self::ELEMENT_TEXT:
- $wrapper = StringUtils::getWrapper($this->charset);
+ $wrapper = StringUtils::getWrapper($this->charset);
$renderedElements[] = $wrapper->strPad(
$wrapper->substr($text, 0, $this->textWidth),
$this->textWidth,
* Set whether to exit after json data send or not
*
* @param bool $exitAfterSend
- * @return \Laminas\ProgressBar\Adapter\JsPull
+ * @return void
*/
public function setExitAfterSend($exitAfterSend)
{
* @param float $max Max progress value
* @param float $percent Current percent value
* @param int $timeTaken Taken time in seconds
- * @param int $timeRemaining Remaining time in seconds
+ * @param int|null $timeRemaining Remaining time in seconds
* @param string $text Status text
* @return void
*/
$arguments = [
'current' => $current,
'max' => $max,
- 'percent' => ($percent * 100),
+ 'percent' => $percent * 100,
'timeTaken' => $timeTaken,
'timeRemaining' => $timeRemaining,
'text' => $text,
- 'finished' => false
+ 'finished' => false,
];
$data = json_encode($arguments, JSON_THROW_ON_ERROR);
namespace Laminas\ProgressBar\Adapter;
+use function flush;
use function json_encode;
+use function ob_flush;
+use function str_pad;
use const JSON_THROW_ON_ERROR;
+use const STR_PAD_RIGHT;
/**
* Laminas\ProgressBar\Adapter\JsPush offers a simple method for updating a
* Set the update method name
*
* @param string $methodName
- * @return \Laminas\ProgressBar\Adapter\JsPush
+ * @return JsPush
*/
public function setUpdateMethodName($methodName)
{
* Set the finish method name
*
* @param string $methodName
- * @return \Laminas\ProgressBar\Adapter\JsPush
+ * @return JsPush
*/
public function setFinishMethodName($methodName)
{
* @param float $max Max progress value
* @param float $percent Current percent value
* @param int $timeTaken Taken time in seconds
- * @param int $timeRemaining Remaining time in seconds
+ * @param int|null $timeRemaining Remaining time in seconds
* @param string $text Status text
* @return void
*/
$arguments = [
'current' => $current,
'max' => $max,
- 'percent' => ($percent * 100),
+ 'percent' => $percent * 100,
'timeTaken' => $timeTaken,
'timeRemaining' => $timeRemaining,
- 'text' => $text
+ 'text' => $text,
];
$data = '<script type="text/javascript">'
namespace Laminas\ProgressBar;
+use Laminas\ProgressBar\Adapter\AbstractAdapter;
use Laminas\Session;
+use function max;
+use function min;
+use function round;
+use function time;
+
/**
* Laminas\ProgressBar offers an interface for multiple environments.
*/
/**
* Adapter for the output
*
- * @var \Laminas\ProgressBar\Adapter\AbstractAdapter
+ * @var AbstractAdapter
*/
protected $adapter;
*
* @var string
*/
- protected $persistenceNamespace = null;
+ protected $persistenceNamespace;
/**
* Create a new progressbar backend.
*
- * @param Adapter\AbstractAdapter $adapter
* @param float|int $min
* @param float|int $max
* @param string|null $persistenceNamespace
- * @throws Exception\OutOfRangeException When $min is greater than $max
+ * @throws Exception\OutOfRangeException When $min is greater than $max.
*/
- public function __construct(Adapter\AbstractAdapter $adapter, $min = 0, $max = 100, $persistenceNamespace = null)
+ public function __construct(AbstractAdapter $adapter, $min = 0, $max = 100, $persistenceNamespace = null)
{
// Check min/max values and set them
if ($min > $max) {
/**
* Get the current adapter
*
- * @return Adapter\AbstractAdapter
+ * @return AbstractAdapter
*/
public function getAdapter()
{
if ($percent === .0 || $percent === false) {
$timeRemaining = null;
} else {
- $timeRemaining = round(((1 / $percent) * $timeTaken) - $timeTaken);
+ $timeRemaining = (int) round(((1 / $percent) * $timeTaken) - $timeTaken);
}
// Poll the adapter
use Laminas\Stdlib\ArrayUtils;
use Traversable;
+use function is_array;
+use function round;
+
/**
* Abstract class for Upload Progress Handlers
*/
abstract class AbstractUploadHandler implements UploadHandlerInterface
{
- /**
- * @var string
- */
- protected $sessionNamespace = 'Laminas\ProgressBar\Upload\AbstractUploadHandler';
+ /** @var string */
+ protected $sessionNamespace = self::class;
- /**
- * @var AbstractProgressAdapter|ProgressBar
- */
+ /** @var AbstractProgressAdapter|ProgressBar */
protected $progressAdapter;
/**
*/
public function getProgress($id)
{
- $status = [
- 'total' => 0,
- 'current' => 0,
- 'rate' => 0,
- 'message' => 'No upload in progress',
- 'done' => true
+ $status = [
+ 'total' => 0,
+ 'current' => 0,
+ 'rate' => 0,
+ 'message' => 'No upload in progress',
+ 'done' => true,
];
if (empty($id)) {
return $status;
}
$status = $newStatus;
if ('' === $status['message']) {
- $status['message'] = $this->toByteString($status['current']) .
- " - " . $this->toByteString($status['total']);
+ $status['message'] = $this->toByteString($status['current'])
+ . " - " . $this->toByteString($status['total']);
}
$status['id'] = $id;
use Laminas\ProgressBar\Exception;
+use function ini_get;
+use function is_array;
+use function is_callable;
+
/**
* Progress Bar Upload Handler for the APC extension
*/
return false;
}
- $status = [
- 'total' => 0,
- 'current' => 0,
- 'rate' => 0,
- 'message' => '',
- 'done' => false
+ $status = [
+ 'total' => 0,
+ 'current' => 0,
+ 'rate' => 0,
+ 'message' => '',
+ 'done' => false,
];
$status = $uploadInfo + $status;
if (! empty($status['cancel_upload'])) {
- $status['done'] = true;
+ $status['done'] = true;
$status['message'] = 'The upload has been canceled';
}
use Laminas\ProgressBar\Exception;
+use function ini_get;
+use function is_array;
+use function time;
+
/**
* Progress Bar Upload Handler for PHP 5.4+ Session Upload Progress handling
*/
}
$sessionKey = ini_get('session.upload_progress.prefix') . $id;
- $uploadInfo = (isset($_SESSION[$sessionKey])) ? $_SESSION[$sessionKey] : null;
+ $uploadInfo = $_SESSION[$sessionKey] ?? null;
if (! is_array($uploadInfo)) {
return false;
}
- $status = [
- 'total' => 0,
- 'current' => 0,
- 'rate' => 0,
- 'message' => '',
- 'done' => false,
+ $status = [
+ 'total' => 0,
+ 'current' => 0,
+ 'rate' => 0,
+ 'message' => '',
+ 'done' => false,
];
- $status = $uploadInfo + $status;
+ $status = $uploadInfo + $status;
$status['total'] = $status['content_length'];
$status['current'] = $status['bytes_processed'];
- $time = time() - $status['start_time'];
- $status['rate'] = ($time > 0) ? $status['bytes_processed'] / $time : 0;
+ $time = time() - $status['start_time'];
+ $status['rate'] = $time > 0 ? $status['bytes_processed'] / $time : 0;
if (! empty($status['cancel_upload'])) {
- $status['done'] = true;
+ $status['done'] = true;
$status['message'] = 'The upload has been canceled';
}
use Laminas\ProgressBar\Exception;
+use function is_array;
+use function is_callable;
+
/**
* Progress Bar Upload Handler for the UploadProgress extension
*/
return false;
}
- $status = [
- 'total' => 0,
- 'current' => 0,
- 'rate' => 0,
- 'message' => '',
- 'done' => false
+ $status = [
+ 'total' => 0,
+ 'current' => 0,
+ 'rate' => 0,
+ 'message' => '',
+ 'done' => false,
];
- $status = $uploadInfo + $status;
+ $status = $uploadInfo + $status;
$status['total'] = $status['bytes_total'];
$status['current'] = $status['bytes_uploaded'];
$status['rate'] = $status['speed_average'];
+
+ // phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedEqualOperator
if ($status['total'] == $status['current']) {
$status['done'] = true;
}