php-tail 추가
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* Cygwin class file.
|
||||
*
|
||||
* This class represents an operating system of the Cygwin family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/Cygwin
|
||||
*/
|
||||
class Cygwin extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* Darwin class file.
|
||||
*
|
||||
* This class represents an operating system of the Darwin family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/Darwin_(operating_system)
|
||||
*/
|
||||
class Darwin extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* EComStation class file.
|
||||
*
|
||||
* This class represents an operating system of the eComStation family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/EComStation
|
||||
*/
|
||||
class EComStation extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* FreeBsd class file.
|
||||
*
|
||||
* This class represents an operating system of the FreeBSD family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/FreeBSD
|
||||
*/
|
||||
class FreeBsd extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* HpUx class file.
|
||||
*
|
||||
* This class represents an operating system of the HP-UX family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/HP-UX
|
||||
*/
|
||||
class HpUx extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* Irix64 class file.
|
||||
*
|
||||
* This class represents an operating system of the IRIX family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/IRIX
|
||||
*/
|
||||
class Irix64 extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* Linux class file.
|
||||
*
|
||||
* This class is a metaclass that represents all operating systems that
|
||||
* comply with the linux family and that are not treated as a separate family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/Linux
|
||||
*/
|
||||
class Linux extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* NetBsd class file.
|
||||
*
|
||||
* This class represents an operating system of the NetBSD family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/NetBSD
|
||||
*/
|
||||
class NetBsd extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* OpenBsd class file.
|
||||
*
|
||||
* This class represents an operating system of the OpenBSD family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/OpenBSD
|
||||
*/
|
||||
class OpenBsd extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* OperatingSystem abstract class file.
|
||||
*
|
||||
* Represents the current running operating system. This class is the interface
|
||||
* for all the lower classes in the hierarchy.
|
||||
*
|
||||
* @author Anastaszor
|
||||
*/
|
||||
abstract class OperatingSystem
|
||||
{
|
||||
/**
|
||||
* The current running operating system singleton instance.
|
||||
*
|
||||
* @var OperatingSystem
|
||||
*/
|
||||
private static $_current = null;
|
||||
|
||||
/**
|
||||
* Gets the current running operating system singleton instance.
|
||||
*
|
||||
* @return OperatingSystem
|
||||
*/
|
||||
public static function get()
|
||||
{
|
||||
if(self::$_current === null)
|
||||
self::$_current = self::factory();
|
||||
return self::$_current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the operating system object from php's core parameters.
|
||||
*
|
||||
* @return OperatingSystem
|
||||
*/
|
||||
private static function factory()
|
||||
{
|
||||
switch(PHP_OS)
|
||||
{
|
||||
case 'CYGWIN_NT-5.1':
|
||||
return new Cygwin();
|
||||
case 'Darwin':
|
||||
return new Darwin();
|
||||
case 'FreeBSD':
|
||||
return new FreeBsd();
|
||||
case 'HP-UX':
|
||||
return new HpUx();
|
||||
case 'IRIX64':
|
||||
return new Irix64();
|
||||
case 'Linux':
|
||||
return new Linux();
|
||||
case 'NetBSD':
|
||||
return new NetBsd();
|
||||
case 'OpenBSD':
|
||||
return new OpenBsd();
|
||||
case 'SunOS':
|
||||
return new Solaris();
|
||||
case 'Unix':
|
||||
return new Unix();
|
||||
case 'WIN32':
|
||||
return new Win32();
|
||||
case 'WINNT':
|
||||
return new WinNT();
|
||||
case 'Windows':
|
||||
case 'Windows XP 64-bit':
|
||||
return new Win64();
|
||||
case 'OS/2 Warp':
|
||||
return new Os2();
|
||||
case 'eComStation':
|
||||
return new EComStation();
|
||||
case 'RISC OS':
|
||||
return new RiscOs();
|
||||
}
|
||||
|
||||
return new UnknownOs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether running operating system is unix based.
|
||||
*
|
||||
* @return boolean true if the system is unix based
|
||||
*/
|
||||
abstract public function isUnix();
|
||||
|
||||
/**
|
||||
* Gets whether running operating system is windows based.
|
||||
*
|
||||
* @return boolean true if the system is windows based
|
||||
*/
|
||||
abstract public function isWindows();
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* Os2 class file.
|
||||
*
|
||||
* This class represents an operating system of the OS/2 family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/OS/2
|
||||
*/
|
||||
class Os2 extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* RiscOs class file.
|
||||
*
|
||||
* This class represents an operating system of the RISC OS family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/RISC_OS
|
||||
*/
|
||||
class RiscOs extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* Solaris class file.
|
||||
*
|
||||
* This class represents an operating system of the Solaris family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/Solaris_(operating_system)
|
||||
*/
|
||||
class Solaris extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* Unix class file.
|
||||
*
|
||||
* This class represents a metaclass that represents all operating systems that
|
||||
* comply with the linux family and that are not treated as a separate family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/Unix
|
||||
*/
|
||||
class Unix extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* UnknownOs class file.
|
||||
*
|
||||
* This class represents an Os this library was not able to detect.
|
||||
*
|
||||
* @author Anastaszor
|
||||
*/
|
||||
class UnknownOs extends OperatingSystem
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* Win32 class file.
|
||||
*
|
||||
* This class represents an operating system of the windows x86 family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/Microsoft_Windows
|
||||
*/
|
||||
class Win32 extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* Win64 class file.
|
||||
*
|
||||
* This class represents an operating system of the windows x64 family.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/Microsoft_Windows
|
||||
*/
|
||||
class Win64 extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace PhpExtended\System;
|
||||
|
||||
/**
|
||||
* WinNT class file.
|
||||
*
|
||||
* This class represents an operating system on the windows NT kernel.
|
||||
*
|
||||
* @author Anastaszor
|
||||
* @see https://en.wikipedia.org/wiki/Microsoft_Windows
|
||||
*/
|
||||
class WinNT extends OperatingSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isUnix()
|
||||
*/
|
||||
public function isUnix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see OperatingSystem::isWindows()
|
||||
*/
|
||||
public function isWindows()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user