Получение заголовков письма

@param $id

@return null|string
15497
public function top($id)
    {
        if ($this->_mails && isset($this->_mails[$id])) {
            $lines = file($this->_path.'/'.$this->_mails[$id]['file_name']);
//            $data = file_get_contents($this->_path.'/'.$this->_mails[$id]['file_name']);
//            preg_match(Headers::BOUNDARY_PATTERN, str_replace("\r\n\t", ' ', $data), $subBoundary);
//            if (isset($subBoundary[1])) {
//                $data = preg_split('/'.$subBoundary[1].'[\"\r\n]/si', $data)[0].$subBoundary[1].'"';
//            } else {
//            $data = preg_split('/[\n\r]{3,}/s', $data)[0];
//            }
            $data = [];
            $countEmpty = 0;
            $isName = false;
            foreach ($lines as $line) {
                if ($line[0] !== "\t" && $line[0] !== ' ' && preg_match('/^[A-Z]/', $line) && $line[0] !== '-' && strpos($line, ':') !== false) {
                    $data[] = $line;
                    $countEmpty = 0;
                    $isName = true;
                } elseif (($line[0] === "\t" || $line[0] === ' ') && !empty(trim($line)) && $isName) {
                    $data[] = $line;
                    $countEmpty = 0;
                } elseif (empty(trim($line))) {
                    $data[] = $line;
                    $countEmpty++;
                    $isName = false;
                } elseif ($line[0] === '-' && $line[1] === '-' && $countEmpty > 0) {
                    preg_match(Headers::BOUNDARY_PATTERN, str_replace("\r\n\t", ' ', implode($data)), $subBoundary);
                    if (isset($subBoundary[1]) && strpos($line, $subBoundary[1]) !== false) {
                        break;
                    }
                    $isName = false;
                } elseif ($countEmpty > 0) {
                    break;
                } else {
                    //опасный момент
                }
            }

            return implode($data);
        }

        return null;
    }
764172
public function findById($id)
    {
        $rowset = $this->getTableGateway()->select(function (Select $select) use($id) {
            $select->columns($this->columns)
            ->where(array(
                'id' => $id
            ))
            ->limit(1);
        });
        $row = $rowset->current();
        if (! $row) {
            return NULL;
        }
        return $row;
    }
809751
public function getLocaleById($id) {
        $locale = $this->source
            ->where('id', $id)
            ->first();

        return isset($locale->id) ? $locale->locale : null;
    }
590268
public function get($id)
    {
        foreach ($this->items as $item) {
            if ($item->id === $id) {
                return $item;
            }
        }
        return null;
    }
791594
public function find($id)
    {
        $key = $this->getHash().$id;
        if($this->getFileManager()->has($key)) {
            return $this->loadEntity($key);
        }
        
        return null;
    }
80971
private function getAdmin($id)
    {
        $admin = $this->adminPool->getContainer()->get($id);

        if ($admin instanceof  AdminInterface) {
            return $admin;
        }

        return null;
    }
919022
private function getKey(string $id = null) : string
    {
        $id = $id ?: session_id();
        return sprintf('%s/session/%s', session_name(), $id);
    }
645411
public function getElementById($id)
    {
        // start with document
        $stack = array($this);

        while (!empty($stack)) {
            $elem = array_pop($stack);
            // check current node
            if ($elem->getAttribute('id') === $id) {
                return $elem;
            }
            // add children to stack (tree order traversal)
            if ($elem instanceof SVGNodeContainer) {
                for ($i = $elem->countChildren() - 1; $i >= 0; --$i) {
                    array_push($stack, $elem->getChild($i));
                }
            }
        }

        return null;
    }
966283
public function getElementById($id)
    {
        foreach ($this->getRecursiveIterator() as $element) {
            if ($id == $element->getId()) {
                return $element;
            }
        }
        return null;
    }
1011773
public static function getModuleDomain($id) {
        static $domains = null;
        if ($domains === null) {
            $domain  = App::acfg('domains@default');
            $domains = @array_flip($domain);
            if (!$domains) {
                $domains = [];
            }
        }

        return isset($domains[ $id ]) ? $domains[ $id ] : null;
    }
1306946
public function getById($id)
    {
        if (isset($this->idList[$id])) {
            return $this->idList[$id];
        }

        return null;
    }
245251
public function findCacheById(int $id)
    {

        // Check if already in addToCache
        if ($this->isCachedById($id)) {
            return $this->cacheById[$id];
        }

        return null;
    }
943795
public function getGenre($id)
    {
        foreach ($this->data as $genre) {
            if ($id === $genre->getId()) {
                return $genre;
            }
        }

        return null;
    }
357266
public static function getFromCache($id)
    {
        $arrayCache = Configuration::getArrayCache();
        if ($arrayCache->contains($id)) {
            return $arrayCache->fetch($id);
        }

        $cacheDriver = Configuration::getCacheDriver();
        if ($cacheDriver !== null) {
            $cacheResult = $cacheDriver->fetch($id);
            if ($cacheResult !== false) {
                $arrayCache->save($id, $cacheResult);
                return $cacheResult;
            }
        }

        return null;
    }
1202624
private function loadSolution(string $id)
    {
        $id = $this->resolveAlias($id);
        if (!$this->hasSolution($id)) {
            return null;
        }

        if ($this->fullyLoadedSolutions[$id]) {
            return $this->solutions[$id];
        } else {
            $loader = $this->solutions[$id];
            $this->solutions[$id] = $solution = $loader();
            $this->onLoadSolution($solution);
            $this->fullyLoadedSolutions[$id] = true;

            return $solution;
        }
    }
1290834
protected function doContains($id)
    {
        $found = false;
        $this->delegate->get($id, null, $found);
        return $found;
    }
856973
public function get($id)
    {
        return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, $id));
    }