clrghouz/app/Classes/FTN.php

31 lines
640 B
PHP
Raw Normal View History

2019-03-03 14:29:35 +00:00
<?php
namespace App\Classes;
abstract class FTN
{
/**
* Determine if a line is a kludge line.
*
* @param string $kludge
* @param string $string
* @return string
*/
protected function kludge(string $kludge,string $string)
{
return (preg_match("/^{$kludge}/",$string))
? chop(preg_replace("/^{$kludge}/",'',$string),"\r")
: FALSE;
}
/**
* This function creates our unpack header
* @return string
*/
protected function unpackheader(array $pack)
{
return join('/',array_values(collect($pack)
->sortBy(function($k,$v) {return $k[0];})
->transform(function($k,$v) {return $k[1].$v;})->toArray()));
}
}