Skip to content

Commit

Permalink
Merge pull request #1 from cable8mm/fix-namespace
Browse files Browse the repository at this point in the history
Change namespace
  • Loading branch information
cable8mm committed Jul 19, 2023
2 parents a7d5169 + 4917086 commit 7c90401
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 73 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: PHP Composer

on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]
branches: [main]

jobs:
build:
Expand Down
1 change: 0 additions & 1 deletion .styleci.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Good Code Parser

![PHP Composer](https://github.com/esc-company/good-code-parser/workflows/PHP%20Composer/badge.svg)
[![StyleCI](https://github.styleci.io/repos/266034397/shield?branch=master)](https://github.styleci.io/repos/266034397)

ESC-Company suggests general code-spec, parser and implement spec.
We suggests general code-spec, parser and implement spec.

## Install

```bash
composer require esc-company/good-code-parser
composer require cable8mm/good-code-parser
```

## Usage
Expand Down
17 changes: 10 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "esc-company/good-code-parser",
"description": "ESC-Company suggests general code-spec, parser and implement spec.",
"name": "cable8mm/good-code-parser",
"description": "Sam suggests general code-spec, parser and implement spec.",
"keywords": [
"composer",
"php",
"esc-company",
"holapet",
"cable8mm",
"psr-12",
"packagist"
],
"type": "project",
"require": {
"php": ">=7.2"
"php": "^7.4|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8"
"phpunit/phpunit": "^8",
"laravel/pint": "^1.10"
},
"license": "MIT",
"authors": [
Expand All @@ -29,7 +29,7 @@
"src/"
],
"psr-4": {
"EscCompany\\GoodCodeParser\\": "src/"
"Cable8mm\\GoodCodeParser\\": "src/"
}
},
"autoload-dev": {
Expand All @@ -45,6 +45,9 @@
],
"test": [
"./vendor/bin/phpunit tests"
],
"lint": [
"./vendor/bin/pint"
]
}
}
10 changes: 5 additions & 5 deletions src/Contracts/OptionParser.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace EscCompany\GoodCodeParser\Contracts;
namespace Cable8mm\GoodCodeParser\Contracts;

interface OptionParser
{
/**
* Undocumented function
*
* @param string $code before parsing
* @param string $name good-name
* @param array $goods option-goods
* @param array $options option-good-options
* @param string $code before parsing
* @param string $name good-name
* @param array $goods option-goods
* @param array $options option-good-options
* @return string|void code after parsing
*/
public static function parse(string $code, string $name, array $goods, array $options);
Expand Down
6 changes: 3 additions & 3 deletions src/Contracts/Parser.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace EscCompany\GoodCodeParser\Contracts;
namespace Cable8mm\GoodCodeParser\Contracts;

interface Parser
{
/**
* Parsing
*
* @param string $goodCode before parsing
* @param string $goodCode before parsing
* @return array|string after parsing
*
* @throws EscCompany\GoodCodeParser\Exception\MethodNotImplementedException
* @throws Cable8mm\GoodCodeParser\Exception\MethodNotImplementedException
*/
public static function parse(string $parse, $goods = null);
}
4 changes: 2 additions & 2 deletions src/Exception/MethodNotImplementedException.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace EscCompany\GoodCodeParser\Exception;
namespace Cable8mm\GoodCodeParser\Exception;

use Exception;

class MethodNotImplementedException extends Exception
{
/**
* @param string $methodName The name of the method
* @param string $methodName The name of the method
*/
public function __construct(string $methodName)
{
Expand Down
4 changes: 2 additions & 2 deletions src/GoodCodeParser.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace EscCompany\GoodCodeParser;
namespace Cable8mm\GoodCodeParser;

class GoodCodeParser
{
Expand All @@ -23,7 +23,7 @@ public function __construct(string $parse)
* @param string
* @return $this
*
* @var $parser EscCompany\GoodCodeParser\Contracts\Parser
* @var Cable8mm\GoodCodeParser\Contracts\Parser
*/
public function with($parser, $goods = null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/OptionCodeParser.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace EscCompany\GoodCodeParser;
namespace Cable8mm\GoodCodeParser;

class OptionCodeParser
{
Expand Down Expand Up @@ -29,7 +29,7 @@ public function __construct(string $parse, string $name)
* @param string
* @return $this
*
* @var $parser EscCompany\GoodCodeParser\Contracts\OptionParser
* @var Cable8mm\GoodCodeParser\Contracts\OptionParser
*/
public function with($parser, array $goods, array $options)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Parsers/ComplexGood.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace EscCompany\GoodCodeParser\Parsers;
namespace Cable8mm\GoodCodeParser\Parsers;

use EscCompany\GoodCodeParser\Contracts\Parser;
use Cable8mm\GoodCodeParser\Contracts\Parser;
use InvalidArgumentException;

final class ComplexGood implements Parser
Expand All @@ -18,7 +18,7 @@ public static function parse(string $code, $goods = null)
throw new InvalidArgumentException(__METHOD__);
}

$key = preg_replace('/^' . self::PREFIX . '/i', '', $code);
$key = preg_replace('/^'.self::PREFIX.'/i', '', $code);

return $goods[$key];
}
Expand Down
6 changes: 3 additions & 3 deletions src/Parsers/GiftGood.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace EscCompany\GoodCodeParser\Parsers;
namespace Cable8mm\GoodCodeParser\Parsers;

use EscCompany\GoodCodeParser\Contracts\Parser;
use Cable8mm\GoodCodeParser\Contracts\Parser;

final class GiftGood implements Parser
{
Expand All @@ -13,7 +13,7 @@ final class GiftGood implements Parser
*/
public static function parse(string $code, $goods = null)
{
$comCode = preg_replace('/^' . self::PREFIX . '/i', ComplexGood::PREFIX, $code);
$comCode = preg_replace('/^'.self::PREFIX.'/i', ComplexGood::PREFIX, $code);

return ComplexGood::parse($comCode, $goods);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Parsers/OptionGood.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace EscCompany\GoodCodeParser\Parsers;
namespace Cable8mm\GoodCodeParser\Parsers;

use EscCompany\GoodCodeParser\Contracts\OptionParser;
use Cable8mm\GoodCodeParser\Contracts\OptionParser;
use InvalidArgumentException;

final class OptionGood implements OptionParser
Expand All @@ -23,7 +23,7 @@ public static function parse(string $code, string $name, array $goods, array $op
}

if (empty($optionGood)) {
throw new InvalidArgumentException(__METHOD__ . ' There is no good code');
throw new InvalidArgumentException(__METHOD__.' There is no good code');
}

foreach ($options as $option) {
Expand All @@ -33,7 +33,7 @@ public static function parse(string $code, string $name, array $goods, array $op
}

if (is_null($optionGood)) {
throw new InvalidArgumentException(__METHOD__ . ' There is no option good code');
throw new InvalidArgumentException(__METHOD__.' There is no option good code');
}
}
}
6 changes: 4 additions & 2 deletions src/Parsers/SetGood.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

namespace EscCompany\GoodCodeParser\Parsers;
namespace Cable8mm\GoodCodeParser\Parsers;

use EscCompany\GoodCodeParser\Contracts\Parser;
use Cable8mm\GoodCodeParser\Contracts\Parser;

final class SetGood implements Parser
{
const PREFIX = 'set';

const DELIMITER = 'ZZ';

const DELIMITER_COUNT = 'x';

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/ComplexGoodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

declare(strict_types=1);

use EscCompany\GoodCodeParser\Parsers\ComplexGood;
use EscCompany\GoodCodeParser\GoodCodeParser;
use Cable8mm\GoodCodeParser\GoodCodeParser;
use Cable8mm\GoodCodeParser\Parsers\ComplexGood;
use PHPUnit\Framework\TestCase;

class ComplexGoodTest extends TestCase
Expand All @@ -14,7 +14,7 @@ public function test_파싱이_되는지()
$goods = [
1 => 'set11319x1ZZ11626x1ZZ11624x1ZZ11628x1',
2 => 'set11318x1ZZP3800x1ZZP7776x1ZZP9732x1',
3 => 'set11318x1ZZP2526x1ZZP7776x1'
3 => 'set11318x1ZZP2526x1ZZP7776x1',
];

$input = 'com2';
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/GiftGoodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

declare(strict_types=1);

use EscCompany\GoodCodeParser\GoodCodeParser;
use EscCompany\GoodCodeParser\Parsers\GiftGood;
use Cable8mm\GoodCodeParser\GoodCodeParser;
use Cable8mm\GoodCodeParser\Parsers\GiftGood;
use PHPUnit\Framework\TestCase;

class GiftGoodTest extends TestCase
Expand All @@ -14,7 +14,7 @@ public function test_파싱이_되는지()
$goods = [
1 => 'set11319x1ZZ11626x1ZZ11624x1ZZ11628x1',
2 => 'set11318x1ZZP3800x1ZZP7776x1ZZP9732x1',
3 => 'set11318x1ZZP2526x1ZZP7776x1'
3 => 'set11318x1ZZP2526x1ZZP7776x1',
];

$input = 'gif2';
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/OptionGoodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

declare(strict_types=1);

use EscCompany\GoodCodeParser\OptionCodeParser;
use EscCompany\GoodCodeParser\Parsers\OptionGood;
use Cable8mm\GoodCodeParser\OptionCodeParser;
use Cable8mm\GoodCodeParser\Parsers\OptionGood;
use PHPUnit\Framework\TestCase;

class OptionGoodTest extends TestCase
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/SetGoodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

declare(strict_types=1);

use EscCompany\GoodCodeParser\GoodCodeParser;
use EscCompany\GoodCodeParser\Parsers\SetGood;
use Cable8mm\GoodCodeParser\GoodCodeParser;
use Cable8mm\GoodCodeParser\Parsers\SetGood;
use PHPUnit\Framework\TestCase;

class SetGoodTest extends TestCase
Expand Down

0 comments on commit 7c90401

Please sign in to comment.