Skip to content

Commit 21e0f0e

Browse files
committed
more little steps
1 parent 70338f5 commit 21e0f0e

File tree

6 files changed

+13
-67
lines changed

6 files changed

+13
-67
lines changed

files/constants.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
const PHPFHIR_OUTPUT_TMP_DIR = PHPFHIR_DEFAULT_OUTPUT_DIR . DIRECTORY_SEPARATOR . 'tmp';
2424
const PHPFHIR_FHIR_VALIDATION_JAR = PHPFHIR_BIN_DIR . DIRECTORY_SEPARATOR . 'validator_cli.jar';
2525

26-
// format regex
27-
const PHPFHIR_VARIABLE_NAME_REGEX = '{^[a-zA-Z_][a-zA-Z0-9_]*$}S';
28-
const PHPFHIR_FUNCTION_NAME_REGEX = '{^[a-zA-Z_][a-zA-Z0-9_]*$}S';
29-
const PHPFHIR_CLASSNAME_REGEX = '{^[a-zA-Z_][a-zA-Z0-9_]*$}S';
30-
const PHPFHIR_NAMESPACE_REGEX = '{^[a-zA-Z][a-zA-Z0-9_]*(\\\[a-zA-Z0-9_]+)*[a-zA-Z0-9_]$}';
31-
3226
// type suffixes
3327
const PHPFHIR_PRIMITIVE_SUFFIX = '-primitive';
3428
const PHPFHIR_LIST_SUFFIX = '-list';
@@ -81,13 +75,13 @@
8175
// Core class names
8276
const PHPFHIR_CLASSNAME_AUTOLOADER = 'Autoloader';
8377
const PHPFHIR_CLASSNAME_CONFIG = 'Config';
78+
const PHPFHIR_CLASSNAME_TYPEMAP = 'TypeMap';
8479
const PHPFHIR_CLASSNAME_RESPONSE_PARSER = 'ResponseParser';
8580
const PHPFHIR_CLASSNAME_CONSTANTS = 'Constants';
8681
const PHPFHIR_CLASSNAME_API_CLIENT = 'ApiClient';
8782
const PHPFHIR_CLASSNAME_API_CLIENT_REQUEST = 'ApiClientRequest';
8883
const PHPFHIR_CLASSNAME_API_CLIENT_RESPONSE = 'ApiClientResponse';
8984
const PHPFHIR_CLASSNAME_XML_WRITER = 'XmlWriter';
90-
const PHPFHIR_CLASSNAME_DEBUG_CLIENT = 'DebugClient';
9185

9286
// Core interface names
9387
const PHPFHIR_INTERFACE_TYPE_MAP = 'TypeMapInterface';

src/Utilities/FileUtils.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public static function mkdirRecurse(string ...$bits): string
5252
if (!is_dir($path) && !mkdir($path, 0777, true)) {
5353
throw new RuntimeException(sprintf('Unable to create directory at path "%s"', $path));
5454
}
55-
var_dump(realpath($path));
5655
return realpath($path);
5756
}
5857

src/Utilities/NameUtils.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
*/
2727
abstract class NameUtils
2828
{
29+
public const VARIABLE_NAME_REGEX = '{^[a-zA-Z_][a-zA-Z0-9_]*$}S';
30+
public const FUNCTION_NAME_REGEX = '{^[a-zA-Z_][a-zA-Z0-9_]*$}S';
31+
public const CLASSNAME_REGEX = '{^[a-zA-Z_][a-zA-Z0-9_]*$}S';
32+
public const NAMESPACE_REGEX = '{^[a-zA-Z][a-zA-Z0-9_]*(\\\[a-zA-Z0-9_]+)*[a-zA-Z0-9_]$}';
33+
2934
/** @var array */
3035
public static array $classNameSearch = [
3136
'.',
@@ -115,7 +120,7 @@ abstract class NameUtils
115120
*/
116121
public static function isValidVariableName(string $name): bool
117122
{
118-
return (bool)preg_match(PHPFHIR_VARIABLE_NAME_REGEX, $name);
123+
return (bool)preg_match(self::VARIABLE_NAME_REGEX, $name);
119124
}
120125

121126
/**
@@ -124,7 +129,7 @@ public static function isValidVariableName(string $name): bool
124129
*/
125130
public static function isValidFunctionName(string $name): bool
126131
{
127-
return (bool)preg_match(PHPFHIR_FUNCTION_NAME_REGEX, $name);
132+
return (bool)preg_match(self::FUNCTION_NAME_REGEX, $name);
128133
}
129134

130135
/**
@@ -133,7 +138,7 @@ public static function isValidFunctionName(string $name): bool
133138
*/
134139
public static function isValidClassName(string $name): bool
135140
{
136-
return (bool)preg_match(PHPFHIR_CLASSNAME_REGEX, $name);
141+
return (bool)preg_match(self::CLASSNAME_REGEX, $name);
137142
}
138143

139144
/**
@@ -142,7 +147,7 @@ public static function isValidClassName(string $name): bool
142147
*/
143148
public static function isValidNSName(?string $name): bool
144149
{
145-
return null === $name || '' === $name || preg_match(PHPFHIR_NAMESPACE_REGEX, $name);
150+
return null === $name || '' === $name || preg_match(self::NAMESPACE_REGEX, $name);
146151
}
147152

148153
/**

template/core/classes/class_autoloader.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@
112112
require __DIR__ . DIRECTORY_SEPARATOR . '<?php echo PHPFHIR_CLASSNAME_API_CLIENT; ?>.php';
113113
}
114114

115-
// debug client
116-
if (!class_exists('<?php echo $config->getFullyQualifiedName(true, PHPFHIR_CLASSNAME_DEBUG_CLIENT); ?>', false)) {
117-
require __DIR__ . DIRECTORY_SEPARATOR . '<?php echo PHPFHIR_CLASSNAME_DEBUG_CLIENT; ?>.php';
118-
}
119-
120115
/**
121116
* Class <?php echo PHPFHIR_CLASSNAME_AUTOLOADER; if ('' !== $namespace) : ?>
122117

template/core/classes/class_debug_client.php

Lines changed: 0 additions & 47 deletions
This file was deleted.

template/versions/types/tests/integration/class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
use <?php echo $bundleType->getFullyQualifiedClassName(false); ?>;
7070
use <?php echo $type->getFullyQualifiedClassName(false); ?>;
71-
use <?php echo $config->getFullyQualifiedName(false, PHPFHIR_CLASSNAME_DEBUG_CLIENT); ?>;
71+
use <?php echo $config->getFullyQualifiedName(false, PHPFHIR_CLASSNAME_API_CLIENT); ?>;
7272
use <?php echo $config->getFullyQualifiedName(false, PHPFHIR_ENUM_TYPE); ?>;
7373
use <?php echo $config->getFullyQualifiedName(false, PHPFHIR_CLASSNAME_RESPONSE_PARSER); ?>;
7474
use PHPUnit\Framework\AssertionFailedError;
@@ -82,8 +82,8 @@
8282
*/
8383
class <?php echo $testClassname; ?> extends TestCase
8484
{
85-
/** @var <?php echo $config->getFullyQualifiedName(true, PHPFHIR_CLASSNAME_DEBUG_CLIENT); ?> */
86-
private <?php echo PHPFHIR_CLASSNAME_DEBUG_CLIENT; ?> $client;
85+
/** @var <?php echo $config->getFullyQualifiedName(true, PHPFHIR_CLASSNAME_API_CLIENT); ?> */
86+
private <?php echo PHPFHIR_CLASSNAME_API_CLIENT; ?> $client;
8787

8888
/** @var array */
8989
private array $_fetchedResources = [];

0 commit comments

Comments
 (0)