Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions classes/admin_settings_aws_region.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_settings_aws_region extends \admin_setting_configtext {

/**
* Return part of form with setting.
*
* @param mixed $data array or string depending on setting
* @param string $query
* @return string
*/
public function output_html($data, $query='') {
public function output_html($data, $query = '') {
global $CFG;

$default = $this->get_defaultsetting();
Expand All @@ -63,21 +62,21 @@ public function output_html($data, $query='') {
}
}

$inputparams = array(
$inputparams = [
'type' => 'text',
'list' => $this->get_full_name(),
'name' => $this->get_full_name(),
'value' => $data,
'size' => $this->size,
'id' => $this->get_id(),
'class' => 'form-control text-ltr',
);
];

$element = \html_writer::start_tag('div', array('class' => 'form-text defaultsnext'));
$element = \html_writer::start_tag('div', ['class' => 'form-text defaultsnext']);
$element .= \html_writer::empty_tag('input', $inputparams);
$element .= \html_writer::start_tag('datalist', array('id' => $this->get_full_name()));
$element .= \html_writer::start_tag('datalist', ['id' => $this->get_full_name()]);
foreach ($options as $option) {
$element .= \html_writer::tag('option', $option['label'], array('value' => $option['value']));
$element .= \html_writer::tag('option', $option['label'], ['value' => $option['value']]);
}
$element .= \html_writer::end_tag('datalist');
$element .= \html_writer::end_tag('div');
Expand Down
3 changes: 1 addition & 2 deletions classes/local/aws_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class aws_helper {

/**
* This creates a proxy string suitable for use with the AWS SDK.
*
Expand All @@ -57,7 +56,7 @@ public static function get_proxy_string() {
if (!empty($CFG->proxyhost)) {
$proxy = $CFG->proxyhost;
if (!empty($CFG->proxyport)) {
$proxy .= ':'. $CFG->proxyport;
$proxy .= ':' . $CFG->proxyport;
}
if (!empty($CFG->proxyuser) && !empty($CFG->proxypassword)) {
$proxy = $protocol . $CFG->proxyuser . ':' . $CFG->proxypassword . '@' . $proxy;
Expand Down
2 changes: 1 addition & 1 deletion classes/local/client_factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

namespace local_aws\local;
use \Aws\AwsClient;
use Aws\AwsClient;

/**
* AWS Client factory. Retrieves a client with moodle specific HTTP configuration.
Expand Down
1 change: 0 additions & 1 deletion classes/local/guzzle_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class guzzle_helper {

/**
* Add additional configuration to the Guzzle client. For example, adding additional Middleware.
*
Expand Down
6 changes: 3 additions & 3 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Privacy provider.
*
Expand All @@ -24,22 +25,21 @@
namespace local_aws\privacy;

use core_privacy\local\metadata\null_provider;
use core_privacy\local\legacy_polyfill;

/**
* Class provider
* @author Ilya Tregubov (ilyatregubov@catalyst-au.net)
* @copyright 2018 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements null_provider {
use legacy_polyfill;
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function _get_reason() {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
14 changes: 7 additions & 7 deletions sdk/Aws/Api/Parser/QueryParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ class QueryParser extends AbstractParser
private $honorResultWrapper;

/**
* @param Service $api Service description
* @param XmlParser $xmlParser Optional XML parser
* @param bool $honorResultWrapper Set to false to disable the peeling
* back of result wrappers from the
* output structure.
* @param Service $api Service description
* @param \Aws\Api\Parser\XmlParser $xmlParser Optional XML parser
* @param bool $honorResultWrapper Set to false to disable the peeling
* back of result wrappers from the
* output structure.
*/
public function __construct(
Service $api,
XmlParser $xmlParser = null,
\Aws\Api\Parser\XmlParser $xmlParser = null,
$honorResultWrapper = true
) {
parent::__construct($api);
$this->parser = $xmlParser ?: new XmlParser();
$this->parser = $xmlParser ?: new \Aws\Api\Parser\XmlParser();
$this->honorResultWrapper = $honorResultWrapper;
}

Expand Down
8 changes: 4 additions & 4 deletions sdk/Aws/Api/Parser/RestXmlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class RestXmlParser extends AbstractRestParser
use PayloadParserTrait;

/**
* @param Service $api Service description
* @param XmlParser $parser XML body parser
* @param Service $api Service description
* @param \Aws\Api\Parser\XmlParser $parser XML body parser
*/
public function __construct(Service $api, XmlParser $parser = null)
public function __construct(Service $api, \Aws\Api\Parser\XmlParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new XmlParser();
$this->parser = $parser ?: new \Aws\Api\Parser\XmlParser();
}

protected function payload(
Expand Down
8 changes: 4 additions & 4 deletions sdk/Aws/Crypto/AesDecryptingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getCurrentIv()
return $this->cipherMethod->getCurrentIv();
}

public function getSize()
public function getSize(): ?int
{
$plainTextSize = $this->stream->getSize();

Expand All @@ -80,12 +80,12 @@ public function getSize()
return $plainTextSize;
}

public function isWritable()
public function isWritable(): bool
{
return false;
}

public function read($length)
public function read($length): string
{
if ($length > strlen($this->buffer)) {
$this->buffer .= $this->decryptBlock(
Expand All @@ -101,7 +101,7 @@ public function read($length)
return $data ? $data : '';
}

public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
if ($offset === 0 && $whence === SEEK_SET) {
$this->buffer = '';
Expand Down
8 changes: 4 additions & 4 deletions sdk/Aws/Crypto/AesEncryptingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getCurrentIv()
return $this->cipherMethod->getCurrentIv();
}

public function getSize()
public function getSize(): ?int
{
$plainTextSize = $this->stream->getSize();

Expand All @@ -79,12 +79,12 @@ public function getSize()
return $plainTextSize;
}

public function isWritable()
public function isWritable(): bool
{
return false;
}

public function read($length)
public function read($length): string
{
if ($length > strlen($this->buffer)) {
$this->buffer .= $this->encryptBlock(
Expand All @@ -99,7 +99,7 @@ public function read($length)
return $data ? $data : '';
}

public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
if ($whence === SEEK_CUR) {
$offset = $this->tell() + $offset;
Expand Down
2 changes: 1 addition & 1 deletion sdk/Aws/Crypto/AesGcmDecryptingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function createStream()
}
}

public function isWritable()
public function isWritable(): bool
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/Aws/Crypto/AesGcmEncryptingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function getTag()
return $this->tag;
}

public function isWritable()
public function isWritable(): bool
{
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/Aws/Handler/GuzzleV5/PsrStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public function __construct(GuzzleStreamInterface $stream)
$this->stream = $stream;
}

public function rewind()
public function rewind(): void
{
$this->stream->seek(0);
}

public function getContents()
public function getContents(): string
{
return $this->stream->getContents();
}
Expand Down
9 changes: 5 additions & 4 deletions sdk/Aws/HashingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
$this->callback = $onComplete;
}

public function read($length)
public function read($length): string
{
$data = $this->stream->read($length);
$this->hash->update($data);
Expand All @@ -50,14 +50,15 @@ public function read($length)
return $data;
}

public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
if ($offset === 0) {
$this->hash->reset();
return $this->stream->seek($offset);
$this->stream->seek($offset);
return;
}

// Seeking arbitrarily is not supported.
return false;
throw new \LogicException('Cannot seek to arbitrary positions on a HashingStream');
}
}
26 changes: 13 additions & 13 deletions sdk/GuzzleHttp/Psr7/AppendStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(array $streams = [])
}
}

public function __toString()
public function __toString(): string
{
try {
$this->rewind();
Expand Down Expand Up @@ -62,7 +62,7 @@ public function addStream(StreamInterface $stream)
$this->streams[] = $stream;
}

public function getContents()
public function getContents(): string
{
return Utils::copyToString($this);
}
Expand All @@ -72,7 +72,7 @@ public function getContents()
*
* {@inheritdoc}
*/
public function close()
public function close(): void
{
$this->pos = $this->current = 0;
$this->seekable = true;
Expand Down Expand Up @@ -105,7 +105,7 @@ public function detach()
return null;
}

public function tell()
public function tell(): int
{
return $this->pos;
}
Expand All @@ -118,7 +118,7 @@ public function tell()
*
* {@inheritdoc}
*/
public function getSize()
public function getSize(): ?int
{
$size = 0;

Expand All @@ -133,14 +133,14 @@ public function getSize()
return $size;
}

public function eof()
public function eof(): bool
{
return !$this->streams ||
($this->current >= count($this->streams) - 1 &&
$this->streams[$this->current]->eof());
}

public function rewind()
public function rewind(): void
{
$this->seek(0);
}
Expand All @@ -150,7 +150,7 @@ public function rewind()
*
* {@inheritdoc}
*/
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
if (!$this->seekable) {
throw new \RuntimeException('This AppendStream is not seekable');
Expand Down Expand Up @@ -184,7 +184,7 @@ public function seek($offset, $whence = SEEK_SET)
*
* {@inheritdoc}
*/
public function read($length)
public function read($length): string
{
$buffer = '';
$total = count($this->streams) - 1;
Expand Down Expand Up @@ -219,22 +219,22 @@ public function read($length)
return $buffer;
}

public function isReadable()
public function isReadable(): bool
{
return true;
}

public function isWritable()
public function isWritable(): bool
{
return false;
}

public function isSeekable()
public function isSeekable(): bool
{
return $this->seekable;
}

public function write($string)
public function write($string): int
{
throw new \RuntimeException('Cannot write to an AppendStream');
}
Expand Down
Loading
Loading