Showing 318 of 14,363 total issues
Method provideStatusAndUsage
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function provideStatusAndUsage()
{
$status0 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');
Phake::when($status0)->isInitialState()->thenReturn(true);
Phake::when($status0)->isPublishedState()->thenReturn(false);
- Create a ticketCreate a ticket
Function addFormElements
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function addFormElements(FormEvent $event)
{
$form = $event->getForm();
$data = $event->getData();
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function process(ContainerBuilder $container)
{
$resourcePath = '.';
foreach ($container->getResources() as $resource) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function exports
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
grunt.registerTask('menu:compile', 'Open Orchestra task to find template underscore and compile it', function () {
var config = grunt.config('application.config');
- Create a ticketCreate a ticket
Method buildForm
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('label', 'text', array(
'label' => 'open_orchestra_backoffice.form.block.label',
'constraints' => new NotBlank(),
- Create a ticketCreate a ticket
Method configureOptions
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
array(
'data_class' => $this->contentTypeClass,
- Create a ticketCreate a ticket
Method formAction
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formAction(Request $request, $contentId, $language, $version)
{
$content = $this->get('open_orchestra_model.repository.content')->findOneByLanguageAndVersion($contentId, $language, $version);
if (!$content instanceof ContentInterface) {
throw new \UnexpectedValueException();
- Create a ticketCreate a ticket
Method setUp
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setUp()
{
$this->eventDispatcher = Phake::mock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->node = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');
- Create a ticketCreate a ticket
Method validate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate($value, Constraint $constraint)
{
$parameters = array(
'initial_state' => 0,
'translation_state' => 0,
- Create a ticketCreate a ticket
Function listContent
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
listContent(contentTypeId, language, page) {
if (null === page) {
page = 1
}
this._displayLoader(Application.getRegion('content'));
- Create a ticketCreate a ticket
Method buildForm
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'text', array(
'label' => 'open_orchestra_backoffice.form.content.name',
- Create a ticketCreate a ticket
Function getAvailableSites
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getAvailableSites()
{
$sites = array();
$token = $this->tokenStorage->getToken();
if ($token instanceof TokenInterface) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getColumnsDefinition
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
getColumnsDefinition() {
return [
this._getColumnsDefinitionDeleteCheckbox(),
{
name: "site_name",
- Create a ticketCreate a ticket
Method setUp
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setUp()
{
$this->statusInitial = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');
Phake::when($this->statusInitial)->getLabels()->thenReturn(array());
Phake::when($this->statusInitial)->getName()->thenReturn($this->statusInitialLabel);
- Create a ticketCreate a ticket
Method testSubmitWithExistingData
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSubmitWithExistingData()
{
$name = 'name';
$status = 'status';
$language = 'fr';
- Create a ticketCreate a ticket
Method setUp
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setUp()
{
$contentType0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');
Phake::when($contentType0)->isDefiningVersionable()->thenReturn(true);
$contentType1 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');
- Create a ticketCreate a ticket
Function listSharedBlock
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
listSharedBlock(language, page) {
if (null === language) {
let user = Application.getContext().get('user');
language = user.language.contribution;
}
- Create a ticketCreate a ticket
Method getBadRoles
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getBadRoles()
{
$actions = array(
'Read' => ContributionActionInterface::READ,
'Edit' => ContributionActionInterface::EDIT,
- Create a ticketCreate a ticket
Method getNotSupportedSubjects
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getNotSupportedSubjects()
{
$content = $this->createPhakeContent();
$trashItem = $this->createPhakeTrashItem();
$site = $this->createPhakeSite();
- Create a ticketCreate a ticket
Method formAction
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formAction(Request $request)
{
$this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, StatusInterface::ENTITY_TYPE);
$statusCollection = $this->get('open_orchestra_model.repository.status')->findNotOutOfWorkflow();
- Create a ticketCreate a ticket