Code Duplication    Length = 16-16 lines in 3 locations

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}

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

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