modifs.mineures sans commentaires
This commit is contained in:
parent
c35ca7e5d4
commit
23c3303b67
|
@ -6,7 +6,6 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="nur\sery\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/nur_src" isTestSource="false" packagePrefix="nur\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/nur_tests" isTestSource="true" packagePrefix="nur\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
}
|
||||
},
|
||||
"bin": [
|
||||
"lib/_launch.php",
|
||||
"nur_bin/compctl.php",
|
||||
"nur_bin/compdep.php",
|
||||
"nur_bin/cachectl.php",
|
||||
|
|
|
@ -547,16 +547,16 @@
|
|||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.11.1",
|
||||
"version": "1.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c"
|
||||
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
|
||||
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
|
||||
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -564,11 +564,12 @@
|
|||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.6.8",
|
||||
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
|
||||
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "^1.6.8",
|
||||
"doctrine/common": "^2.13.3 || ^3.2.2",
|
||||
"phpspec/prophecy": "^1.10",
|
||||
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
|
||||
},
|
||||
"type": "library",
|
||||
|
@ -594,7 +595,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.1"
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.12.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -602,7 +603,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-03-08T13:26:56+00:00"
|
||||
"time": "2024-06-12T14:39:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/php-enum",
|
||||
|
|
|
@ -34,6 +34,8 @@ Application::run(new class extends Application {
|
|||
$appClass = $this->args[0] ?? null;
|
||||
if ($appClass === null) {
|
||||
self::die("Vous devez spécifier la classe de l'application");
|
||||
} elseif (!class_exists($appClass)) {
|
||||
self::die("$appClass: Cette classe n'existe pas");
|
||||
}
|
||||
$args = array_slice($this->args, 1);
|
||||
|
|
@ -8,11 +8,11 @@ use nur\sery\StateException;
|
|||
class launcher {
|
||||
static function launch(string $appClass, ...$args): int {
|
||||
$cmd = new Cmd([
|
||||
__DIR__."/../../lib/launch.php",
|
||||
__DIR__."/../../lib/_launch.php",
|
||||
$appClass,
|
||||
...$args,
|
||||
]);
|
||||
$cmd->addRedir("null");
|
||||
//$cmd->addRedir("null");
|
||||
$cmd->passthru($exitcode);
|
||||
return $exitcode;
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ class str {
|
|||
|
||||
const CAMEL_PATTERN0 = '/([A-Z0-9]+)$/A';
|
||||
const CAMEL_PATTERN1 = '/([A-Z0-9]+)[A-Z]/A';
|
||||
const CAMEL_PATTERN2 = '/([^A-Z]+)/A';
|
||||
const CAMEL_PATTERN2 = '/([A-Z]?[^A-Z]+)/A';
|
||||
const CAMEL_PATTERN3 = '/([A-Z][^A-Z]*)/A';
|
||||
|
||||
/**
|
||||
|
@ -366,7 +366,7 @@ class str {
|
|||
}
|
||||
$parts[] = strtolower($vs[1][0]);
|
||||
$index = intval($vs[1][1]) + strlen($vs[1][0]);
|
||||
while (preg_match(self::CAMEL_PATTERN3, $camel, $vs, PREG_OFFSET_CAPTURE, $index)) {
|
||||
while (preg_match(self::CAMEL_PATTERN3, $camel, $vs, PREG_OFFSET_CAPTURE, $index) !== false && $vs) {
|
||||
$parts[] = strtolower($vs[1][0]);
|
||||
$index = intval($vs[1][1]) + strlen($vs[1][0]);
|
||||
}
|
||||
|
|
|
@ -68,10 +68,15 @@ class app {
|
|||
$this->projdir = $projdir = path::abspath($params["projdir"] ?? ".");
|
||||
$this->appcode = $appcode = $params["appcode"] ?? "app";
|
||||
$this->apptype = $apptype = $params["apptype"] ?? "cli";
|
||||
# si $name est une classe, enlever le package et normaliser
|
||||
$name = $params["name"] ?? $appcode;
|
||||
$name = preg_replace('/.*\\\\/', "", $name);
|
||||
$name = str::without_suffix("-app", str::camel2us($name));
|
||||
$name = $params["name"] ?? null;
|
||||
if ($name === null) {
|
||||
$name = $appcode;
|
||||
} else {
|
||||
# si $name est une classe, enlever le package et normaliser
|
||||
$name = $params["name"] ?? $appcode;
|
||||
$name = preg_replace('/.*\\\\/', "", $name);
|
||||
$name = str::without_suffix("-app", str::camel2us($name, false, "-"));
|
||||
}
|
||||
$this->name = $name;
|
||||
$this->title = $params["title"] ?? null;
|
||||
$appcode = strtoupper($appcode);
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace nur\sery;
|
||||
|
||||
use nulib\tests\TestCase;
|
||||
|
||||
class strTest extends TestCase {
|
||||
function testCamel2us() {
|
||||
self::assertSame("a", str::camel2us("a"));
|
||||
self::assertSame("aa", str::camel2us("aa"));
|
||||
self::assertSame("aaa", str::camel2us("aaa"));
|
||||
self::assertSame("a", str::camel2us("A"));
|
||||
self::assertSame("aa", str::camel2us("Aa"));
|
||||
self::assertSame("aa", str::camel2us("AA"));
|
||||
self::assertSame("aaa", str::camel2us("Aaa"));
|
||||
self::assertSame("aaa", str::camel2us("AAA"));
|
||||
self::assertSame("a_aa", str::camel2us("AAa"));
|
||||
self::assertSame("a_b", str::camel2us("aB"));
|
||||
self::assertSame("aa_bb", str::camel2us("aaBb"));
|
||||
self::assertSame("aaa_bbb", str::camel2us("aaaBbb"));
|
||||
self::assertSame("aa_bb", str::camel2us("AaBb"));
|
||||
self::assertSame("aaa_bbb", str::camel2us("AaaBbb"));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue