Code Duplication    Length = 8-12 lines in 2 locations

src/Aop/TransactionalInterceptor.php 2 locations

@@ 87-94 (lines=8) @@
84
85
        // The transactional policy is determined by the annotation, if found.
86
        // If missing, default behaviour is to do nothing (no transaction started).
87
        if ($annotation === null) {
88
            $policy = Transactional::NOT_REQUIRED;
89
        } elseif ($annotation->getPolicy() === null) {
90
            $policy = $this->container->getParameter(
91
                Configuration::ROOT_NODE_NAME . '.' . Configuration::DEFAULT_POLICY);
92
        } else {
93
            $policy = $annotation->getPolicy();
94
        }
95
96
        if (($policy === Transactional::NOT_REQUIRED) && ($annotation === null)) {
97
            // No annotation found: there is probably a bug in the pointcut class, because the interceptor should not
@@ 124-135 (lines=12) @@
121
            $this->afterMethodInvocationSuccess($transactionRequired);
122
        } catch (Exception $e) {
123
            // Manage special exceptions (commit or rollback strategy).
124
            if ($annotation === null) {
125
                // At this point, it means there is no inner transaction context for the method.
126
                $noRollbackExceptions = null;
127
            } elseif ($annotation->getNoRollbackExceptions() === null) {
128
                // No exceptions set in the annotation (even if the parameter was found), use the default configuration.
129
                $noRollbackExceptions = $this->container->getParameter(
130
                    Configuration::ROOT_NODE_NAME . '.' . Configuration::NO_ROLLBACK_EXCEPTIONS
131
                );
132
            } else {
133
                // Use the annotation parameter.
134
                $noRollbackExceptions = $annotation->getNoRollbackExceptions();
135
            }
136
            $this->afterMethodInvocationFailure($transactionRequired, $e, $noRollbackExceptions);
137
        }
138