Showing 67 of 89 total issues
Method getConfigTreeBuilder
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('open_orchestra_media_admin');
- Create a ticketCreate a ticket
Method load
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
- Create a ticketCreate a ticket
MediaUploadView
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class MediaUploadView extends OrchestraView
{
/**
* @inheritdoc
*/
- Create a ticketCreate a ticket
Method buildForm
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('format', 'choice', array(
'choices' => $this->getChoices(),
- Create a ticketCreate a ticket
Method testConfig
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function testConfig(
$file,
$tmpDir,
array $alternatives,
array $thumbnail,
- Create a ticketCreate a ticket
Method buildForm
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$formats = $this->getFormats();
$allowAdd = true;
if (isset($options['disabled']) && $options['disabled']) {
- Create a ticketCreate a ticket
Function getChoices
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function getChoices()
{
$choices = array();
if ($this->authorizationChecker->isGranted(ContributionRoleInterface::PLATFORM_ADMIN)) {
- 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
Method addMediaFieldType
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addMediaFieldType(ContainerBuilder $container)
{
$fieldTypes = array_merge(
$container->getParameter('open_orchestra_backoffice.field_types'),
array(
- Create a ticketCreate a ticket
Function getConnectedUserMediaPerimeter
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function getConnectedUserMediaPerimeter($siteId)
{
$user = $this->get('security.token_storage')->getToken()->getUser();
if ($user->hasRole(ContributionRoleInterface::PLATFORM_ADMIN)
|| $user->hasRole(ContributionRoleInterface::DEVELOPER)
- 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
Method testUpdatePath
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function testUpdatePath()
{
$parentFolderId = 'parent';
$grandParentPath = '/';
$parentPath = 'parentPath';
- Create a ticketCreate a ticket
Method load
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function load(ObjectManager $manager)
{
$logoOrchestra = $this->generateMedia(
'logo-orchestra.png',
'mediaFolder-transparentImages',
- Create a ticketCreate a ticket
Method updatePath
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function updatePath(FolderEvent $event)
{
$folder = $event->getFolder();
$parentFolder = $folder->getParent();
- Create a ticketCreate a ticket
Method newAction
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function newAction(Request $request, $parentId=null)
{
$folderClass = $this->getParameter('open_orchestra_media.document.media_folder.class');
$folder = new $folderClass();
if (!is_null($parentId)) {
- Create a ticketCreate a ticket
Method setUp
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function setUp()
{
parent::setUp();
Phake::when($this->mediaStorageManager)->exists('format1-' . $this->fullMediaFileSystemName)->thenReturn(true);
- Create a ticketCreate a ticket
Method buildForm
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$siteId = null;
if ($builder->getData() instanceof MediaInterface) {
$siteId = $builder->getData()->getSiteId();
- Create a ticketCreate a ticket
Method load
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function load(ObjectManager $manager)
{
$site = $this->getReference('site2');
$rootImages = new MediaFolder();
- Create a ticketCreate a ticket
Method transform
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function transform($mixed, array $params = array())
{
$facade = $this->newFacade();
$facade->id = $mixed->getId();
- Create a ticketCreate a ticket
Method setUp
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function setUp()
{
$repository = Phake::mock('OpenOrchestra\Media\Repository\FolderRepositoryInterface');
Phake::when($repository)->findFolderTree(Phake::anyParameters())->thenReturn(
array (
- Create a ticketCreate a ticket
Method provideConfig
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function provideConfig()
{
return array(
array(
'empty',
- Create a ticketCreate a ticket
Method buildForm
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('id', 'text', array(
'label' => 'open_orchestra_backoffice.form.block.id',
'constraints' => new NotBlank(),
- Create a ticketCreate a ticket