php-tail 추가

This commit is contained in:
2018-04-01 18:44:45 +09:00
parent 74390602d8
commit 5860a14dae
40 changed files with 1928 additions and 2 deletions
+10
View File
@@ -0,0 +1,10 @@
composer.phar
/vendor/
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
.settings/
.buildpath
.project
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+38
View File
@@ -0,0 +1,38 @@
# php-system
A generic way to find informations about your system
## Installation
The installation of this library is made via composer.
Download `composer.phar` from [their website](https://getcomposer.org/download/).
Then add to your composer.json :
```json
"require": {
...
"php-extended/php-system": "^1.0",
...
}
```
Then run `php composer.phar update` to install this library.
The autoloading of all classes of this library is made through composer's autoloader.
## Basic Usage
You can get the singleton php-system object by doing the following:
```php
use PhpExtended\System\OperatingSystem;
$system = OperatingSystem::get();
```
This system object have lots of useful properties. An instance of `UnknownOs` is returned in case this is not implemented.
The `get` method never throws any exception.
## License
MIT (See [license file](LICENSE)).
+27
View File
@@ -0,0 +1,27 @@
{
"name" : "php-extended/php-system",
"description" : "A generic way to find informations about the running system",
"type" : "library",
"homepage" : "https://github.com/php-extended/php-system",
"license" : "MIT",
"authors" : [{
"name" : "Anastaszor",
"role" : "Developer"
}
],
"support" : {
"issues" : "https://github.com/php-extended/php-system/issues",
"source" : "https://github.com/php-extended/php-system"
},
"autoload" : {
"psr-4" : {
"PhpExtended\\System\\" : "src/"
}
},
"keywords" : [
"php",
"system",
"os",
"operating system"
]
}
+36
View File
@@ -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
View File
@@ -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;
}
}
+36
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
}
+95
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
}
+34
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
}