31 lines
640 B
PHP
31 lines
640 B
PHP
|
<?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()));
|
||
|
}
|
||
|
}
|