protected function collectFromFile(SimpleXMLElement $file, $namespace = '')
    {
        // Validate
        if ( ! is_file($file['name'])) throw new \RuntimeException('Invalid '.self::COVERAGE_FILE.' file');

        // Get current dir
        $currentDir = $this->getDirectory();

        // Initial return values
        $name = '';
        $source = '';
        $coverage = array();

        // #1 Get the relative file name
        $pathComponents = explode($currentDir, $file['name']);
        $relativeName = count($pathComponents) == 2 ? $pathComponents[1] : current($pathComponents);
        $name = trim($relativeName, DIRECTORY_SEPARATOR);

        if ( ! empty($namespace)) {
            // Replace backslash with directory separator
            $ns = str_replace('\\', DIRECTORY_SEPARATOR, $namespace);
            $nsComponents = explode($ns, $relativeName);
            $namespacedName = count($nsComponents) == 2 ? $nsComponents[1] : current($nsComponents);

            $name = count($nsComponents) == 2 ? $ns.DIRECTORY_SEPARATOR.trim($namespacedName, DIRECTORY_SEPARATOR) : $namespacedName;
        }

        // Then, we will overwrite any coverage block into it!
        if (count($file->line) > 1) {
            // #2 Build coverage data and the source code
            $count = 0;
            $handle = fopen($file['name'], "r");
            while(!feof($handle)){
                $source .= fgets($handle);
                $count++;
            }

            fclose($handle);

            // Here we build the default coverage values
            $coverage = array_fill(0, $count, null);

            foreach ($file->line as $line) {
                $attributes = current($line->attributes());

                // Only stmt would be count
                if (isset($attributes['type']) 
                    && isset($attributes['count']) 
                    && $attributes['type'] === 'stmt') {

                    // Decrease the line number by one
                    // since key 0 (within coverage array) is actually line number 1
                    $num = (int) $attributes['num'] - 1;

                    // Ensure it match count boundaries
                    if ($num > 0 && $num <= $count) {
                        $coverage[$num] = (int) $attributes['count'];
                    }
                }
            }
        }

        return compact('name', 'source', 'coverage');
    }