Skip to content

Commit

Permalink
bump to latest thrift version
Browse files Browse the repository at this point in the history
refactor unnecessary fully qualified class names
  • Loading branch information
TomK committed Mar 2, 2015
1 parent 9a5fb58 commit c3784b3
Show file tree
Hide file tree
Showing 4 changed files with 2,304 additions and 10,787 deletions.
27 changes: 27 additions & 0 deletions refactor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
define('DS', DIRECTORY_SEPARATOR);

$filename = __DIR__ . DS . 'src' . DS . 'cassandra' . DS . 'Cassandra.php';
$contents = file_get_contents($filename);

if(preg_match_all('~\\\cassandra\\\([a-z][a-z0-9]+)~i', $contents, $matches))
{
function sortlen($a, $b)
{
return strlen($b) - strlen($a);
}

//$use = [];

$classes = array_unique($matches[1]);
usort($classes, 'sortlen');
foreach($classes as $class)
{
$contents = str_replace(' \\cassandra\\' . $class, ' ' . $class, $contents);
$contents = str_replace('(\\cassandra\\' . $class, '(' . $class, $contents);
}

file_put_contents($filename, $contents);
}

echo 'Refactor done' . PHP_EOL . PHP_EOL;
Loading

0 comments on commit c3784b3

Please sign in to comment.