for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Transcript
*
* @package LivePersonInc\LiveEngageLaravel\Collections
*/
namespace LivePersonInc\LiveEngageLaravel\Collections;
use Illuminate\Support\Collection;
use LivePersonInc\LiveEngageLaravel\Models\Message;
use LivePersonInc\LiveEngageLaravel\Models\Agent;
* Transcript class.
* @extends Collection
class Transcript extends Collection
{
public function __construct(array $models = [], $agents = false)
$models = array_map(function($item) use ($agents) {
if (property_exists($item, 'sentBy') && $item->sentBy == 'Agent' && $agents) {
$item->agentDetails = $agents->findById($item->participantId);
}
return new Message((array) $item);
}, $models);
return parent::__construct($models);
parent::__construct($models)
Illuminate\Support\Collection::__construct()
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
public function textTranscript()
$text = "";
foreach ($this as $message) {
$by = $message->sentBy == 'Agent' ? $message->agentDetails->agentFullName : 'Visitor';
$text .= "{$by}:\n{$message->plainText}\n\n";
return $text;
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.