kernel/private/classes/ezautoloadgenerator.php
protected function classCanBeAdded( $class, $file, $mode, $inProgressAutoloadArray )
    {
        $addClass = true;
        $sameRepositoryConflict = false;
        $kernelRepositoryConflict = false;

        if ( empty( $this->existingAutoloadArrays[self::MODE_KERNEL] ) )
        {
            $this->logWarning( "No existing kernel override found. Please generate kernel autoloads first." );
        }

        switch( $mode )
        {
            case self::MODE_KERNEL:
                $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode );

                if ( $sameRepositoryConflict )
                {
                    $addClass = false;
                }
                break;

            case self::MODE_EXTENSION:
            case self::MODE_TESTS:
            case self::MODE_SINGLE_EXTENSION:
                $kernelRepositoryConflict = $this->classExistsInArray( $class, self::MODE_KERNEL, $file, null, $mode  );
                $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode );

                if ( $kernelRepositoryConflict or $sameRepositoryConflict )
                {
                    $addClass = false;
                }
                break;

            case self::MODE_KERNEL_OVERRIDE:
                // For kernel overrides we only want class name collisions in
                // the kernel array to trigger a addClass hit. However we
                // like to emit warnings about duplicateses found in the current
                // generated array. Only one class may be overriding a kernel
                // at a time.

                $kernelRepositoryConflict = $this->classExistsInArray( $class, self::MODE_KERNEL, $file, $inProgressAutoloadArray, $mode  );
                $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode );

                if ( ( $sameRepositoryConflict and !$kernelRepositoryConflict ) or
                     ( $sameRepositoryConflict and $kernelRepositoryConflict ) or
                     ( !$kernelRepositoryConflict and !$sameRepositoryConflict )
                   )
                {
                    $addClass = false;
                }
                break;
        }
        return $addClass;
    }
protected function classCanBeAdded( $class, $file, $mode, $inProgressAutoloadArray )
    {
        $addClass = true;
        $sameRepositoryConflict = false;
        $kernelRepositoryConflict = false;

        if ( empty( $this->existingAutoloadArrays[self::MODE_KERNEL] ) )
        {
            $this->logWarning( "No existing kernel override found. Please generate kernel autoloads first." );
        }

        switch( $mode )
        {
            case self::MODE_KERNEL:
                $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode );

                if ( $sameRepositoryConflict )
                {
                    $addClass = false;
                }
                break;

            case self::MODE_EXTENSION:
            case self::MODE_TESTS:
            case self::MODE_SINGLE_EXTENSION:
                $kernelRepositoryConflict = $this->classExistsInArray( $class, self::MODE_KERNEL, $file, null, $mode  );
                $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode );

                if ( $kernelRepositoryConflict or $sameRepositoryConflict )
                {
                    $addClass = false;
                }
                break;

            case self::MODE_KERNEL_OVERRIDE:
                // For kernel overrides we only want class name collisions in
                // the kernel array to trigger a addClass hit. However we
                // like to emit warnings about duplicateses found in the current
                // generated array. Only one class may be overriding a kernel
                // at a time.

                $kernelRepositoryConflict = $this->classExistsInArray( $class, self::MODE_KERNEL, $file, $inProgressAutoloadArray, $mode  );
                $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode );

                if ( ( $sameRepositoryConflict and !$kernelRepositoryConflict ) or
                     ( $sameRepositoryConflict and $kernelRepositoryConflict ) or
                     ( !$kernelRepositoryConflict and !$sameRepositoryConflict )
                   )
                {
                    $addClass = false;
                }
                break;
        }
        return $addClass;
    }
protected function classCanBeAdded ( $ class , $ file , $ mode , $ inProgressAutoloadArray ) { $ addClass = true ; $ sameRepositoryConflict = false ; $ kernelRepositoryConflict = false ; if ( empty ( $ this -> existingAutoloadArrays [ self :: MODE_KERNEL ] ) ) { $ this -> logWarning ( "No existing kernel override found. Please generate kernel autoloads first." ) ; } switch ( $ mode ) { case self :: MODE_KERNEL : $ sameRepositoryConflict = $ this -> classExistsInArray ( $ class , $ mode , $ file , $ inProgressAutoloadArray , $ mode ) ; if ( $ sameRepositoryConflict ) { $ addClass = false ; } break ; case self :: MODE_EXTENSION : case self :: MODE_TESTS : case self :: MODE_SINGLE_EXTENSION : $ kernelRepositoryConflict = $ this -> classExistsInArray ( $ class , self :: MODE_KERNEL , $ file , null , $ mode ) ; $ sameRepositoryConflict = $ this -> classExistsInArray ( $ class , $ mode , $ file , $ inProgressAutoloadArray , $ mode ) ; if ( $ kernelRepositoryConflict or $ sameRepositoryConflict ) { $ addClass = false ; } break ; case self :: MODE_KERNEL_OVERRIDE : // For kernel overrides we only want class name collisions in // the kernel array to trigger a addClass hit. However we // like to emit warnings about duplicateses found in the current // generated array. Only one class may be overriding a kernel // at a time. $ kernelRepositoryConflict = $ this -> classExistsInArray ( $ class , self :: MODE_KERNEL , $ file , $ inProgressAutoloadArray , $ mode ) ; $ sameRepositoryConflict = $ this -> classExistsInArray ( $ class , $ mode , $ file , $ inProgressAutoloadArray , $ mode ) ; if ( ( $ sameRepositoryConflict and ! $ kernelRepositoryConflict ) or ( $ sameRepositoryConflict and $ kernelRepositoryConflict ) or ( ! $ kernelRepositoryConflict and ! $ sameRepositoryConflict ) ) { $ addClass = false ; } break ; } return $ addClass ; }
Determines if a class can be added to the autoload array.

1. When regenerating array for MODE, do not check for existance of
class duplicates in the existing array for the same mode.

2. When adding a new class to the in-progress autoload array,
check for matching keys, before adding. If match is found then
add a warning message to the warnings stack, and mark the class
not to be added.

3. If kernel array is not present, issue warning that class name
collisions cannot be checked until kernel array is generated.

4. Class collisions with kernel classes is only allowed for
MODE_KERNEL_OVERRIDE

@param string $class The name of the class being checked.
@param string $file The filename where the class is found.
@param int   $mode The mode representing the current run mode.
@param array $inProgressAutoloadArray Array of the already detected
classes for the current mode.
@return boolean
Determines if a class can be added to the autoload array .