-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
4,485 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
// Incoming property definitions are found here | ||
$propsDir = realpath('./propsIn'); | ||
|
||
// Properties are stored here. | ||
// They can be extended and reused across objects. | ||
$propertyDir = realpath('./properties'); | ||
if (false === realpath($propertyDir)) { | ||
mkdir($propertyDir); | ||
$propertyDir = realpath($propertyDir); | ||
} | ||
|
||
// Create a directory iterator for the defined incoming properties directory | ||
$dir = new DirectoryIterator($propsDir); | ||
|
||
// Iterate through files in the incoming properties directory | ||
foreach ($dir as $fileInfo) { | ||
|
||
// Get the file name | ||
$name = $fileInfo->getFilename(); | ||
|
||
// Skip '.', '..' and `.*` files | ||
if (!$fileInfo->isDot() && substr($name, 0, 1) != '.') { | ||
var_dump($fileInfo->getPathname()); | ||
|
||
$fullPath = $fileInfo->getPathname(); | ||
|
||
$row = 1; | ||
if (($handle = fopen($fullPath, "r")) !== false) { | ||
while (($data = fgetcsv($handle, 5000, ",")) !== false) { | ||
$num = count($data); | ||
echo "<p> $num fields in line $row: <br /></p>\n"; | ||
$row++; | ||
for ($c=0; $c < $num; $c++) { | ||
echo $data[$c] . "<br />\n"; | ||
} | ||
} | ||
fclose($handle); | ||
} | ||
|
||
|
||
|
||
|
||
// Write the spec to the file pointer | ||
//fwrite($fp, $spec); | ||
|
||
// Close the file pointer | ||
//fclose($fp); | ||
} | ||
} | ||
|
||
function splitName($name) | ||
{ | ||
$re = '/(?#! splitCamelCase Rev:20140412) | ||
# Split camelCase "words". Two global alternatives. Either g1of2: | ||
(?<=[a-z]) # Position is after a lowercase, | ||
(?=[A-Z]) # and before an uppercase letter. | ||
| (?<=[A-Z]) # Or g2of2; Position is after uppercase, | ||
(?=[A-Z][a-z]) # and before upper-then-lower case. | ||
/x'; | ||
$a = preg_split($re, $ccWord); | ||
$count = count($a); | ||
for ($i = 0; $i < $count; ++$i) { | ||
printf( | ||
"Word %d of %d = \"%s\"\n", | ||
$i + 1, | ||
$count, | ||
$a[$i] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
require_once "vendor/autoload.php"; | ||
|
||
$nugget = new \Activerules\Nugget\Nugget(); | ||
|
||
$shortopts = ""; | ||
$shortopts .= "s:"; // Required - path for incoming first-pass schema objects | ||
$shortopts .= "t:"; // Required - the target '$refs' string to be replaced | ||
$shortopts .= "r:"; // Required - Replacement root for '$refs' | ||
$shortopts .= "o:"; // Required - path for generated schema w/ new $refs | ||
|
||
$options = getopt($shortopts); | ||
|
||
if (empty($options['s']) || empty($options['t']) || empty($options['r']) || empty($options['o'])) { | ||
exit; | ||
} | ||
|
||
// The directory with the core Open API schema | ||
$schemaDir = realpath($options['s']); | ||
|
||
// The $refs path being replaced | ||
$targetPath = $options['t']; | ||
|
||
// The new $refs path | ||
$replacementPath = $options['r']; | ||
|
||
// A writeable directory for the OpenAPI schema w/new $ref paths | ||
$schemaOut = realpath($options['o']); | ||
|
||
/** | ||
* Use Nugget | ||
*/ | ||
$nugget->convertSchemaFileRefs($schemaDir, $schemaOut, $targetPath, $replacementPath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
require_once "vendor/autoload.php"; | ||
|
||
$nugget = new \Activerules\Nugget\Nugget(); | ||
|
||
$shortopts = ""; | ||
$shortopts .= "s:"; // Required - path for incoming first-pass schema objects | ||
$shortopts .= "t:"; // Required - the target '$refs' string to be replaced | ||
$shortopts .= "r:"; // Required - Replacement root for '$refs' | ||
$shortopts .= "o:"; // Required - path for generated schema w/ new $refs | ||
|
||
$options = getopt($shortopts); | ||
|
||
if (empty($options['s']) || empty($options['t']) || empty($options['r']) || empty($options['o'])) { | ||
exit; | ||
} | ||
|
||
// The directory with the core Open API schema | ||
$schemaDir = realpath($options['s']); | ||
|
||
// The $refs path being replaced | ||
$targetPath = $options['t']; | ||
|
||
// The new $refs path | ||
$replacementPath = $options['r']; | ||
|
||
// A writeable directory for the OpenAPI schema w/new $ref paths | ||
$schemaOut = realpath($options['o']); | ||
|
||
/** | ||
* Use Nugget | ||
*/ | ||
echo $nugget->convertSchemaFileRefs($schemaDir, $schemaOut, $replacementPath, $targetPath); |
Oops, something went wrong.