Backoffice/Manager/ContentManager.php
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
StatusRepositoryInterface $statusRepository,
ContextBackOfficeInterface $contextManager,
$contentClass,
UniqueIdGenerator $uniqueIdGenerator,
TokenStorage $tokenStorage
- Create a ticketCreate a ticket
Missing class import via use statement (line '134', column '21'). Open
Open
$date = new \DateTime("now");
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method initializeNewContent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$initialStatus = $this->statusRepository->findOneByOutOfWorkflow();
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Reference to undeclared property \OpenOrchestra\Backoffice\Manager\ContentManager->uniqueIdGenerator
Open
Open
$content->setVersion($this->uniqueIdGenerator->generateUniqueId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getName
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$newContent->setName($this->duplicateLabel($content->getName()));
- Create a ticketCreate a ticket
- Exclude checks
Parameter $content
has undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
protected function cloneContent(ContentInterface $content)
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneByInitial
from undeclared class \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
Open
$status = $this->statusRepository->findOneByInitial();
- Create a ticketCreate a ticket
- Exclude checks
Call to method setName
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$newContent->setName($this->duplicateLabel($content->getName()));
- Create a ticketCreate a ticket
- Exclude checks
Call to method setVersion
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$newContent->setVersion($this->uniqueIdGenerator->generateUniqueId());
- Create a ticketCreate a ticket
- Exclude checks
Return type of initializeNewContent()
is undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
public function initializeNewContent($contentType, $language, $isLinkedToSite, $isStatusable)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
public function setVersionName(ContentInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Return type of setVersionName()
is undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
public function setVersionName(ContentInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Return type of cloneContent()
is undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
protected function cloneContent(ContentInterface $content)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $tokenStorage
has undeclared type \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getToken
from undeclared class \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage
Open
Open
$content->setCreatedBy($this->tokenStorage->getToken()->getUser()->getUsername());
- Create a ticketCreate a ticket
- Exclude checks
Call to method setLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$content->setLanguage($language);
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneByInitial
from undeclared class \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
Open
$initialStatus = $this->statusRepository->findOneByInitial();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $content
has undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
public function duplicateContent(ContentInterface $content, $contentId = null)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getName
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$versionName = $node->getName().'_'. $date->format("Y-m-d_H:i:s");
- Create a ticketCreate a ticket
- Exclude checks
Call to method getAttributes
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
foreach ($content->getAttributes() as $attribute) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $originalContent
has undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
public function newVersionContent(ContentInterface $originalContent, $versionName = '')
- Create a ticketCreate a ticket
- Exclude checks
Call to method addAttribute
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$newContent->addAttribute($newAttribute);
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\Backoffice\Manager\ContentManager->uniqueIdGenerator
(Did you mean $uniqueIdGenerator) Open
Open
$this->uniqueIdGenerator = $uniqueIdGenerator;
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneByTranslationState
from undeclared class \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
Open
$translationStatus = $this->statusRepository->findOneByTranslationState();
- Create a ticketCreate a ticket
- Exclude checks
Call to method setStatus
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$newContent->setStatus($status);
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneByOutOfWorkflow
from undeclared class \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
Open
$initialStatus = $this->statusRepository->findOneByOutOfWorkflow();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getStatus
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
if (false === $content->getStatus()->isOutOfWorkflow()) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method setVersionName
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$node->setVersionName($versionName);
- Create a ticketCreate a ticket
- Exclude checks
Call to method setStatus
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$content->setStatus($translationStatus);
- Create a ticketCreate a ticket
- Exclude checks
Call to method setContentId
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$newContent->setContentId($contentId);
- Create a ticketCreate a ticket
- Exclude checks
Call to method getStatus
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
if (false === $content->getStatus()->isOutOfWorkflow()) {
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\Backoffice\Manager\ContentManager->uniqueIdGenerator
Open
Open
$newContent->setVersion($this->uniqueIdGenerator->generateUniqueId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method addKeyword
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$newContent->addKeyword($keyword);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $contentSource
has undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
public function createNewLanguageContent($contentSource, $language)
- Create a ticketCreate a ticket
- Exclude checks
Call to method setVersionName
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
$newContent->setVersionName($versionName);
- Create a ticketCreate a ticket
- Exclude checks
Return type of createNewLanguageContent()
is undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
public function createNewLanguageContent($contentSource, $language)
- Create a ticketCreate a ticket
- Exclude checks
Return type of duplicateContent()
is undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
public function duplicateContent(ContentInterface $content, $contentId = null)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $statusRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Argument 2 (replace)
is int
but \preg_replace()
takes array|string
Open
Open
return preg_replace('/[0-9]+$/', $version, $label);
- Create a ticketCreate a ticket
- Exclude checks
Return type of newVersionContent()
is undeclared type \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
public function newVersionContent(ContentInterface $originalContent, $versionName = '')
- Create a ticketCreate a ticket
- Exclude checks
Call to method getKeywords
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentInterface
Open
Open
foreach ($content->getKeywords() as $keyword) {
- Create a ticketCreate a ticket
- Exclude checks