Code Duplication    Length = 16-16 lines in 3 locations

src/Transfer/EzPlatform/Repository/Manager/ContentTypeManager.php 1 location

@@ 85-100 (lines=16) @@
82
    /**
83
     * {@inheritdoc}
84
     */
85
    public function find(ValueObject $object)
86
    {
87
        try {
88
            if (isset($object->data['identifier'])) {
89
                $contentType = $this->contentTypeService->loadContentTypeByIdentifier($object->data['identifier']);
90
            }
91
        } catch (NotFoundException $notFoundException) {
92
            // We'll throw our own exception later instead.
93
        }
94
95
        if (!isset($contentType)) {
96
            throw new ObjectNotFoundException(ContentType::class, array('identifier'));
97
        }
98
99
        return $contentType;
100
    }
101
102
    /**
103
     * {@inheritdoc}

src/Transfer/EzPlatform/Repository/Manager/LanguageManager.php 1 location

@@ 73-88 (lines=16) @@
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function find(ValueObject $object)
74
    {
75
        try {
76
            if (isset($object->data['code'])) {
77
                $language = $this->languageService->loadLanguage($object->data['code']);
78
            }
79
        } catch (NotFoundException $notFoundException) {
80
            // We'll throw our own exception later instead.
81
        }
82
83
        if (!isset($language)) {
84
            throw new ObjectNotFoundException(Language::class, array('code'));
85
        }
86
87
        return $language;
88
    }
89
90
    /**
91
     * {@inheritdoc}

src/Transfer/EzPlatform/Repository/Manager/UserManager.php 1 location

@@ 80-95 (lines=16) @@
77
    /**
78
     * {@inheritdoc}
79
     */
80
    public function find(ValueObject $object)
81
    {
82
        try {
83
            if (isset($object->data['username'])) {
84
                $user = $this->userService->loadUserByLogin($object->data['username']);
85
            }
86
        } catch (NotFoundException $notFoundException) {
87
            // We'll throw our own exception later instead.
88
        }
89
90
        if (!isset($user)) {
91
            throw new ObjectNotFoundException(User::class, array('username'));
92
        }
93
94
        return $user;
95
    }
96
97
    /**
98
     * {@inheritdoc}