Skip to content

Commit

Permalink
👔 up: update some logic gen DTO and modify text parser
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Mar 26, 2024
1 parent 204573f commit 9c2a015
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 811 deletions.
6 changes: 3 additions & 3 deletions app/Console/Controller/JsonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
use Inhere\Kite\Console\Component\ContentsAutoReader;
use Inhere\Kite\Console\Component\ContentsAutoWriter;
use Inhere\Kite\Kite;
use Inhere\Kite\Lib\Generate\JsonToCode;
use Inhere\Kite\Lib\Generate\DTOGenerator;
use Inhere\Kite\Lib\Parser\Text\Json5ItemParser;
use Inhere\Kite\Lib\Parser\Text\TextParser;
use Inhere\Kite\Lib\Parser\TextParser;
use InvalidArgumentException;
use Throwable;
use Toolkit\FsUtil\File;
Expand Down Expand Up @@ -417,7 +417,7 @@ public function toClassCommand(FlagsParser $fs, Output $output): void
$output->aList($config);

// @user-custom/template/java-service-tpl/dto.tpl
$gen = JsonToCode::create($type)
$gen = DTOGenerator::create($type)
->setSource($json)
->configThis($config)
->loadVarsFromStrings($fs->getOpt('ctx'))
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Controller/StringController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Inhere\Kite\Helper\KiteUtil;
use Inhere\Kite\Kite;
use Inhere\Kite\Lib\Parser\Text\Json5ItemParser;
use Inhere\Kite\Lib\Parser\Text\TextParser;
use Inhere\Kite\Lib\Parser\TextParser;
use Inhere\Kite\Lib\Stream\ListStream;
use Inhere\Kite\Lib\Stream\StringStream;
use InvalidArgumentException;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/SubCmd/GolangCmd/GenerateStructCmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Inhere\Kite\Lib\Generate\DTOGenerator;
use Inhere\Kite\Lib\Parser\Text\Json5ItemParser;
use Inhere\Kite\Lib\Parser\Text\TextItemParser;
use Inhere\Kite\Lib\Parser\Text\TextParser;
use Inhere\Kite\Lib\Parser\TextParser;
use InvalidArgumentException;
use PhpPkg\Config\ConfigUtil;
use Toolkit\PFlag\FlagsParser;
Expand Down
13 changes: 11 additions & 2 deletions app/Lib/Convert/JavaProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Inhere\Kite\Lib\Convert;

use Toolkit\Stdlib\Arr;
use Traversable;
use function array_shift;
use function count;
use function explode;
Expand All @@ -20,6 +19,16 @@
*/
class JavaProperties
{
/**
* @param string $text
*
* @return array
*/
public static function parseString(string $text): array
{
return (new self())->decode($text);
}

/**
* @param string $str
*
Expand All @@ -28,7 +37,7 @@ class JavaProperties
public function decode(string $str): array
{
$decoded = [];
$rawData = (array)parse_ini_string($str, false);
$rawData = (array)parse_ini_string($str);

foreach ($rawData as $path => $value) {
$path = trim($path, '.');
Expand Down
2 changes: 1 addition & 1 deletion app/Lib/Generate/DTOGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Inhere\Kite\Lib\Defines\FieldMeta;
use Inhere\Kite\Lib\Parser\DBTable;
use Inhere\Kite\Lib\Parser\MySQL\TableField;
use Inhere\Kite\Lib\Parser\Text\TextParser;
use Inhere\Kite\Lib\Parser\TextParser;
use InvalidArgumentException;
use PhpPkg\Config\ConfigUtil;
use Toolkit\Stdlib\Helper\Assert;
Expand Down
2 changes: 1 addition & 1 deletion app/Lib/Generate/Json5Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use ColinODell\Json5\SyntaxError;
use Inhere\Kite\Lib\Defines\DataField\JsonField;
use Inhere\Kite\Lib\Parser\Text\Json5ItemParser;
use Inhere\Kite\Lib\Parser\Text\TextParser;
use Inhere\Kite\Lib\Parser\TextParser;
use Toolkit\Stdlib\Obj\AbstractObj;
use Toolkit\Stdlib\Type;
use function count;
Expand Down
18 changes: 0 additions & 18 deletions app/Lib/Generate/JsonToCode.php

This file was deleted.

1 change: 1 addition & 0 deletions app/Lib/Parser/Text/TextItemParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Inhere\Kite\Lib\Parser\Text;

use Inhere\Kite\Lib\Parser\TextParser;
use Toolkit\Stdlib\Str;
use function array_combine;
use function count;
Expand Down
Loading

0 comments on commit 9c2a015

Please sign in to comment.