<commit_before><?php
namespace Respect;

use \SplObjectStorage;
use \ReflectionClass;
use \ReflectionMethod;
use \ReflectionProperty;


/**
 * DocItem Reflection Class to speak where is the socks to rock it.  
 * 
 * @author <NAME> <<EMAIL>> 
 */
class DocItem
{
    private $item;
    private $refItem;

    /**
     * __construct Construct a doc Item 
     * 
     * @access public
     * @return void
     */
    public function __construct($item)
    {
       $this->docItem =  $item;
       $this->refItem = new ReflectionClass($item);
    }
    public function getName()
    {
        return $this->refItem->getName();
    }
    public function getDocComment()
    {
        return $this->refItem->getDocComment();
    }
    public function __call($method, $parameters)
    {
        return call_user_func_array(array($this->refItem, $method),$parameters );
    }
}
<commit_msg>extract getSections from Doc to here<commit_after><?php
namespace Respect;

use \SplObjectStorage;
use \ReflectionClass;
use \ReflectionMethod;
use \ReflectionProperty;


/**
 * DocItem Reflection Class to speak where is the socks to rock it.  
 * 
 * @author <NAME> <<EMAIL>> 
 */
class DocItem
{
    private $item;
    private $refItem;

    /**
     * __construct Construct a doc Item 
     * 
     * @access public
     * @return void
     */
    public function __construct($item)
    {
       $this->docItem =  $item;
       $this->refItem = new ReflectionClass($item);
    }
    public function getName()
    {
        return $this->refItem->getName();
    }
    public function getDocComment()
    {
        return $this->refItem->getDocComment();
    }
    public function __call($method, $parameters)
    {
        return call_user_func_array(array($this->refItem, $method),$parameters );
    }
    public function getMethods($scope=null)
    {
        if (is_null($scope))
            return $this->refItem->getMethods();
        return $this->refItem->getMethods($scope);
    }
    public function getSections() 
    {
        $testCaseClass = $this->getName().'Test';

        if (class_exists($testCaseClass)) {
            $testCaseReflection = new ReflectionClass($testCaseClass);
            $testCaseMethods = $testCaseReflection->getMethods();
        } else {
            $testCaseMethods= array();
        }
        $sections = new SplObjectStorage;
        $methods = $this->getMethods(ReflectionMethod::IS_PUBLIC ^ ReflectionMethod::IS_STATIC);
        $properties = $this->getProperties(ReflectionProperty::IS_PUBLIC ^ ReflectionProperty::IS_STATIC);
        $staticMethods = $this->getMethods(ReflectionMethod::IS_PUBLIC & ReflectionMethod::IS_STATIC);
        $staticProperties = $this->getProperties(ReflectionProperty::IS_PUBLIC & ReflectionProperty::IS_STATIC);

        $nameSort = function($a, $b) {
            return strnatcasecmp($a->getName(), $b->getName());
        };

        usort($methods, $nameSort);
        usort($properties, $nameSort);
        usort($staticMethods, $nameSort);
        usort($staticProperties, $nameSort);
        foreach (array_merge($staticProperties, $properties, $staticMethods, $methods) as $method)
            $sections[$method] = array_values(array_filter($testCaseMethods, function($test) use($method) {
                                    return 0 === stripos($test->getName(), 'test_as_example_for_'.$method->getName().'_method');
                                 }));
        return $sections;
    }


}

{'fraction_non_alphanumeric': 0.12965636731157956, 'fraction_numerical': 0.00028876696505919725, 'mean_word_length': 2.720730397422127, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1851300', 'n_tokens_mistral': 1002, 'n_tokens_neox': 973, 'n_words': 207}