Skip to content
Snippets Groups Projects
Verified Commit 3b388b3a authored by Bartek Jaskulski's avatar Bartek Jaskulski
Browse files

refactor: rename header parser implementation

parent 182e8447
No related branches found
No related tags found
3 merge requests!3improve into wp-hook and some additional unfinished things,!21.x,!1Draft: Basic implementation of plugin initializer
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
...@@ -3,7 +3,7 @@ declare( strict_types=1 ); ...@@ -3,7 +3,7 @@ declare( strict_types=1 );
namespace WPDesk\Init; namespace WPDesk\Init;
class PluginHeaderParser implements HeaderParser { class DefaultHeaderParser implements HeaderParser {
private const KB_IN_BYTES = 1024; private const KB_IN_BYTES = 1024;
private const HEADERS = [ private const HEADERS = [
...@@ -118,7 +118,7 @@ class PluginHeaderParser implements HeaderParser { ...@@ -118,7 +118,7 @@ class PluginHeaderParser implements HeaderParser {
} }
// Make sure we catch CR-only line endings. // Make sure we catch CR-only line endings.
$file_data = str_replace( "\r", "\n", $file_data ); $file_data = \str_replace( "\r", "\n", $file_data );
$headers = []; $headers = [];
foreach ( $default_headers as $field => $regex ) { foreach ( $default_headers as $field => $regex ) {
......
...@@ -3,12 +3,12 @@ declare( strict_types=1 ); ...@@ -3,12 +3,12 @@ declare( strict_types=1 );
namespace WPDesk\Init\Tests; namespace WPDesk\Init\Tests;
use WPDesk\Init\PluginHeaderParser; use WPDesk\Init\DefaultHeaderParser;
class PluginHeaderParserTest extends TestCase { class DefaultHeaderParserTest extends TestCase {
public function test_should_parse_plugin_data(): void { public function test_should_parse_plugin_data(): void {
$data = new PluginHeaderParser(); $data = new DefaultHeaderParser();
$dir = $this->initTempPlugin(); $dir = $this->initTempPlugin();
$result = $data->parse( $dir . '/simple-plugin.php' ); $result = $data->parse( $dir . '/simple-plugin.php' );
...@@ -17,7 +17,7 @@ class PluginHeaderParserTest extends TestCase { ...@@ -17,7 +17,7 @@ class PluginHeaderParserTest extends TestCase {
} }
public function test_should_parse_whole_plugin_data(): void { public function test_should_parse_whole_plugin_data(): void {
$data = new PluginHeaderParser(); $data = new DefaultHeaderParser();
$dir = $this->initTempPlugin( 'advanced-plugin' ); $dir = $this->initTempPlugin( 'advanced-plugin' );
$result = $data->parse( $dir . '/advanced-plugin.php' ); $result = $data->parse( $dir . '/advanced-plugin.php' );
......
...@@ -7,7 +7,7 @@ use WPDesk\Init\Configuration\Configuration; ...@@ -7,7 +7,7 @@ use WPDesk\Init\Configuration\Configuration;
use WPDesk\Init\Dumper\PhpFileDumper; use WPDesk\Init\Dumper\PhpFileDumper;
use WPDesk\Init\Loader\PhpFileLoader; use WPDesk\Init\Loader\PhpFileLoader;
use WPDesk\Init\PluginHeaderData; use WPDesk\Init\PluginHeaderData;
use WPDesk\Init\PluginHeaderParser; use WPDesk\Init\DefaultHeaderParser;
class PluginHeaderDataTest extends TestCase { class PluginHeaderDataTest extends TestCase {
...@@ -15,7 +15,7 @@ class PluginHeaderDataTest extends TestCase { ...@@ -15,7 +15,7 @@ class PluginHeaderDataTest extends TestCase {
$dir = $this->initTempPlugin(); $dir = $this->initTempPlugin();
$header = new PluginHeaderData( $header = new PluginHeaderData(
new PluginHeaderParser(), new DefaultHeaderParser(),
new PhpFileLoader(), new PhpFileLoader(),
new PhpFileDumper(), new PhpFileDumper(),
new Configuration( [] ) new Configuration( [] )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment