Migrate from .stow-rename to --dotfiles

This commit is contained in:
Danielle McLean 2023-10-23 15:16:31 +11:00
parent e344a02c65
commit c9c512486d
Signed by: 00dani
GPG key ID: 52C059C3B22A753E
23 changed files with 0 additions and 2 deletions

View file

@ -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;
}