Code Duplication    Length = 20-22 lines in 3 locations

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

@@ 92-113 (lines=22) @@
89
     *
90
     * @throws NotFoundException
91
     */
92
    public function find(ValueObject $object, $throwException = false)
93
    {
94
        if (isset($object->data['identifier'])) {
95
            try {
96
                $contentType = $this->contentTypeService->loadContentTypeByIdentifier($object->data['identifier']);
97
            } catch (NotFoundException $notFoundException) {
98
                $exception = $notFoundException;
99
            }
100
        }
101
102
        if (!isset($contentType)) {
103
            if (isset($exception) && $throwException) {
104
                throw $exception;
105
            }
106
107
            return false;
108
        }
109
110
        return $contentType;
111
    }
112
113
    /**
114
     * {@inheritdoc}
115
     */
116
    public function create(ObjectInterface $object)

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

@@ 80-99 (lines=20) @@
77
     *
78
     * @throws NotFoundException
79
     */
80
    public function find(ValueObject $object, $throwExceptions = false)
81
    {
82
        if (isset($object->data['code'])) {
83
            try {
84
                $language = $this->languageService->loadLanguage($object->data['code']);
85
            } catch (NotFoundException $notFoundException) {
86
                $exception = $notFoundException;
87
            }
88
        }
89
90
        if (!isset($language)) {
91
            if (isset($exception) && $throwExceptions) {
92
                throw $exception;
93
            }
94
95
            return false;
96
        }
97
98
        return $language;
99
    }
100
101
    /**
102
     * {@inheritdoc}

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

@@ 84-103 (lines=20) @@
81
     *
82
     * @throws NotFoundException
83
     */
84
    public function find(ValueObject $object, $throwException = false)
85
    {
86
        try {
87
            if (isset($object->data['username'])) {
88
                $user = $this->userService->loadUserByLogin($object->data['username']);
89
            }
90
        } catch (NotFoundException $notFoundException) {
91
            $exception = $notFoundException;
92
        }
93
94
        if (!isset($user)) {
95
            if (isset($exception) && $throwException) {
96
                throw $exception;
97
            }
98
99
            return false;
100
        }
101
102
        return $user;
103
    }
104
105
    /**
106
     * {@inheritdoc}