Migrate from .stow-rename to --dotfiles
This commit is contained in:
parent
e344a02c65
commit
c9c512486d
23 changed files with 0 additions and 2 deletions
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
if (is_readable('./vendor/autoload.php')) require './vendor/autoload.php';
|
||||
|
||||
function to_array($obj) {
|
||||
if (is_array($obj)) return array_map('to_array', $obj);
|
||||
if (!is_object($obj)) return $obj;
|
||||
$cls = new \ReflectionClass($obj);
|
||||
$fields = ['__class__' => $cls->name];
|
||||
foreach ($cls->getProperties() as $prop) {
|
||||
$prop->setAccessible(true);
|
||||
$fields[$prop->getName()] = to_array($prop->getValue($obj));
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
$args = array_slice($argv, 1);
|
||||
if (empty($args)) $args[] = '-';
|
||||
foreach ($args as $arg) {
|
||||
if ($arg === '-') $arg = 'php://stdin';
|
||||
echo json_encode(to_array(unserialize(file_get_contents($arg)))) . PHP_EOL;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue