src/MailLogger.php
public function getLogFile(string $type, string $timestamp): string
	{
		preg_match('/^((([0-9]{4})-[0-9]{2})-[0-9]{2}).*/', $timestamp, $fragments);

		$yearDir = $this->logDirectory . '/' . $fragments[3];
		$monthDir = $yearDir . '/' . $fragments[2];
		$dayDir = $monthDir . '/' . $fragments[1];
		$file = $dayDir . '/' . $type . static::LOG_EXTENSION;

		if (!file_exists($dayDir)) {
			mkdir($dayDir, 0777, true);
		}

		if (!file_exists($file)) {
			touch($file);
		}

		return $file;
	}
public function getLogFile(string $type, string $timestamp): string
	{
		preg_match('/^((([0-9]{4})-[0-9]{2})-[0-9]{2}).*/', $timestamp, $fragments);

		$yearDir = $this->logDirectory . '/' . $fragments[3];
		$monthDir = $yearDir . '/' . $fragments[2];
		$dayDir = $monthDir . '/' . $fragments[1];
		$file = $dayDir . '/' . $type . static::LOG_EXTENSION;

		if (!file_exists($dayDir)) {
			mkdir($dayDir, 0777, true);
		}

		if (!file_exists($file)) {
			touch($file);
		}

		return $file;
	}
public function getLogFile ( string $ type , string $ timestamp ) : string { preg_match ( '/^((([0-9]{4})-[0-9]{2})-[0-9]{2}).*/' , $ timestamp , $ fragments ) ; $ yearDir = $ this -> logDirectory . '/' . $ fragments [ 3 ] ; $ monthDir = $ yearDir . '/' . $ fragments [ 2 ] ; $ dayDir = $ monthDir . '/' . $ fragments [ 1 ] ; $ file = $ dayDir . '/' . $ type . static :: LOG_EXTENSION ; if ( ! file_exists ( $ dayDir ) ) { mkdir ( $ dayDir , 0777 , true ) ; } if ( ! file_exists ( $ file ) ) { touch ( $ file ) ; } return $ file ; }
If not already created, create a directory path that sticks to the standard described above
If not already created create a directory path that sticks to the standard described above