Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -0,0 +1,9 @@
<?php
namespace Sly\NotificationPusher\Model;
class ApnsMessage extends Message
{
}

View File

@@ -48,8 +48,8 @@ abstract class BaseOptionedModel
/**
* Get option.
*
* @param string $key Key
* @param mixed $default Default
* @param string $key Key
* @param mixed $default Default
*
* @return mixed
*/
@@ -75,8 +75,8 @@ abstract class BaseOptionedModel
/**
* Set option.
*
* @param string $key Key
* @param mixed $value Value
* @param string $key Key
* @param mixed $value Value
*
* @return mixed
*/

View File

@@ -48,8 +48,8 @@ abstract class BaseParameteredModel
/**
* Get parameter.
*
* @param string $key Key
* @param mixed $default Default
* @param string $key Key
* @param mixed $default Default
*
* @return mixed
*/
@@ -75,8 +75,8 @@ abstract class BaseParameteredModel
/**
* Set parameter.
*
* @param string $key Key
* @param mixed $value Value
* @param string $key Key
* @param mixed $value Value
*
* @return mixed
*/

View File

@@ -26,8 +26,8 @@ class Device extends BaseParameteredModel implements DeviceInterface
/**
* Constructor.
*
* @param string $token Token
* @param array $parameters Parameters
* @param string $token Token
* @param array $parameters Parameters
*/
public function __construct($token, array $parameters = [])
{

View File

@@ -0,0 +1,28 @@
<?php
namespace Sly\NotificationPusher\Model;
class GcmMessage extends Message
{
/**
* @var array
*/
private $notificationData = [];
/**
* @return array
*/
public function getNotificationData()
{
return $this->notificationData;
}
/**
* @param array $notificationData
*/
public function setNotificationData($notificationData)
{
$this->notificationData = $notificationData;
}
}

View File

@@ -21,13 +21,13 @@ class Message extends BaseOptionedModel implements MessageInterface
/**
* @var string
*/
private $text;
protected $text;
/**
* Constructor.
*
* @param string $text Text
* @param array $options Options
* @param string $text Text
* @param array $options Options
*/
public function __construct($text, array $options = [])
{

View File

@@ -11,8 +11,9 @@
namespace Sly\NotificationPusher\Model;
use Sly\NotificationPusher\Collection\DeviceCollection;
use Sly\NotificationPusher\Adapter\AdapterInterface;
use Sly\NotificationPusher\Collection\DeviceCollection;
use Sly\NotificationPusher\Collection\ResponseCollection;
use Sly\NotificationPusher\Exception\AdapterException;
/**
@@ -48,13 +49,18 @@ class Push extends BaseOptionedModel implements PushInterface
*/
private $pushedAt;
/**
* @var \Sly\NotificationPusher\Collection\ResponseCollection
*/
private $responses;
/**
* Constructor.
*
* @param \Sly\NotificationPusher\Adapter\AdapterInterface $adapter Adapter
* @param DeviceInterface|DeviceCollection $devices Device(s)
* @param \Sly\NotificationPusher\Model\MessageInterface $message Message
* @param array $options Options
* @param DeviceInterface|DeviceCollection $devices Device(s)
* @param \Sly\NotificationPusher\Model\MessageInterface $message Message
* @param array $options Options
*
* Options are adapters specific ones, like Apns "badge" or "sound" option for example.
* Of course, they can be more general.
@@ -78,6 +84,7 @@ class Push extends BaseOptionedModel implements PushInterface
/**
* Check devices tokens.
* @throws \Sly\NotificationPusher\Exception\AdapterException
*/
private function checkDevicesTokens()
{
@@ -89,7 +96,7 @@ class Push extends BaseOptionedModel implements PushInterface
throw new AdapterException(
sprintf(
'Adapter %s does not support %s token\'s device',
(string) $adapter,
(string)$adapter,
$device->getToken()
)
);
@@ -128,7 +135,7 @@ class Push extends BaseOptionedModel implements PushInterface
*/
public function isPushed()
{
return (bool) (self::STATUS_PUSHED === $this->status);
return (bool)(self::STATUS_PUSHED === $this->status);
}
/**
@@ -218,6 +225,28 @@ class Push extends BaseOptionedModel implements PushInterface
return $this;
}
/**
* Get Responses
* @return \Sly\NotificationPusher\Collection\ResponseCollection
*/
public function getResponses()
{
if (!$this->responses)
$this->responses = new ResponseCollection();
return $this->responses;
}
/**
* adds a response
* @param \Sly\NotificationPusher\Model\DeviceInterface $device
* @param mixed $response
*/
public function addResponse(DeviceInterface $device, $response)
{
$this->getResponses()->add($device->getToken(), $response);
}
/**
* Get PushedAt.
*

View File

@@ -104,6 +104,19 @@ interface PushInterface
*/
public function setDevices(DeviceCollection $devices);
/**
* Get Responses
* @return \Sly\NotificationPusher\Collection\ResponseCollection
*/
public function getResponses();
/**
* adds a response
* @param \Sly\NotificationPusher\Model\DeviceInterface $device
* @param mixed $response
*/
public function addResponse(DeviceInterface $device, $response);
/**
* Get PushedAt.
*

View File

@@ -0,0 +1,92 @@
<?php
/**
* Created by PhpStorm.
* User: seyfer
* Date: 09.08.17
* Time: 17:57
*/
namespace Sly\NotificationPusher\Model;
use Sly\NotificationPusher\Collection\PushCollection;
class Response implements ResponseInterface
{
/**
* @var array
*/
private $parsedResponses = [];
/**
* @var array
*/
private $originalResponses = [];
/**
* @var PushCollection
*/
private $pushCollection;
/**
* Response constructor.
*/
public function __construct()
{
$this->pushCollection = new PushCollection();
}
/**
* @param DeviceInterface $device
* @param array $response
*/
public function addParsedResponse(DeviceInterface $device, $response)
{
if (!is_array($response)) {
throw new \InvalidArgumentException('Response must be array type');
}
$this->parsedResponses[$device->getToken()] = $response;
}
/**
* @param DeviceInterface $device
* @param mixed $originalResponse
*/
public function addOriginalResponse(DeviceInterface $device, $originalResponse)
{
$this->originalResponses[$device->getToken()] = $originalResponse;
}
/**
* @param \Sly\NotificationPusher\Model\PushInterface $push Push
*/
public function addPush(PushInterface $push)
{
$this->pushCollection->add($push);
}
/**
* @return array
*/
public function getParsedResponses()
{
return $this->parsedResponses;
}
/**
* @return mixed
*/
public function getOriginalResponses()
{
return $this->originalResponses;
}
/**
* @return PushCollection
*/
public function getPushCollection()
{
return $this->pushCollection;
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* Created by PhpStorm.
* User: seyfer
* Date: 10.08.17
* Time: 10:30
*/
namespace Sly\NotificationPusher\Model;
use Sly\NotificationPusher\Collection\PushCollection;
interface ResponseInterface
{
/**
* @param DeviceInterface $device
* @param array $response
*/
public function addParsedResponse(DeviceInterface $device, $response);
/**
* @param DeviceInterface $device
* @param mixed $originalResponse
*/
public function addOriginalResponse(DeviceInterface $device, $originalResponse);
/**
* @param \Sly\NotificationPusher\Model\PushInterface $push Push
*/
public function addPush(PushInterface $push);
/**
* @return array
*/
public function getParsedResponses();
/**
* @return mixed
*/
public function getOriginalResponses();
/**
* @return PushCollection
*/
public function getPushCollection();
}