<commit_before><?php
/**
 * Pop PHP Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.TXT.
 * It is also available through the world-wide-web at this URL:
 * http://www.popphp.org/LICENSE.TXT
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to <EMAIL> so we can send you a copy immediately.
 *
 * @category   Pop
 * @package    Pop_Code
 * @author     <NAME>, III <<EMAIL>>
 * @copyright  Copyright (c) 2009-2012 Moc 10 Media, LLC. (http://www.moc10media.com)
 * @license    http://www.popphp.org/LICENSE.TXT     New BSD License
 */

/**
 * @namespace
 */
namespace Pop\Code;

use Pop\Locale\Locale;

/**
 * @category   Pop
 * @package    Pop_Code
 * @author     <NAME>, III <<EMAIL>>
 * @copyright  Copyright (c) 2009-2012 Moc 10 Media, LLC. (http://www.moc10media.com)
 * @license    http://www.popphp.org/LICENSE.TXT     New BSD License
 * @version    0.9
 */
class DocblockGenerator
{

    /**
     * Docblock description
     * @var string
     */
    protected $_desc = null;

    /**
     * Docblock tags
     * @var array
     */
    protected $_tags = array('param' => array());

    /**
     * Docblock indent
     * @var string
     */
    protected $_indent = null;

    /**
     * Docblock output
     * @var string
     */
    protected $_output = null;

    /**
     * Constructor
     *
     * Instantiate the docblock generator object
     *
     * @param  string $desc
     * @param  string $indent
     * @return void
     */
    public function __construct($desc = null, $indent = null)
    {
        $this->_desc = $desc;
        $this->_indent = $indent;
    }

    /**
     * Static method to instantiate the docblock object and return itself
     * to facilitate chaining methods together.
     *
     * @param  string $desc
     * @param  string $indent
     * @return Pop\Code\DocblockGenerator
     */
    public static function factory($desc = null, $indent = null)
    {
        return new self($desc, $indent);
    }

    /**
     * Static method to instantiate the docblock object and return itself
     * to facilitate chaining methods together.
     *
     * @param  string $docblock
     * @throws Exception
     * @return Pop\Code\DocblockGenerator
     */
    public static function parse($docblock)
    {
        if ((strpos($docblock, '/*') === false) || (strpos($docblock, '*/') === false)) {
            throw new Exception(Locale::factory()->__('The docblock is not in the correct format.'));
        }

        $desc = null;
        $formattedDesc = null;
        $indent = null;
        $tags = null;

        // Parse the description, if any
        if (strpos($docblock, '@') !== false) {
            $desc = substr($docblock, 0, strpos($docblock, '@'));
            $desc = str_replace('/*', '', $desc);
            $desc = str_replace('*/', '', $desc);
            $desc = str_replace(PHP_EOL . ' * ', ' ', $desc);
            $desc = trim(str_replace('*', '', $desc));
            $descAry = explode(PHP_EOL, $desc);<commit_msg>Quick tweak to the DocblockGenerator class<commit_after><?php
/**
 * Pop PHP Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.TXT.
 * It is also available through the world-wide-web at this URL:
 * http://www.popphp.org/LICENSE.TXT
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to <EMAIL> so we can send you a copy immediately.
 *
 * @category   Pop
 * @package    Pop_Code
 * @author     <NAME>, III <<EMAIL>>
 * @copyright  Copyright (c) 2009-2012 Moc 10 Media, LLC. (http://www.moc10media.com)
 * @license    http://www.popphp.org/LICENSE.TXT     New BSD License
 */

/**
 * @namespace
 */
namespace Pop\Code;

use Pop\Locale\Locale;

/**
 * @category   Pop
 * @package    Pop_Code
 * @author     <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2009-2012 Moc 10 Media, LLC. (http://www.moc10media.com)
 * @license    http://www.popphp.org/LICENSE.TXT     New BSD License
 * @version    0.9
 */
class DocblockGenerator
{

    /**
     * Docblock description
     * @var string
     */
    protected $_desc = null;

    /**
     * Docblock tags
     * @var array
     */
    protected $_tags = array('param' => array());

    /**
     * Docblock indent
     * @var string
     */
    protected $_indent = null;

    /**
     * Docblock output
     * @var string
     */
    protected $_output = null;

    /**
     * Constructor
     *
     * Instantiate the docblock generator object
     *
     * @param  string $desc
     * @param  string $indent
     * @return void
     */
    public function __construct($desc = null, $indent = null)
    {
        $this->_desc = $desc;
        $this->_indent = $indent;
    }

    /**
     * Static method to instantiate the docblock object and return itself
     * to facilitate chaining methods together.
     *
     * @param  string $desc
     * @param  string $indent
     * @return Pop\Code\DocblockGenerator
     */
    public static function factory($desc = null, $indent = null)
    {
        return new self($desc, $indent);
    }

    /**
     * Static method to parse a docblock string and return a new
     * docblock generator object.
     *
     * @param  string $docblock
     * @throws Exception
     * @return Pop\Code\DocblockGenerator
     */
    public static function parse($docblock)
    {
        if ((strpos($docblock, '/*') === false) || (strpos($docblock, '*/') === false)) {
            throw new Exception(Locale::factory()->__('The docblock is not in the correct format.'));
        }

        $desc = null;
        $formattedDesc = null;
        $indent = null;
        $tags = null;

        // Parse the description, if any
        if (strpos($docblock, '@') !== false) {
            $desc = substr($docblock, 0, strpos($docblock, '@'));
            $desc = str_replace('/*', '', $desc);
            $desc = str_replace('*/', '', $desc);
            $desc = str_replace(PHP_EOL . ' * ', ' ', $desc);
            $desc = trim(str_replace('*', '', $desc));
            $descAry = explode(PHP_EOL, $desc);
{'fraction_non_alphanumeric': 0.13713650087398696, 'fraction_numerical': 0.008580962974733831, 'mean_word_length': 2.204684317718941, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6740935', 'n_tokens_mistral': 1941, 'n_tokens_neox': 1874, 'n_words': 572}