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
5 changes: 5 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2011-11-18 Evgeny V. Kokovikhin

* main/Messages/TextMessage.class.php, main/Messages/TextFileReceiver.class.php :
a bit optimize: don't needed to make Timestamp twice

2011-11-14 Dmitry V. Snezhinskiy

* main/Utils/AMQP/Pecl/AMQPPeclChannel.class.php :
Expand Down
3 changes: 1 addition & 2 deletions main/Messages/TextFileReceiver.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public function receive($uTimeout = null)

Assert::isNotNull($time);

$result = TextMessage::create()->
setTimestamp(Timestamp::create($time))->
$result = TextMessage::create(Timestamp::create($time))->
setText($text);

return $result;
Expand Down
10 changes: 5 additions & 5 deletions main/Messages/TextMessage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ final class TextMessage implements Message
private $timestamp = null;
private $text = null;

public static function create()
public static function create(Timestamp $timestamp = null)
{
return new self;
return new self($timestamp);
}

public function __construct()
public function __construct(Timestamp $timestamp = null)
{
$this->timestamp = Timestamp::makeNow();
$this->timestamp = $timestamp ?: Timestamp::makeNow();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И еще на один шажок код перестает работать под version < 5.3. Это ведь где-то уже обсуждалось что версию 5.3 и меньше мы не поддерживаем?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Версии ниже 5.3. уже не поддерживаются самим php.
Смысл тратить усилия на совместимость со старьем? :)

Даже в нашем FAQ написано:
Q: I am using PHP4 and I...
Q: I'm using feature, which obsoleted since revision N...

A: You're doomed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Просто обратил внимание и пытаюсь пропомнить - обсуждалось ли где-то это нами или нет. Вроде бы было на эту тему обсуждение.

}

public function setTimestamp($timestamp)
public function setTimestamp(Timestamp $timestamp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Интересно почему тут не было раньше Timestamp?

{
$this->timestamp = $timestamp;

Expand Down