for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of Platform package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Karma\System\Gitter;
use Carbon\Carbon;
use Karma\Platform\Io\UserInterface;
use Karma\Platform\Io\AbstractMessage;
use Karma\Platform\Io\ChannelInterface;
* Class GitterMessage
* @package Karma\System\Gitter
class GitterMessage extends AbstractMessage
{
* 5 * 60 sec = 5 min
protected const MESSAGE_EDIT_TIMEOUT = 5 * 60;
* GitterMessage constructor.
* @param ChannelInterface $channel
* @param array $data
public function __construct(ChannelInterface $channel, array $data)
$user = $this->getUserFromMessage($channel, $data);
parent::__construct($channel, $user, $data['id'], $data['html']);
$this->createdAt = Carbon::parse($data['sent']);
}
* @return UserInterface
private function getUserFromMessage(ChannelInterface $channel, array $data): UserInterface
$channel
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
/** @var GitterSystem $system */
$system = $this->getChannel()->getSystem();
return $system->getUser($data['fromUser'], function () use ($system, $data): UserInterface {
getUser()
Karma\Platform\Io\AbstractSystem
This check looks for access to methods that are not accessible from the current context.
If you need to make a method accessible to another context you can raise its visibility level in the defining class.
return new GitterUser($system, $data['fromUser']);
});
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.