MakePotCommand   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 35
ccs 0
cts 27
cp 0
rs 10
wmc 1
1
<?php
2
/**
3
 * WP-CLI `pronamic i18n make-pot` command.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2021 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay
9
 */
10
11
namespace Pronamic\WordPress\Pay;
12
13
if ( ! \class_exists( 'WP_CLI' ) ) {
14
	return;
15
}
16
17
/*
18
 * The `pronamic i18n make-pot` command requires the `i18n make-pot` command.
19
 *
20
 * @link https://make.wordpress.org/cli/2017/05/03/managing-command-dependencies/
21
 */
22
\WP_CLI::add_hook(
23
	'after_add_command:i18n make-pot',
24
	function () {
25
26
		/**
27
		 * Title: Make pot command.
28
		 * Description:
29
		 * Copyright: 2005-2021 Pronamic
30
		 * Company: Pronamic
31
		 *
32
		 * @author  Remco Tolsma
33
		 * @version 5.5.5
34
		 * @since   5.5.0
35
		 */
36
		class MakePotCommand extends \WP_CLI\I18n\MakePotCommand {
37
			/**
38
			 * Command constructor.
39
			 */
40
			public function __construct() {
41
				parent::__construct();
42
43
				// @link https://github.com/wp-cli/i18n-command/blob/v2.0.1/src/MakePotCommand.php#L36-L44
44
				$this->exclude = array_diff(
45
					$this->exclude,
46
					array(
47
						'vendor',
48
					)
49
				);
50
51
				$this->exclude = array_merge(
52
					$this->exclude,
53
					array(
54
						'build',
55
						'deploy',
56
						'documentation',
57
						'etc',
58
						'repositories',
59
						'wordpress',
60
						'wp-content',
61
					)
62
				);
63
64
				$this->include = array(
65
					'admin',
66
					'includes',
67
					'templates',
68
					'vendor',
69
					'views',
70
					'*.php',
71
				);
72
			}
73
		}
74
75
		// @link https://github.com/wp-cli/i18n-command/blob/v2.0.1/i18n-command.php
76
		\WP_CLI::add_command( 'pronamic i18n make-pot', '\Pronamic\WordPress\Pay\MakePotCommand' );
77
78
		/*
79
		 * Usage example:
80
		 *
81
		 * wp pronamic i18n make-pot . languages/pronamic_ideal.pot --slug="pronamic-ideal"
82
		 */
83
	}
84
);
85