Code Duplication    Length = 32-32 lines in 2 locations

src/Routing/Conditions/PostSlugCondition.php 1 location

@@ 12-43 (lines=32) @@
9
 *
10
 * @codeCoverageIgnore
11
 */
12
class PostSlugCondition implements ConditionInterface {
13
	/**
14
	 * Post slug to check against
15
	 *
16
	 * @var string
17
	 */
18
	protected $post_slug = '';
19
20
	/**
21
	 * Constructor
22
	 *
23
	 * @param string $post_slug
24
	 */
25
	public function __construct( $post_slug ) {
26
		$this->post_slug = $post_slug;
27
	}
28
29
	/**
30
	 * {@inheritDoc}
31
	 */
32
	public function isSatisfied( Request $request ) {
33
		$post = get_post();
34
		return ( is_singular() && $post && $this->post_slug === $post->post_name );
35
	}
36
37
	/**
38
	 * {@inheritDoc}
39
	 */
40
	public function getArguments( Request $request ) {
41
		return [$this->post_slug];
42
	}
43
}
44

src/Routing/Conditions/PostStatusCondition.php 1 location

@@ 12-43 (lines=32) @@
9
 *
10
 * @codeCoverageIgnore
11
 */
12
class PostStatusCondition implements ConditionInterface {
13
	/**
14
	 * Post status to check against.
15
	 *
16
	 * @var string
17
	 */
18
	protected $post_status = '';
19
20
	/**
21
	 * Constructor
22
	 *
23
	 * @param string $post_status
24
	 */
25
	public function __construct( $post_status ) {
26
		$this->post_status = $post_status;
27
	}
28
29
	/**
30
	 * {@inheritDoc}
31
	 */
32
	public function isSatisfied( Request $request ) {
33
		$post = get_post();
34
		return ( is_singular() && $post && $this->post_status === $post->post_status );
35
	}
36
37
	/**
38
	 * {@inheritDoc}
39
	 */
40
	public function getArguments( Request $request ) {
41
		return [$this->post_status];
42
	}
43
}
44