Skip to content

Commit 997ecbb

Browse files
authored
Merge pull request #69 from codebtech/chore/composer-normalise
composer normalize
2 parents 4d484a9 + 7150fdd commit 997ecbb

23 files changed

+97
-84
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The filter controls whether the new flag is enabled by default or not. Default `
3434
Example usage:
3535

3636
```js
37-
addFilter('mrFeatureFlags.newFlag.defaultStatus', 'mr-feature-flags', () => {
37+
addFilter('mrFeatureFlags.newFlag.defaultStatus', 'codeb-feature-flags', () => {
3838
return false;
3939
});
4040
```

composer.json

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
{
22
"name": "codeb/wp-feature-flags",
33
"description": "Allows developers to enable / disable features based on flags.",
4-
"type": "wordpress-plugin",
54
"license": "MIT",
6-
"repositories": [
7-
{
8-
"type": "vcs",
9-
"url": "https://git@github.com/WordPress/wordpress-develop"
10-
}
11-
],
5+
"type": "wordpress-plugin",
6+
"require": {
7+
"php": ">=8.1"
8+
},
129
"require-dev": {
13-
"wordpress/wordpress": "^6.4",
14-
"phpunit/phpunit": "^9.4",
1510
"brain/monkey": "^2.6",
1611
"newsuk/nuk-wp-phpcs-config": "^0.2.0",
17-
"newsuk/nuk-wp-phpstan-config": "^0.1.0",
1812
"newsuk/nuk-wp-phpmd-config": "^0.1.0",
13+
"newsuk/nuk-wp-phpstan-config": "^0.1.0",
14+
"phpunit/phpunit": "^9.4",
15+
"wordpress/wordpress": "^6.4",
1916
"yoast/wp-test-utils": "^1.2"
2017
},
18+
"repositories": [
19+
{
20+
"type": "vcs",
21+
"url": "https://git@github.com/WordPress/wordpress-develop"
22+
}
23+
],
2124
"autoload": {
2225
"psr-4": {
2326
"CodeB\\FeatureFlags\\": [
@@ -34,16 +37,19 @@
3437
"allow-plugins": {
3538
"dealerdirect/phpcodesniffer-composer-installer": true,
3639
"phpstan/extension-installer": true
40+
},
41+
"platform": {
42+
"php": "8.1"
3743
}
3844
},
3945
"scripts": {
4046
"lint": "phpcs .",
4147
"lint:fix": "phpcbf .",
42-
"test:unit": "phpunit --dont-report-useless-tests --configuration ./phpunit.xml --testsuite unit --testdox --coverage-text",
43-
"test:integration": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration.xml --testsuite integration --testdox --coverage-text",
44-
"test:multisite": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration-multisite.xml --testsuite integration --testdox --coverage-text",
48+
"phpmd": "phpmd plugin.php,includes text phpmd.xml.dist --color",
4549
"phpstan": "phpstan analyse --memory-limit=2048M",
4650
"phpstan-baseline": "phpstan analyse -b --allow-empty-baseline --memory-limit=2048M",
47-
"phpmd": "phpmd plugin.php,includes text phpmd.xml.dist --color"
51+
"test:integration": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration.xml --testsuite integration --testdox --coverage-text",
52+
"test:multisite": "phpunit --dont-report-useless-tests --configuration ./phpunit-integration-multisite.xml --testsuite integration --testdox --coverage-text",
53+
"test:unit": "phpunit --dont-report-useless-tests --configuration ./phpunit.xml --testsuite unit --testdox --coverage-text"
4854
}
4955
}

composer.lock

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/Api/Flags.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* API class for feature flags options
44
*
5-
* @package mr-feature-flags
5+
* @package codeb-feature-flags
66
* @since 0.1.0
77
*/
88

@@ -17,7 +17,7 @@
1717
/**
1818
* Class Settings
1919
*
20-
* @package mr-feature-flags
20+
* @package codeb-feature-flags
2121
* @since 0.1.0
2222
*/
2323
class Flags {
@@ -105,7 +105,7 @@ public function post_flags( WP_REST_Request $request ) {
105105
$max_allowed_flags = apply_filters( 'mr_feature_flags_max_allowed', self::$max_flags );
106106
if ( count( $input_data['flags'] ) > $max_allowed_flags ) {
107107
// translators: %d is a placeholder for the maximum allowed flags.
108-
$error_message = sprintf( __( 'Cannot add more than %d flags', 'mr-feature-flags' ), $max_allowed_flags );
108+
$error_message = sprintf( __( 'Cannot add more than %d flags', 'codeb-feature-flags' ), $max_allowed_flags );
109109
return new WP_Error( 'flag_limit_exceeded', $error_message, array( 'status' => 400 ) );
110110
}
111111

@@ -118,7 +118,7 @@ public function post_flags( WP_REST_Request $request ) {
118118
);
119119
}
120120

121-
return new WP_Error( 'invalid_input', __( 'Cannot update flags', 'mr-feature-flags' ), array( 'status' => 400 ) );
121+
return new WP_Error( 'invalid_input', __( 'Cannot update flags', 'codeb-feature-flags' ), array( 'status' => 400 ) );
122122
}
123123

124124
/**

includes/Flag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Utility class to expose flag methods.
44
*
5-
* @package mr-feature-flags
5+
* @package codeb-feature-flags
66
* @since 0.1.0
77
*/
88

@@ -13,7 +13,7 @@
1313
/**
1414
* Utils class for feature flags
1515
*
16-
* @package mr-feature-flags
16+
* @package codeb-feature-flags
1717
* @since 0.1.0
1818
*/
1919
class Flag {

includes/Helper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* This is the init file for the plugin
44
*
5-
* @package mr-feature-flags
5+
* @package codeb-feature-flags
66
* @since 0.1.0
77
*/
88

@@ -13,7 +13,7 @@
1313
/**
1414
* Class FeatureFlags
1515
*
16-
* @package mr-feature-flags
16+
* @package codeb-feature-flags
1717
* @since 0.1.0
1818
*/
1919
class Helper {

includes/Settings.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Admin setting page for feature flags
44
*
5-
* @package mr-feature-flags
5+
* @package codeb-feature-flags
66
* @since 0.1.0
77
*/
88

@@ -13,7 +13,7 @@
1313
/**
1414
* Class Settings
1515
*
16-
* @package mr-feature-flags
16+
* @package codeb-feature-flags
1717
* @since 0.1.0
1818
*/
1919
class Settings {
@@ -37,10 +37,10 @@ public function register_feature_settings() {
3737
public function register_settings() {
3838

3939
add_menu_page(
40-
__( 'Feature Flags', 'mr-feature-flags' ),
41-
__( 'Feature Flags', 'mr-feature-flags' ),
40+
__( 'Feature Flags', 'codeb-feature-flags' ),
41+
__( 'Feature Flags', 'codeb-feature-flags' ),
4242
'manage_options',
43-
'mr-feature-flags',
43+
'codeb-feature-flags',
4444
[ $this, 'render_page' ],
4545
'data:image/svg+xml;base64,' . base64_encode( '<svg width="15" height="18" viewBox="0 0 2000 1792" xmlns="http://www.w3.org/2000/svg"><path fill="black" d="M0 896q0-130 51-248.5t136.5-204 204-136.5 248.5-51h768q130 0 248.5 51t204 136.5 136.5 204 51 248.5-51 248.5-136.5 204-204 136.5-248.5 51h-768q-130 0-248.5-51t-204-136.5-136.5-204-51-248.5zm1408 512q104 0 198.5-40.5t163.5-109.5 109.5-163.5 40.5-198.5-40.5-198.5-109.5-163.5-163.5-109.5-198.5-40.5-198.5 40.5-163.5 109.5-109.5 163.5-40.5 198.5 40.5 198.5 109.5 163.5 163.5 109.5 198.5 40.5z"/></svg>' )
4646
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "mr-feature-flags",
2+
"name": "codeb-feature-flags",
33
"version": "0.1.0",
44
"description": "Allows developers to enable / disable features based on flags.",
55
"scripts": {

phpcs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<rule ref="WordPress.WP.I18n">
55
<properties>
66
<property name="text_domain" type="array">
7-
<element value="mr-feature-flags"/>
7+
<element value="codeb-feature-flags"/>
88
</property>
99
</properties>
1010
</rule>

plugin.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
* The plugin bootstrap file
44
*
55
* @since 0.1.0
6-
* @package mr-feature-flags
6+
* @package codeb-feature-flags
77
*
88
* @wordpress-plugin
99
* Plugin Name: Feature Flags
1010
* Plugin URI: https://github.com/codebtech/wp-feature-flags
1111
* Description: Allows developers to enable / disable features based on flags.
1212
* Version: 0.1.0
13+
* Requires at least: 6.4
14+
* Requires PHP: 8.1
1315
* Author: Mohan Raj
1416
* Author URI: https://mohanraj.dev
1517
* License: GPL-2.0+
1618
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
17-
* Text Domain: mr-feature-flags
19+
* Text Domain: codeb-feature-flags
1820
*/
1921

2022
declare( strict_types = 1 );
@@ -41,7 +43,7 @@
4143
add_action(
4244
'admin_enqueue_scripts',
4345
static function ( string $page ): void {
44-
if ( 'toplevel_page_mr-feature-flags' === $page ) {
46+
if ( 'toplevel_page_codeb-feature-flags' === $page ) {
4547
mr_feature_flags_load_settings_scripts();
4648
}
4749
}
@@ -58,7 +60,7 @@ function mr_feature_flags_load_settings_scripts(): void {
5860
$settings_asset_file = require_once plugin_dir_path( MR_FEATURE_FLAGS_PLUGIN_PATH ) . 'build/settings.asset.php'; // @phpcs:ignore
5961

6062
wp_enqueue_script(
61-
'mr-feature-flags',
63+
'codeb-feature-flags',
6264
$plugin_url . 'build/settings.js',
6365
$settings_asset_file['dependencies'],
6466
$settings_asset_file['version'],
@@ -68,7 +70,7 @@ function mr_feature_flags_load_settings_scripts(): void {
6870
wp_enqueue_style( 'wp-edit-blocks' );
6971

7072
wp_enqueue_style(
71-
'mr-feature-flags',
73+
'codeb-feature-flags',
7274
$plugin_url . 'build/settings.css',
7375
[],
7476
$settings_asset_file['version']
@@ -95,7 +97,7 @@ function mr_feature_flags_scripts_enqueue(): void {
9597
$script_asset_file = include_once plugin_dir_path( MR_FEATURE_FLAGS_PLUGIN_PATH ) . 'build/index.asset.php';
9698

9799
wp_enqueue_script(
98-
'mr-feature-flags-script',
100+
'codeb-feature-flags-script',
99101
$plugin_url . 'build/index.js',
100102
$script_asset_file['dependencies'],
101103
$script_asset_file['version'],
@@ -111,7 +113,7 @@ function mr_feature_flags_scripts_enqueue(): void {
111113
}
112114

113115
wp_localize_script(
114-
'mr-feature-flags-script',
116+
'codeb-feature-flags-script',
115117
'mrFeatureFlags',
116118
[
117119
'flags' => $flags_list,
@@ -130,17 +132,17 @@ function mr_feature_flags_scripts_enqueue(): void {
130132

131133
// Displays setting page link in plugin page.
132134
add_filter(
133-
'plugin_action_links_mr-feature-flags/plugin.php',
135+
'plugin_action_links_codeb-feature-flags/plugin.php',
134136
static function ( $links ) {
135137
$url = esc_url(
136138
add_query_arg(
137139
'page',
138-
'mr-feature-flags',
140+
'codeb-feature-flags',
139141
get_admin_url() . 'admin.php'
140142
)
141143
);
142144

143-
$settings_link = "<a href='$url'>" . __( 'Settings', 'mr-feature-flags' ) . '</a>';
145+
$settings_link = "<a href='$url'>" . __( 'Settings', 'codeb-feature-flags' ) . '</a>';
144146

145147
array_push(
146148
$links,

0 commit comments

Comments
 (0)