<commit_before><?php

/**
 * Email Drip Segment model
 *
 * @package     Nails
 * @subpackage  module-email-drip
 * @category    Model
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\EmailDrip\Model;

use Nails\Components;
use Nails\Factory;

class Segment
{
    protected $aSegments;

    // --------------------------------------------------------------------------


    public function __construct()
    {
        $this->aSegments = array();

        //  Look for defined segments
        foreach (Components::list() as $oComponent) {
            if (!empty($oComponent->namespace)) {
                $this->autoLoadSegments($oComponent->namespace);
            }
        }

        //  Any segments from the app?
        $this->autoLoadSegments('App\\');

        arraySortMulti($this->aSegments, 'label');
    }

    // --------------------------------------------------------------------------

    /**
     * Looks for an NAMESPACE/EmailDrip/Segments class in each component and analyses it for public methods
     * @param  string $sNamespace The namespace to check
     * @return void
     */
    protected function autoLoadSegments($sNamespace)
    {
        $sClassName = '\\' . $sNamespace . 'EmailDripSegments';

        if (class_exists($sClassName)) {

            $oReflect       = new \ReflectionClass($sClassName);
            $aPublicMethods = $oReflect->getMethods(\ReflectionMethod::IS_PUBLIC);
            $aStaticMethods = $oReflect->getMethods(\ReflectionMethod::IS_STATIC);
            $aMethods       = array_diff($aPublicMethods, $aStaticMethods);

            foreach ($aMethods as $oMethod) {
<commit_msg>fix: Updated method names<commit_after><?php

/**
 * Email Drip Segment model
 *
 * @package     Nails
 * @subpackage  module-email-drip
 * @category    Model
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\EmailDrip\Model;

use Nails\Components;
use Nails\Factory;

class Segment
{
    protected $aSegments;

    // --------------------------------------------------------------------------


    public function __construct()
    {
        $this->aSegments = array();

        //  Look for defined segments
        foreach (Components::available() as $oComponent) {
            if (!empty($oComponent->namespace)) {
                $this->autoLoadSegments($oComponent->namespace);
            }
        }

        //  Any segments from the app?
        $this->autoLoadSegments('App\\');

        arraySortMulti($this->aSegments, 'label');
    }

    // --------------------------------------------------------------------------

    /**
     * Looks for an NAMESPACE/EmailDrip/Segments class in each component and analyses it for public methods
     * @param  string $sNamespace The namespace to check
     * @return void
     */
    protected function autoLoadSegments($sNamespace)
    {
        $sClassName = '\\' . $sNamespace . 'EmailDripSegments';

        if (class_exists($sClassName)) {

            $oReflect       = new \ReflectionClass($sClassName);
            $aPublicMethods = $oReflect->getMethods(\ReflectionMethod::IS_PUBLIC);
            $aStaticMethods = $oReflect->getMethods(\ReflectionMethod::IS_STATIC);
            $aMethods       = array_diff($aPublicMethods, $aStaticMethods);

            foreach ($aMethods as $oMethod) {

{'fraction_non_alphanumeric': 0.19710232417748264, 'fraction_numerical': 0.0, 'mean_word_length': 1.7616666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7281596', 'n_tokens_mistral': 881, 'n_tokens_neox': 854, 'n_words': 193}