laravel-6 support

This commit is contained in:
RafficMohammed
2023-01-08 01:17:22 +05:30
parent 1a5c16ae4b
commit 774eed8b0e
4962 changed files with 279380 additions and 297961 deletions

View File

@@ -1,104 +0,0 @@
<?php
/*
* This file is part of NotificationPusher.
*
* (c) 2013 Cédric Dugat <cedric@dugat.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sly\NotificationPusher\Collection;
use ArrayIterator;
use Countable;
use IteratorAggregate;
use SeekableIterator;
use Sly\NotificationPusher\Model\MessageInterface;
/**
* @uses \IteratorAggregate
* @author Cédric Dugat <cedric@dugat.me>
*/
abstract class AbstractCollection implements IteratorAggregate, Countable
{
/**
* @var ArrayIterator
*/
protected $coll;
/**
* @inheritdoc
* @return ArrayIterator|SeekableIterator
*/
abstract public function getIterator();
/**
* @param string $key Key
*
* @return MessageInterface|false
*/
public function get($key)
{
return isset($this->coll[$key]) ? $this->coll[$key] : false;
}
/**
* @return integer
*/
public function count()
{
return $this->getIterator()->count();
}
/**
* @return boolean
*/
public function isEmpty()
{
return $this->count() === 0;
}
/**
* Clear categories.
*/
public function clear()
{
$this->coll = new ArrayIterator();
}
/**
* @return mixed|null
*/
public function first()
{
$tmp = clone $this->coll;
//go to the beginning
$tmp->rewind();
if (!$tmp->valid()) {
return null;
}
return $tmp->current();
}
/**
* @return mixed|null
*/
public function last()
{
$tmp = clone $this->coll;
//go to the end
$tmp->seek($tmp->count() - 1);
if (!$tmp->valid()) {
return null;
}
return $tmp->current();
}
}

View File

@@ -1,64 +0,0 @@
<?php
/*
* This file is part of NotificationPusher.
*
* (c) 2013 Cédric Dugat <cedric@dugat.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sly\NotificationPusher\Collection;
use Sly\NotificationPusher\Model\DeviceInterface;
/**
* @uses \Sly\NotificationPusher\Collection\AbstractCollection
* @uses \IteratorAggregate
* @author Cédric Dugat <cedric@dugat.me>
*/
class DeviceCollection extends AbstractCollection
{
/**
* @param array $devices Devices
*/
public function __construct(array $devices = [])
{
$this->coll = new \ArrayIterator();
foreach ($devices as $device) {
$this->add($device);
}
}
/**
* @return \ArrayIterator
*/
public function getIterator()
{
return $this->coll;
}
/**
* @param DeviceInterface $device Device
*/
public function add(DeviceInterface $device)
{
$this->coll[$device->getToken()] = $device;
}
/**
* @return array
*/
public function getTokens()
{
$tokens = [];
foreach ($this as $device) {
$tokens[] = $device->getToken();
}
return array_unique(array_filter($tokens));
}
}

View File

@@ -1,43 +0,0 @@
<?php
/*
* This file is part of NotificationPusher.
*
* (c) 2013 Cédric Dugat <cedric@dugat.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sly\NotificationPusher\Collection;
use Sly\NotificationPusher\Model\MessageInterface;
/**
* @uses \Sly\NotificationPusher\Collection\AbstractCollection
* @uses \IteratorAggregate
* @author Cédric Dugat <cedric@dugat.me>
*/
class MessageCollection extends AbstractCollection
{
public function __construct()
{
$this->coll = new \ArrayIterator();
}
/**
* @return \ArrayIterator
*/
public function getIterator()
{
return $this->coll;
}
/**
* @param MessageInterface $message Message
*/
public function add(MessageInterface $message)
{
$this->coll[] = $message;
}
}

View File

@@ -1,43 +0,0 @@
<?php
/*
* This file is part of NotificationPusher.
*
* (c) 2013 Cédric Dugat <cedric@dugat.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sly\NotificationPusher\Collection;
use Sly\NotificationPusher\Model\PushInterface;
/**
* @uses \Sly\NotificationPusher\Collection\AbstractCollection
* @uses \IteratorAggregate
* @author Cédric Dugat <cedric@dugat.me>
*/
class PushCollection extends AbstractCollection
{
public function __construct()
{
$this->coll = new \ArrayIterator();
}
/**
* @return \ArrayIterator
*/
public function getIterator()
{
return $this->coll;
}
/**
* @param PushInterface $push Push
*/
public function add(PushInterface $push)
{
$this->coll[] = $push;
}
}

View File

@@ -1,46 +0,0 @@
<?php
/*
* This file is part of NotificationPusher.
*
* (c) 2016 Lukas Klinzing <theluk@gmail.com>
* (c) 2013 Cédric Dugat <cedric@dugat.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sly\NotificationPusher\Collection;
/**
* Response Collection.
* is just a container for a response from a push service
*
* @uses \Sly\NotificationPusher\Collection\AbstractCollection
* @uses \IteratorAggregate
* @author Lukas Klinzing <theluk@gmail.com>
*/
class ResponseCollection extends AbstractCollection
{
public function __construct()
{
$this->coll = new \ArrayIterator();
}
/**
* @return \ArrayIterator
*/
public function getIterator()
{
return $this->coll;
}
/**
* @param string $token
* @param mixed $response
*/
public function add($token, $response)
{
$this->coll[$token] = $response;
}
}