Skip to content
This repository has been archived by the owner on Dec 17, 2018. It is now read-only.

Commit

Permalink
Merge pull request #10 from cleentfaar/removing-factory
Browse files Browse the repository at this point in the history
Removed factory, simplified event handling and a lot of cs fixes
  • Loading branch information
cleentfaar committed Feb 18, 2015
2 parents 8e07111 + c0446c8 commit 8fec3c5
Show file tree
Hide file tree
Showing 91 changed files with 485 additions and 732 deletions.
1 change: 0 additions & 1 deletion src/CL/Slack/Exception/SlackException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@

class SlackException extends \Exception
{

}
1 change: 0 additions & 1 deletion src/CL/Slack/Model/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@
*/
abstract class AbstractModel
{

}
10 changes: 1 addition & 9 deletions src/CL/Slack/Model/Customizable.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,11 @@ public function getCreator()
/**
* Returns the last date on which this customizable was customized ^_^,
* or null if this was the first change
*
*
* @return \DateTime|null
*/
public function getLastSet()
{
return $this->lastSet;
}

/**
* @return string
*/
public function __toString()
{
return (string) $this->value;
}
}
4 changes: 2 additions & 2 deletions src/CL/Slack/Model/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
class Message extends SimpleMessage
{
/**
* @var Channel
* @var Channel|null
*/
private $channel;

/**
* @var string|null
*/
Expand Down
2 changes: 1 addition & 1 deletion src/CL/Slack/Model/SimpleMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class SimpleMessage extends AbstractModel
/**
* @return string|null The Slack timestamp on which the message was posted
*/
public function getTimestamp()
public function getSlackTimestamp()
{
return $this->ts;
}
Expand Down
4 changes: 2 additions & 2 deletions src/CL/Slack/Payload/AbstractPayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public function getError()
public function getErrorExplanation()
{
if (null === $error = $this->getError()) {
return null;
return;
}

$ownErrors = $this->getPossibleErrors();
if (array_key_exists($error, $ownErrors)) {
return $ownErrors[$error];
}

return sprintf('Unknown error: %s', $error);
return sprintf('Unknown error (%s)', $error);
}

/**
Expand Down
6 changes: 0 additions & 6 deletions src/CL/Slack/Payload/AbstractSearchPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
*/
abstract class AbstractSearchPayload extends AbstractPayload
{
const SORT_SCORE = 'score';
const SORT_TIMESTAMP = 'timestamp';

const SORT_DIR_ASC = 'asc';
const SORT_DIR_DESC = 'desc';

/**
* @var string
*/
Expand Down
6 changes: 3 additions & 3 deletions src/CL/Slack/Payload/ApiTestPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ApiTestPayload extends AbstractPayload
* @var string
*/
private $error;

/**
* @param array $args
*/
Expand All @@ -49,15 +49,15 @@ public function addArgument($key, $value)

/**
* @param string $key
*
*
* @return mixed
*/
public function getArgument($key)
{
if (!array_key_exists($key, $this->args)) {
throw new \InvalidArgumentException(sprintf('There is no argument with that name: "%s"', $key));
}

return $this->args[$key];
}

Expand Down
2 changes: 1 addition & 1 deletion src/CL/Slack/Payload/AuthTestPayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getTeam()
{
return $this->team;
}

/**
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion src/CL/Slack/Payload/ChannelsInvitePayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ChannelsInvitePayload extends AbstractPayload
* @var string
*/
private $channel;

/**
* @var string
*/
Expand Down
4 changes: 2 additions & 2 deletions src/CL/Slack/Payload/ChannelsMarkPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public function getChannelId()
/**
* @param string $timestamp
*/
public function setTimestamp($timestamp)
public function setSlackTimestamp($timestamp)
{
$this->ts = $timestamp;
}

/**
* @return string
*/
public function getTimestamp()
public function getSlackTimestamp()
{
return $this->ts;
}
Expand Down
2 changes: 1 addition & 1 deletion src/CL/Slack/Payload/ChannelsSetPurposePayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getPurpose()
protected function getPossibleErrors()
{
return array_merge(parent::getPossibleErrors(), [
'too_long' => 'Purpose was longer than 250 characters.'
'too_long' => 'Purpose was longer than 250 characters.',
]);
}
}
2 changes: 1 addition & 1 deletion src/CL/Slack/Payload/ChannelsSetTopicPayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getTopic()
protected function getPossibleErrors()
{
return array_merge(parent::getPossibleErrors(), [
'too_long' => 'Topic was longer than 250 characters.'
'too_long' => 'Topic was longer than 250 characters.',
]);
}
}
4 changes: 2 additions & 2 deletions src/CL/Slack/Payload/ChatDeletePayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public function getChannelId()
/**
* @param string $timestamp
*/
public function setTimestamp($timestamp)
public function setSlackTimestamp($timestamp)
{
$this->ts = $timestamp;
}

/**
* @return string
*/
public function getTimestamp()
public function getSlackTimestamp()
{
return $this->ts;
}
Expand Down
2 changes: 1 addition & 1 deletion src/CL/Slack/Payload/ChatDeletePayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getChannelId()
/**
* @return string
*/
public function getTimestamp()
public function getSlackTimestamp()
{
return $this->ts;
}
Expand Down
6 changes: 3 additions & 3 deletions src/CL/Slack/Payload/ChatPostMessagePayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ChatPostMessagePayload extends AbstractPayload
private $unfurlMedia;

/**
* @var string
* @var boolean
*/
private $linkNames;

Expand Down Expand Up @@ -115,7 +115,7 @@ public function getText()

/**
* @param string $message
*
*
* @deprecated Will be removed soon, use `setText()` instead
*/
public function setMessage($message)
Expand All @@ -125,7 +125,7 @@ public function setMessage($message)

/**
* @return string
*
*
* @deprecated Will be removed soon, use `getText()` instead
*/
public function getMessage()
Expand Down
6 changes: 3 additions & 3 deletions src/CL/Slack/Payload/ChatPostMessagePayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class ChatPostMessagePayloadResponse extends AbstractPayloadResponse
/**
* @return string|null The Slack timestamp on which your message has been posted, or null if the call failed
*/
public function getTimestamp()
public function getSlackTimestamp()
{
return $this->ts;
}

/**
* @return string|null The Slack channel on which your message has been posted, or null if the call failed
* @return string|null The Slack channel ID on which your message has been posted, or null if the call failed
*/
public function getChannel()
public function getChannelId()
{
return $this->channel;
}
Expand Down
4 changes: 2 additions & 2 deletions src/CL/Slack/Payload/ChatUpdatePayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ public function getChannelId()
/**
* @param string $timestamp
*/
public function setTimestamp($timestamp)
public function setSlackTimestamp($timestamp)
{
$this->ts = $timestamp;
}

/**
* @return string
*/
public function getTimestamp()
public function getSlackTimestamp()
{
return $this->ts;
}
Expand Down
2 changes: 1 addition & 1 deletion src/CL/Slack/Payload/ChatUpdatePayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getChannelId()
/**
* @return string
*/
public function getTimestamp()
public function getSlackTimestamp()
{
return $this->ts;
}
Expand Down
4 changes: 2 additions & 2 deletions src/CL/Slack/Payload/EmojiListPayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
class EmojiListPayloadResponse extends AbstractPayloadResponse
{
/**
* @var array<string, string>
* @var array
*/
private $emoji = [];

/**
* @return array<string, string>
* @return array
*/
public function getEmojis()
{
Expand Down
2 changes: 1 addition & 1 deletion src/CL/Slack/Payload/FilesUploadPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getChannels()
{
return $this->channels;
}

/**
* @param string|null $filename
*/
Expand Down
14 changes: 0 additions & 14 deletions src/CL/Slack/Payload/GroupsArchivePayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,4 @@ public function getMethod()
{
return 'groups.archive';
}

/**
* {@inheritdoc}
*/
protected function getPossibleErrors()
{
return array_merge(parent::getPossibleErrors(), [
'channel_not_found' => 'Value passed for group was invalid',
'already_archived' => 'Group has already been archived',
'group_contains_others' => 'Restricted accounts cannot archive groups containing others',
'last_ra_channel' => 'You cannot archive the last channel for a restricted account',
'restricted_action' => 'A team preference prevents authenticated user from archiving',
]);
}
}
13 changes: 13 additions & 0 deletions src/CL/Slack/Payload/GroupsArchivePayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,17 @@
*/
class GroupsArchivePayloadResponse extends AbstractPayloadResponse
{
/**
* {@inheritdoc}
*/
protected function getPossibleErrors()
{
return array_merge(parent::getPossibleErrors(), [
'channel_not_found' => 'Value passed for group was invalid',
'already_archived' => 'Group has already been archived',
'group_contains_others' => 'Restricted accounts cannot archive groups containing others',
'last_ra_channel' => 'You cannot archive the last channel for a restricted account',
'restricted_action' => 'A team preference prevents authenticated user from archiving',
]);
}
}
14 changes: 0 additions & 14 deletions src/CL/Slack/Payload/GroupsClosePayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,4 @@ public function getMethod()
{
return 'groups.close';
}

/**
* {@inheritdoc}
*/
protected function getPossibleErrors()
{
return array_merge(parent::getPossibleErrors(), [
'channel_not_found' => 'Value passed for group was invalid',
'already_archived' => 'Group has already been archived',
'group_contains_others' => 'Restricted accounts cannot archive groups containing others',
'last_ra_channel' => 'You cannot archive the last channel for a restricted account',
'restricted_action' => 'A team preference prevents authenticated user from archiving',
]);
}
}
14 changes: 14 additions & 0 deletions src/CL/Slack/Payload/GroupsClosePayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,18 @@ public function isNoOp()
{
return $this->noOp;
}

/**
* {@inheritdoc}
*/
protected function getPossibleErrors()
{
return array_merge(parent::getPossibleErrors(), [
'channel_not_found' => 'Value passed for group was invalid',
'already_archived' => 'Group has already been archived',
'group_contains_others' => 'Restricted accounts cannot archive groups containing others',
'last_ra_channel' => 'You cannot archive the last channel for a restricted account',
'restricted_action' => 'A team preference prevents authenticated user from archiving',
]);
}
}
4 changes: 2 additions & 2 deletions src/CL/Slack/Payload/GroupsMarkPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ public function getGroupId()
/**
* @param string $timestamp
*/
public function setTimestamp($timestamp)
public function setSlackTimestamp($timestamp)
{
$this->ts = $timestamp;
}

/**
* @return string
*/
public function getTimestamp()
public function getSlackTimestamp()
{
return $this->ts;
}
Expand Down
2 changes: 1 addition & 1 deletion src/CL/Slack/Payload/GroupsSetPurposePayloadResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getPurpose()
protected function getPossibleErrors()
{
return array_merge(parent::getPossibleErrors(), [
'too_long' => 'Purpose was longer than 250 characters.'
'too_long' => 'Purpose was longer than 250 characters.',
]);
}
}
Loading

0 comments on commit 8fec3c5

Please sign in to comment.