新しいプロジェクトの追加はプロジェクト情報作成から行えます

誰でもコミットできます Lazy_Reflection

Subversion Repository: http://openpear.org/repository/Lazy_Reflection / Latest Release: no release

正規表現でゴリゴリPHPのclassをぶった切っていきます。

Classkitは使いたくないんだけどちょっとゴリゴリしたいなぁ・・・って時につかうような形です。


興味がある方はsvnからチェックアウトして動作確認してください。

/**
* Lazy Reflection
* - Scraping PHP Class.
*
* @author Shuhei Tanuma
* @copyright 2010 Shuhei Tanuma
* @created 23:05 2010/01/18
* @licence Apache License 2.0
*
*   Copyright 2010 Shuhei Tanuma
*
*   Licensed under the Apache License, Version 2.0 (the "License");
*   you may not use this file except in compliance with the License.
*   You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*   Unless required by applicable law or agreed to in writing, software
*   distributed under the License is distributed on an "AS IS" BASIS,
*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*   See the License for the specific language governing permissions and
*   limitations under the License.
*/



$classdata = '
class Moe{
  /**
  * moe is beautiful
  */
  public function Uhi(){
    echo "ウヒッ";
  }
}';

$reflection = Lazy_Reflection::LoadString($classdata);
echo $reflection->outputClass();
//class Moe{
//  public function Uhi()
//  {
//    echo "ウヒッ";
//  }
//}

$method = new Lazy_Method();
$method->setName("MoeMoe");
$method->setData("\r\n    echo 'モエモエッ';\r\n  ");

$reflection->setMethod($method);

echo $reflection->outputClass();
//class Moe{
//    /**
//  * moe is beautiful
//  */
//  public function Uhi()
//  {
//    echo "ウヒッ";
//  }
//
//  public function MoeMoe()
//  {
//    echo 'モエモエッ';
//  }
//}

var_dump($reflection->getDocComment("Uhi"));
//string(16) "moe is beautiful"

How to Install

sudo pear install openpear/Lazy_Reflection

このプロジェクトを応援する開発者!

maintainer

gravatar st (lead)

主にサーバー周りを弄ったり。なんちゃってPHPer