Code Duplication    Length = 22-22 lines in 2 locations

core/domain/entities/routing/specifications/admin/WordPressPageEditorEdit.php 1 location

@@ 16-37 (lines=22) @@
13
 * @author  Brent Christensen
14
 * @since   4.9.71.p
15
 */
16
class WordPressPageEditorEdit extends RouteMatchSpecification
17
{
18
    /**
19
     * returns true if current request matches specification
20
     *
21
     * @since 4.9.71.p
22
     * @return boolean
23
     */
24
    public function isMatchingRoute()
25
    {
26
        global $post;
27
        return strpos($this->request->requestUri(), 'wp-admin/post.php') !== false
28
            && (
29
                $this->request->getRequestParam('post_type', 'post') === 'page'
30
                || (
31
                    $post instanceof WP_Post
32
                    && $post->post_type === 'page'
33
                )
34
            )
35
            && $this->request->getRequestParam('action') === 'edit';
36
    }
37
}
38

core/domain/entities/routing/specifications/admin/WordPressPostsEditorEdit.php 1 location

@@ 16-37 (lines=22) @@
13
 * @author  Brent Christensen
14
 * @since   4.9.71.p
15
 */
16
class WordPressPostsEditorEdit extends RouteMatchSpecification
17
{
18
    /**
19
     * returns true if current request matches specification
20
     *
21
     * @since 4.9.71.p
22
     * @return boolean
23
     */
24
    public function isMatchingRoute()
25
    {
26
        global $post;
27
        return strpos($this->request->requestUri(), 'wp-admin/post.php') !== false
28
            && (
29
                $this->request->getRequestParam('post_type', 'post') === 'post'
30
                || (
31
                    $post instanceof WP_Post
32
                    && $post->post_type === 'post'
33
                )
34
            )
35
            && $this->request->getRequestParam('action') === 'edit';
36
    }
37
}
38