mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Reformatting, removing unused imports
This commit is contained in:
parent
fd8e5b27e5
commit
38809f7da2
@ -71,7 +71,6 @@ use PocketMine\Tile\Tile;
|
||||
use PocketMine\Utils\Config;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
use PocketMine\Utils\Utils;
|
||||
use PocketMine\Command\CommandSender;
|
||||
|
||||
/**
|
||||
* Main class that handles networking, recovery, and packet sending to the server part
|
||||
|
@ -32,7 +32,6 @@ use PocketMine\Command\ConsoleCommandSender;
|
||||
use PocketMine\Command\PluginCommand;
|
||||
use PocketMine\Command\SimpleCommandMap;
|
||||
use PocketMine\Entity\Entity;
|
||||
use PocketMine\Event\Event;
|
||||
use PocketMine\Event\HandlerList;
|
||||
use PocketMine\Event\Server\PacketReceiveEvent;
|
||||
use PocketMine\Event\Server\PacketSendEvent;
|
||||
@ -454,9 +453,9 @@ class Server{
|
||||
|
||||
/**
|
||||
* @param \SplClassLoader $autoloader
|
||||
* @param string $filePath
|
||||
* @param string $dataPath
|
||||
* @param string $pluginPath
|
||||
* @param string $filePath
|
||||
* @param string $dataPath
|
||||
* @param string $pluginPath
|
||||
*/
|
||||
public function __construct(\SplClassLoader $autoloader, $filePath, $dataPath, $pluginPath){
|
||||
self::$instance = $this;
|
||||
|
@ -21,17 +21,10 @@
|
||||
|
||||
namespace PocketMine;
|
||||
|
||||
use PocketMine\Block\Block;
|
||||
use PocketMine\Entity\Entity;
|
||||
use PocketMine\Item\Item;
|
||||
use PocketMine\Level\Level;
|
||||
use PocketMine\Network\Protocol\Info;
|
||||
use PocketMine\Network\Query\QueryHandler;
|
||||
use PocketMine\Network\RCON\RCON;
|
||||
use PocketMine\Network\UPnP\UPnP;
|
||||
use PocketMine\Plugin\PluginManager;
|
||||
use PocketMine\Recipes\Crafting;
|
||||
use PocketMine\Tile\Tile;
|
||||
use PocketMine\Utils\Config;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
use PocketMine\Utils\Utils;
|
||||
@ -261,7 +254,6 @@ class ServerAPI{
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($this->getProperty("send-usage", true) !== false){
|
||||
$this->server->schedule(6000, array($this, "sendUsage"), array(), true); //Send the info after 5 minutes have passed
|
||||
$this->sendUsage();
|
||||
|
@ -89,6 +89,7 @@ class ServerOld{
|
||||
if(isset(self::$instance)){
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -509,14 +509,14 @@ abstract class Block extends Position{
|
||||
/**
|
||||
* Places the Block, using block space and block target, and side. Returns if the block has been placed.
|
||||
*
|
||||
* @param Item $item
|
||||
* @param Block $block
|
||||
* @param Block $target
|
||||
* @param int $face
|
||||
* @param float $fx
|
||||
* @param float $fy
|
||||
* @param float $fz
|
||||
* @param Player $player = null
|
||||
* @param Item $item
|
||||
* @param Block $block
|
||||
* @param Block $target
|
||||
* @param int $face
|
||||
* @param float $fx
|
||||
* @param float $fy
|
||||
* @param float $fz
|
||||
* @param Player $player = null
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@ -525,7 +525,7 @@ abstract class Block extends Position{
|
||||
/**
|
||||
* Do actions when activated by Item. Returns if it has done anything
|
||||
*
|
||||
* @param Item $item
|
||||
* @param Item $item
|
||||
* @param Player $player
|
||||
*
|
||||
* @return bool
|
||||
|
@ -22,7 +22,6 @@
|
||||
namespace PocketMine\Block;
|
||||
|
||||
|
||||
|
||||
class Furnace extends BurningFurnace{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct($meta);
|
||||
|
@ -80,9 +80,9 @@ abstract class Command{
|
||||
private $permissionMessage = null;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @param string $usageMessage
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @param string $usageMessage
|
||||
* @param string[] $aliases
|
||||
*/
|
||||
public function __construct($name, $description = "", $usageMessage = null, array $aliases = array()){
|
||||
@ -174,8 +174,10 @@ abstract class Command{
|
||||
$this->nextLabel = $name;
|
||||
if(!$this->isRegistered()){
|
||||
$this->label = $name;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -189,8 +191,10 @@ abstract class Command{
|
||||
public function register(CommandMap $commandMap){
|
||||
if($this->allowChangesFrom($commandMap)){
|
||||
$this->commandMap = $commandMap;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -204,8 +208,10 @@ abstract class Command{
|
||||
$this->commandMap = null;
|
||||
$this->activeAliases = $this->aliases;
|
||||
$this->label = $this->nextLabel;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -292,12 +298,12 @@ abstract class Command{
|
||||
* @param bool $sendToSource
|
||||
*/
|
||||
public static function broadcastCommandMessage(CommandSender $source, $message, $sendToSource = true){
|
||||
$result = $source->getName() .": " . $message;
|
||||
$result = $source->getName() . ": " . $message;
|
||||
|
||||
//Command minecarts or command blocks are not implemented
|
||||
|
||||
$users = Server::getInstance()->getPluginManager()->getPermissionSubscriptions(Player::BROADCAST_CHANNEL_ADMINISTRATIVE);
|
||||
$colored = TextFormat::GRAY . TextFormat::ITALIC . "[$result".TextFormat::GRAY . TextFormat::ITALIC."]";
|
||||
$colored = TextFormat::GRAY . TextFormat::ITALIC . "[$result" . TextFormat::GRAY . TextFormat::ITALIC . "]";
|
||||
if($sendToSource === true and !($source instanceof ConsoleCommandSender)){
|
||||
$source->sendMessage($message);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace PocketMine\Command;
|
||||
interface CommandMap{
|
||||
|
||||
/**
|
||||
* @param string $fallbackPrefix
|
||||
* @param string $fallbackPrefix
|
||||
* @param Command[] $commands
|
||||
*/
|
||||
public function registerAll($fallbackPrefix, array $commands);
|
||||
|
@ -63,10 +63,11 @@ class CommandReader extends \Thread{
|
||||
*/
|
||||
public function getLine(){
|
||||
if($this->buffer->count() !== 0){
|
||||
return $this->buffer->synchronized(function(){
|
||||
return $this->buffer->synchronized(function (){
|
||||
return $this->buffer->shift();
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -83,7 +84,7 @@ class CommandReader extends \Thread{
|
||||
$lastLine = microtime(true);
|
||||
while(true){
|
||||
if(($line = $this->readLine()) !== ""){
|
||||
$this->buffer->synchronized(function(\Threaded $buffer, $line){
|
||||
$this->buffer->synchronized(function (\Threaded $buffer, $line){
|
||||
$buffer[] = preg_replace("#\\x1b\\x5b([^\\x1b]*\\x7e|[\\x40-\\x50])#", "", $line);
|
||||
}, $this->buffer, $line);
|
||||
$lastLine = microtime(true);
|
||||
|
@ -23,7 +23,6 @@ namespace PocketMine\Command;
|
||||
|
||||
use PocketMine\Permission\PermissibleBase;
|
||||
use PocketMine\Permission\PermissionAttachment;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Plugin\Plugin;
|
||||
use PocketMine\Server;
|
||||
|
||||
@ -55,7 +54,7 @@ class ConsoleCommandSender implements CommandSender{
|
||||
|
||||
/**
|
||||
* @param Plugin $plugin
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @param bool $value
|
||||
*
|
||||
* @return \PocketMine\Permission\PermissionAttachment
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
namespace PocketMine\Command;
|
||||
|
||||
use PocketMine\Command\Defaults\HelpCommand;
|
||||
use PocketMine\Command\Defaults\PluginsCommand;
|
||||
use PocketMine\Command\Defaults\SeedCommand;
|
||||
use PocketMine\Command\Defaults\StopCommand;
|
||||
use PocketMine\Command\Defaults\TellCommand;
|
||||
use PocketMine\Command\Defaults\VanillaCommand;
|
||||
use PocketMine\Command\Defaults\VersionCommand;
|
||||
use PocketMine\Command\Defaults\SeedCommand;
|
||||
use PocketMine\Command\Defaults\HelpCommand;
|
||||
use PocketMine\Server;
|
||||
|
||||
class SimpleCommandMap implements CommandMap{
|
||||
@ -140,6 +140,7 @@ class SimpleCommandMap implements CommandMap{
|
||||
if(isset($this->knownCommands[$name])){
|
||||
return $this->knownCommands[$name];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
namespace PocketMine\Command\Defaults;
|
||||
|
||||
use PocketMine\Command\Command;
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
use PocketMine\Command\ConsoleCommandSender;
|
||||
use PocketMine\Server;
|
||||
use PocketMine\Command\Command;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
|
||||
class HelpCommand extends VanillaCommand{
|
||||
|
||||
@ -77,25 +77,28 @@ class HelpCommand extends VanillaCommand{
|
||||
if($pageNumber < 1){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$message = TextFormat::RED . "-" . TextFormat::RESET . " Showing help page ".$pageNumber." of ".count($commands)." (/help <pageNumber>) " . TextFormat::RED . "-" . TextFormat::RESET . "\n";
|
||||
$message = TextFormat::RED . "-" . TextFormat::RESET . " Showing help page " . $pageNumber . " of " . count($commands) . " (/help <pageNumber>) " . TextFormat::RED . "-" . TextFormat::RESET . "\n";
|
||||
if(isset($commands[$pageNumber - 1])){
|
||||
foreach($commands[$pageNumber - 1] as $command){
|
||||
$message .= TextFormat::DARK_GREEN . "/" . $command->getName().": ". TextFormat::WHITE. $command->getDescription()."\n";
|
||||
$message .= TextFormat::DARK_GREEN . "/" . $command->getName() . ": " . TextFormat::WHITE . $command->getDescription() . "\n";
|
||||
}
|
||||
}
|
||||
$sender->sendMessage($message);
|
||||
|
||||
return true;
|
||||
}else{
|
||||
if(($command = Server::getInstance()->getCommandMap()->getCommand(strtolower($command))) instanceof Command){
|
||||
if($command->testPermissionSilent($sender)){
|
||||
$message = TextFormat::YELLOW . "--------- ". TextFormat::WHITE . " Help: /" .$command->getName() . TextFormat::YELLOW . " ---------\n";
|
||||
$message = TextFormat::YELLOW . "--------- " . TextFormat::WHITE . " Help: /" . $command->getName() . TextFormat::YELLOW . " ---------\n";
|
||||
$message .= TextFormat::DARK_GREEN . "Description: " . TextFormat::WHITE . $command->getDescription() . "\n";
|
||||
$message .= TextFormat::DARK_GREEN . "Usage: " . TextFormat::WHITE . implode("\n".TextFormat::WHITE, explode("\n", $command->getUsage())) . "\n";
|
||||
$message .= TextFormat::DARK_GREEN . "Usage: " . TextFormat::WHITE . implode("\n" . TextFormat::WHITE, explode("\n", $command->getUsage())) . "\n";
|
||||
$sender->sendMessage($message);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$sender->sendMessage(TextFormat::RED . "No help for ".strtolower($command));
|
||||
$sender->sendMessage(TextFormat::RED . "No help for " . strtolower($command));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,8 @@
|
||||
namespace PocketMine\Command\Defaults;
|
||||
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Level\Level;
|
||||
use PocketMine\Player;
|
||||
|
||||
class SeedCommand extends VanillaCommand{
|
||||
|
||||
|
@ -23,8 +23,8 @@ namespace PocketMine\Command\Defaults;
|
||||
|
||||
use PocketMine\Command\Command;
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Server;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Server;
|
||||
|
||||
class StopCommand extends VanillaCommand{
|
||||
|
||||
|
@ -22,9 +22,8 @@
|
||||
namespace PocketMine\Command\Defaults;
|
||||
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Level\Level;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
|
||||
class TellCommand extends VanillaCommand{
|
||||
|
||||
@ -44,7 +43,8 @@ class TellCommand extends VanillaCommand{
|
||||
}
|
||||
|
||||
if(count($args) < 2){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: ".$this->usageMessage);
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -53,8 +53,8 @@ class TellCommand extends VanillaCommand{
|
||||
$player = Player::get($name, true, false);
|
||||
|
||||
if($player instanceof Player){
|
||||
$sender->sendMessage("[me -> ".$player->getName()."] ".implode($args));
|
||||
$player->sendMessage("[".$sender->getName()." -> me] ".implode($args));
|
||||
$sender->sendMessage("[me -> " . $player->getName() . "] " . implode($args));
|
||||
$player->sendMessage("[" . $sender->getName() . " -> me] " . implode($args));
|
||||
}else{
|
||||
$sender->sendMessage("There's no player by that name online.");
|
||||
}
|
||||
|
@ -48,8 +48,10 @@ abstract class VanillaCommand extends Command{
|
||||
protected function getRelativeDouble($original, CommandSender $sender, $input){
|
||||
if($input{0} === "~"){
|
||||
$value = $this->getDouble($sender, substr($input, 1));
|
||||
|
||||
return $original + $value;
|
||||
}
|
||||
|
||||
return $this->getDouble($input);
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ class VersionCommand extends VanillaCommand{
|
||||
|
||||
if($exactPlugin instanceof Plugin){
|
||||
$this->describeToSender($exactPlugin, $sender);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -29,17 +29,16 @@ use PocketMine\Event\Entity\EntityLevelChangeEvent;
|
||||
use PocketMine\Event\Entity\EntityMotionEvent;
|
||||
use PocketMine\Event\Entity\EntityMoveEvent;
|
||||
use PocketMine\Event\Entity\EntitySpawnEvent;
|
||||
use PocketMine\Event\Event;
|
||||
use PocketMine\Level\Level;
|
||||
use PocketMine\Level\Position;
|
||||
use PocketMine\Math\AxisAlignedBB;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\NBT\Tag\Compound;
|
||||
use PocketMine\Network;
|
||||
use PocketMine\Network\Protocol\MoveEntityPacket_PosRot;
|
||||
use PocketMine\Network\Protocol\MovePlayerPacket;
|
||||
use PocketMine\Network\Protocol\RemoveEntityPacket;
|
||||
use PocketMine\Network\Protocol\SetEntityMotionPacket;
|
||||
use PocketMine\Network;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\PMF\LevelFormat;
|
||||
use PocketMine\Server;
|
||||
|
@ -23,19 +23,18 @@ namespace PocketMine\Entity;
|
||||
|
||||
use PocketMine\Event\Entity\EntityArmorChangeEvent;
|
||||
use PocketMine\Event\Entity\EntityInventoryChangeEvent;
|
||||
use PocketMine\Event\Event;
|
||||
use PocketMine\Item\Item;
|
||||
use PocketMine\NBT\NBT;
|
||||
use PocketMine\NBT\Tag\Byte;
|
||||
use PocketMine\NBT\Tag\Compound;
|
||||
use PocketMine\NBT\Tag\Enum;
|
||||
use PocketMine\NBT\Tag\Short;
|
||||
use PocketMine\Network;
|
||||
use PocketMine\Network\Protocol\AddPlayerPacket;
|
||||
use PocketMine\Network\Protocol\ContainerSetContentPacket;
|
||||
use PocketMine\Network\Protocol\PlayerEquipmentPacket;
|
||||
use PocketMine\Network\Protocol\RemovePlayerPacket;
|
||||
use PocketMine\Network\Protocol\SetEntityMotionPacket;
|
||||
use PocketMine\Network;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Server;
|
||||
|
||||
|
@ -67,6 +67,7 @@ abstract class Event{
|
||||
if(static::$handlerList === null){
|
||||
static::$handlerList = new HandlerList();
|
||||
}
|
||||
|
||||
return static::$handlerList;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,8 @@ class HandlerList{
|
||||
return;
|
||||
}
|
||||
if(isset($this->handlerSlots[$listener->getPriority()][spl_object_hash($listener)])){
|
||||
trigger_error("This listener is already registered to priority ".$listener->getPriority(), E_USER_WARNING);
|
||||
trigger_error("This listener is already registered to priority " . $listener->getPriority(), E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
$this->handlers = null;
|
||||
@ -110,7 +111,8 @@ class HandlerList{
|
||||
foreach($this->handlerSlots as $priority => $list){
|
||||
foreach($list as $hash => $listener){
|
||||
if(($object instanceof Plugin and $listener->getPlugin() === $object)
|
||||
or ($object instanceof Listener and $listener->getListener() === $object)){
|
||||
or ($object instanceof Listener and $listener->getListener() === $object)
|
||||
){
|
||||
unset($this->handlerSlots[$priority][$hash]);
|
||||
$changed = true;
|
||||
}
|
||||
@ -153,11 +155,13 @@ class HandlerList{
|
||||
$listeners[$hash] = $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
return $listeners;
|
||||
}else{
|
||||
while(($handlers = $this->handlers) === null){
|
||||
$this->bake();
|
||||
}
|
||||
|
||||
return $handlers;
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
namespace PocketMine\Event\Player;
|
||||
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Item\Item;
|
||||
use PocketMine\Player;
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
namespace PocketMine\Event\Server;
|
||||
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Network\Protocol\DataPacket;
|
||||
use PocketMine\Player;
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
namespace PocketMine\Event\Server;
|
||||
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Network\Protocol\DataPacket;
|
||||
use PocketMine\Player;
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
namespace PocketMine\Event\Tile;
|
||||
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Item\Item;
|
||||
use PocketMine\Tile\Tile;
|
||||
|
||||
|
@ -25,7 +25,6 @@ use PocketMine\Block\Block;
|
||||
use PocketMine\Block\TNT;
|
||||
use PocketMine\Entity\Entity;
|
||||
use PocketMine\Event\Entity\EntityExplodeEvent;
|
||||
use PocketMine\Event\Event;
|
||||
use PocketMine\Item\Item;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Network\Protocol\ExplodePacket;
|
||||
|
@ -26,9 +26,9 @@ namespace PocketMine\Level;
|
||||
|
||||
use PocketMine\Block\Air;
|
||||
use PocketMine\Block\Block;
|
||||
use PocketMine\Entity\Entity;
|
||||
use PocketMine\Event\Block\BlockBreakEvent;
|
||||
use PocketMine\Event\Block\BlockPlaceEvent;
|
||||
use PocketMine\Event\Event;
|
||||
use PocketMine\Event\Player\PlayerInteractEvent;
|
||||
use PocketMine\Item\Item;
|
||||
use PocketMine\Level\Generator\Flat;
|
||||
@ -51,7 +51,6 @@ use PocketMine\Tile\Chest;
|
||||
use PocketMine\Tile\Furnace;
|
||||
use PocketMine\Tile\Sign;
|
||||
use PocketMine\Tile\Tile;
|
||||
use PocketMine\Entity\Entity;
|
||||
use PocketMine\Utils\Cache;
|
||||
use PocketMine\Utils\Config;
|
||||
use PocketMine\Utils\Random;
|
||||
@ -124,6 +123,7 @@ class Level{
|
||||
$default = Server::getInstance()->getConfigString("level-name", null);
|
||||
if($default == ""){
|
||||
trigger_error("level-name cannot be null", E_USER_ERROR);
|
||||
|
||||
return;
|
||||
}
|
||||
if(self::loadLevel($default) === false){
|
||||
|
@ -25,7 +25,6 @@
|
||||
namespace PocketMine\Level\Generator\Noise;
|
||||
|
||||
|
||||
|
||||
abstract class Generator{
|
||||
protected $perm = array();
|
||||
protected $offsetX = 0;
|
||||
|
@ -122,7 +122,7 @@ class ThreadedHandler extends \Thread{
|
||||
@socket_set_option($this->socket, SOL_SOCKET, SO_SNDBUF, 1024 * 1024 * 2); //2MB
|
||||
@socket_set_option($this->socket, SOL_SOCKET, SO_RCVBUF, 1024 * 1024); //1MB
|
||||
}else{
|
||||
console("[SEVERE] **** FAILED TO BIND TO ".$this->serverip.":" . $this->port."!", true, true, 0);
|
||||
console("[SEVERE] **** FAILED TO BIND TO " . $this->serverip . ":" . $this->port . "!", true, true, 0);
|
||||
console("[SEVERE] Perhaps a server is already running on that port?", true, true, 0);
|
||||
exit(1);
|
||||
}
|
||||
@ -142,7 +142,7 @@ class ThreadedHandler extends \Thread{
|
||||
}
|
||||
|
||||
private function putPacket(){
|
||||
if(($packet = $this->queue->synchronized(function(){
|
||||
if(($packet = $this->queue->synchronized(function (){
|
||||
return $this->queue->shift();
|
||||
})) instanceof Packet
|
||||
){
|
||||
|
@ -25,7 +25,6 @@
|
||||
namespace PocketMine\Network\Protocol;
|
||||
|
||||
|
||||
|
||||
abstract class Info{
|
||||
|
||||
/**
|
||||
|
@ -35,9 +35,11 @@ abstract class DefaultPermissions{
|
||||
public static function registerPermission(Permission $perm, Permission $parent = null){
|
||||
if($parent instanceof Permission){
|
||||
$parent->getChildren()[$perm->getName()] = true;
|
||||
|
||||
return self::registerPermission($perm);
|
||||
}
|
||||
Server::getInstance()->getPluginManager()->addPermission($perm);
|
||||
|
||||
return Server::getInstance()->getPluginManager()->getPermission($perm->getName());
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
namespace PocketMine\Permission;
|
||||
|
||||
use PocketMine\Server;
|
||||
use PocketMine\Plugin\Plugin;
|
||||
use PocketMine\Server;
|
||||
|
||||
class PermissibleBase implements Permissible{
|
||||
/**
|
||||
@ -74,6 +74,7 @@ class PermissibleBase implements Permissible{
|
||||
public function setOp($value){
|
||||
if($this->opable === null){
|
||||
trigger_error("Cannot change ip value as no ServerOperator is set", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}else{
|
||||
$this->opable->setOp($value);
|
||||
@ -105,6 +106,7 @@ class PermissibleBase implements Permissible{
|
||||
|
||||
if(($perm = Server::getInstance()->getPluginManager()->getPermission($name)) !== null){
|
||||
$perm = $perm->getDefault();
|
||||
|
||||
return $perm === Permission::DEFAULT_TRUE or ($this->isOp() and $perm === Permission::DEFAULT_OP) or (!$this->isOp() and $perm === Permission::DEFAULT_NOT_OP);
|
||||
}else{
|
||||
return Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_TRUE or ($this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_OP) or (!$this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_NOT_OP);
|
||||
@ -116,7 +118,7 @@ class PermissibleBase implements Permissible{
|
||||
* //TODO: tick scheduled attachments
|
||||
*
|
||||
* @param Plugin $plugin
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @param bool $value
|
||||
*
|
||||
* @return PermissionAttachment
|
||||
@ -124,9 +126,11 @@ class PermissibleBase implements Permissible{
|
||||
public function addAttachment(Plugin $plugin, $name = null, $value = null){
|
||||
if($plugin === null){
|
||||
trigger_error("Plugin cannot be null", E_USER_WARNING);
|
||||
|
||||
return null;
|
||||
}elseif(!$plugin->isEnabled()){
|
||||
trigger_error("Plugin ".$plugin->getDescription()->getName()." is disabled", E_USER_WARNING);
|
||||
trigger_error("Plugin " . $plugin->getDescription()->getName() . " is disabled", E_USER_WARNING);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -149,6 +153,7 @@ class PermissibleBase implements Permissible{
|
||||
public function removeAttachment(PermissionAttachment $attachment){
|
||||
if($attachment === null){
|
||||
trigger_error("Attachment cannot be null", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -86,9 +86,9 @@ class Permission{
|
||||
/**
|
||||
* Creates a new Permission object to be attached to Permissible objects
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @param string $defaultValue
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @param string $defaultValue
|
||||
* @param Permission[] $children
|
||||
*/
|
||||
public function __construct($name, $description = null, $defaultValue = null, array $children = array()){
|
||||
@ -165,7 +165,7 @@ class Permission{
|
||||
|
||||
/**
|
||||
* @param string|Permission $name
|
||||
* @param $value
|
||||
* @param $value
|
||||
*
|
||||
* @return Permission|void
|
||||
*/
|
||||
@ -181,6 +181,7 @@ class Permission{
|
||||
}
|
||||
|
||||
$this->addParent($perm, $value);
|
||||
|
||||
return $perm;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ class PermissionAttachment{
|
||||
*/
|
||||
public function __construct(Plugin $plugin, Permissible $permissible){
|
||||
if(!$plugin->isEnabled()){
|
||||
trigger_error("Plugin ".$plugin->getDescription()->getName()." is disabled", E_USER_WARNING);
|
||||
trigger_error("Plugin " . $plugin->getDescription()->getName() . " is disabled", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -95,7 +96,7 @@ class PermissionAttachment{
|
||||
|
||||
/**
|
||||
* @param string|Permission $name
|
||||
* @param bool $value
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setPermission($name, $value){
|
||||
$this->permissions[$name instanceof Permission ? $name->getName() : $name] = $value;
|
||||
|
@ -52,6 +52,7 @@ class PermissionAttachmentInfo{
|
||||
public function __construct(Permissible $permissible, $permission, $attachment, $value){
|
||||
if($permission === null){
|
||||
trigger_error("Permission may not be null", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -55,12 +55,12 @@ class FolderPluginLoader implements PluginLoader{
|
||||
console("[INFO] Loading " . $description->getName());
|
||||
$dataFolder = basename($file) . "/" . $description->getName();
|
||||
if(file_exists($dataFolder) and !is_dir($dataFolder)){
|
||||
trigger_error("Projected dataFolder '".$dataFolder."' for ".$description->getName()." exists and is not a directory", E_USER_WARNING);
|
||||
trigger_error("Projected dataFolder '" . $dataFolder . "' for " . $description->getName() . " exists and is not a directory", E_USER_WARNING);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$className = $description->getMain();
|
||||
$this->server->getLoader()->add(substr($className, 0, strpos($className, "\\")), array(
|
||||
$file . "/src"
|
||||
@ -69,13 +69,16 @@ class FolderPluginLoader implements PluginLoader{
|
||||
if(class_exists($className, true)){
|
||||
$plugin = new $className();
|
||||
$this->initPlugin($plugin, $description, $dataFolder, $file);
|
||||
|
||||
return $plugin;
|
||||
}else{
|
||||
trigger_error("Couldn't load plugin ".$description->getName().": main class not found", E_USER_WARNING);
|
||||
trigger_error("Couldn't load plugin " . $description->getName() . ": main class not found", E_USER_WARNING);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -93,6 +96,7 @@ class FolderPluginLoader implements PluginLoader{
|
||||
return new PluginDescription($yaml);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -121,7 +125,7 @@ class FolderPluginLoader implements PluginLoader{
|
||||
*/
|
||||
public function enablePlugin(Plugin $plugin){
|
||||
if($plugin instanceof PluginBase and !$plugin->isEnabled()){
|
||||
console("[INFO] Enabling ".$plugin->getDescription()->getName());
|
||||
console("[INFO] Enabling " . $plugin->getDescription()->getName());
|
||||
|
||||
$plugin->setEnabled(true);
|
||||
|
||||
@ -134,7 +138,7 @@ class FolderPluginLoader implements PluginLoader{
|
||||
*/
|
||||
public function disablePlugin(Plugin $plugin){
|
||||
if($plugin instanceof PluginBase and $plugin->isEnabled()){
|
||||
console("[INFO] Disabling ".$plugin->getDescription()->getName());
|
||||
console("[INFO] Disabling " . $plugin->getDescription()->getName());
|
||||
|
||||
Server::getInstance()->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
namespace PocketMine\Plugin;
|
||||
use PocketMine\Event\Listener;
|
||||
|
||||
/**
|
||||
* Handles different types of plugins
|
||||
|
@ -22,14 +22,13 @@
|
||||
namespace PocketMine\Plugin;
|
||||
|
||||
use PocketMine\Command\PluginCommand;
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Command\SimpleCommandMap;
|
||||
use PocketMine\Event\Event;
|
||||
use PocketMine\Event\HandlerList;
|
||||
use PocketMine\Event\Listener;
|
||||
use PocketMine\Permission\Permissible;
|
||||
use PocketMine\Permission\Permission;
|
||||
use PocketMine\Server;
|
||||
use PocketMine\Command\SimpleCommandMap;
|
||||
use PocketMine\Event\HandlerList;
|
||||
|
||||
/**
|
||||
* Manages all the plugins, Permissions and Permissibles
|
||||
@ -106,7 +105,7 @@ class PluginManager{
|
||||
$this->server = $server;
|
||||
$this->commandMap = $commandMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
@ -156,6 +155,7 @@ class PluginManager{
|
||||
if($description instanceof PluginDescription){
|
||||
if(($plugin = $loader->loadPlugin($path)) instanceof Plugin){
|
||||
$this->plugins[$plugin->getDescription()->getName()] = $plugin;
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
}
|
||||
@ -519,7 +519,7 @@ class PluginManager{
|
||||
|
||||
foreach($plugin->getDescription()->getCommands() as $key => $data){
|
||||
if(strpos($key, ":") !== false){
|
||||
console("[SEVERE] Could not load command ".$key." for plugin ".$plugin->getDescription()->getName());
|
||||
console("[SEVERE] Could not load command " . $key . " for plugin " . $plugin->getDescription()->getName());
|
||||
continue;
|
||||
}
|
||||
if(is_array($data)){
|
||||
@ -536,7 +536,7 @@ class PluginManager{
|
||||
$aliasList = array();
|
||||
foreach($data["aliases"] as $alias){
|
||||
if(strpos($alias, ":") !== false){
|
||||
console("[SEVERE] Could not load alias ".$alias." for plugin ".$plugin->getDescription()->getName());
|
||||
console("[SEVERE] Could not load alias " . $alias . " for plugin " . $plugin->getDescription()->getName());
|
||||
continue;
|
||||
}
|
||||
$aliasList[] = $alias;
|
||||
@ -555,6 +555,7 @@ class PluginManager{
|
||||
|
||||
$pluginCmds[] = $newCmd;
|
||||
}
|
||||
|
||||
return $pluginCmds;
|
||||
}
|
||||
}
|
||||
@ -616,11 +617,13 @@ class PluginManager{
|
||||
*/
|
||||
public function registerEvent($event, Listener $listener, $priority, EventExecutor $executor, Plugin $plugin, $ignoreCancelled = false){
|
||||
if(!is_subclass_of($event, "PocketMine\\Event\\Event")){
|
||||
trigger_error($event ." is not a valid Event", E_USER_WARNING);
|
||||
trigger_error($event . " is not a valid Event", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
if(!$plugin->isEnabled()){
|
||||
trigger_error("Plugin attempted to register ".$event." while not enabled");
|
||||
trigger_error("Plugin attempted to register " . $event . " while not enabled");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -636,6 +639,7 @@ class PluginManager{
|
||||
if($event::$handlerList === null){
|
||||
$event::$handlerList = new HandlerList();
|
||||
}
|
||||
|
||||
return $event::$handlerList;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
namespace PocketMine\Recipes;
|
||||
|
||||
use PocketMine\Item\Item;
|
||||
use PocketMine\Server;
|
||||
|
||||
abstract class Crafting{
|
||||
|
||||
|
@ -133,6 +133,7 @@ class ServerScheduler{
|
||||
private function addTask(Task $task, $delay, $period){
|
||||
if($task instanceof PluginTask and !$task->getOwner()->isEnabled()){
|
||||
trigger_error("Plugin attempted to register a task while disabled", E_USER_WARNING);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ abstract class Task{
|
||||
if($this->taskHandler !== null){
|
||||
return $this->taskHandler->getTaskId();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,10 @@ class TickScheduler extends \Thread{
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTick(){
|
||||
return $this->synchronized(function(){
|
||||
return $this->synchronized(function (){
|
||||
$hasTick = $this->hasTick;
|
||||
$this->hasTick = false;
|
||||
|
||||
return $hasTick === true;
|
||||
});
|
||||
}
|
||||
@ -55,7 +56,7 @@ class TickScheduler extends \Thread{
|
||||
* @return float
|
||||
*/
|
||||
public function getTPS(){
|
||||
return $this->synchronized(function(){
|
||||
return $this->synchronized(function (){
|
||||
return round(($this->sleepTime / $this->tickMeasure) * $this->ticksPerSecond, 2);
|
||||
});
|
||||
}
|
||||
@ -64,7 +65,7 @@ class TickScheduler extends \Thread{
|
||||
$tickTime = microtime(true);
|
||||
$this->hasTick = true;
|
||||
while(true){
|
||||
$this->synchronized(function(){
|
||||
$this->synchronized(function (){
|
||||
$this->hasTick = true;
|
||||
$this->wait();
|
||||
$this->hasTick = false;
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
namespace PocketMine\Tile;
|
||||
|
||||
use PocketMine\Event\Event;
|
||||
use PocketMine\Event\Tile\TileInventoryChangeEvent;
|
||||
use PocketMine\Item\Item;
|
||||
use PocketMine\NBT\Tag\Byte;
|
||||
|
@ -707,6 +707,7 @@ class Utils{
|
||||
if($unpacked > 2147483647){
|
||||
$unpacked -= 4294967296;
|
||||
}
|
||||
|
||||
return (int) $unpacked;
|
||||
}
|
||||
|
||||
@ -719,6 +720,7 @@ class Utils{
|
||||
if($unpacked >= 2147483648){
|
||||
$unpacked -= 4294967296;
|
||||
}
|
||||
|
||||
return (int) $unpacked;
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,7 @@
|
||||
*
|
||||
* @author Guilherme Blanco <guilhermeblanco@php.net>
|
||||
*/
|
||||
interface SplAutoloader
|
||||
{
|
||||
interface SplAutoloader{
|
||||
/**
|
||||
* Defines autoloader to work silently if resource is not found.
|
||||
*
|
||||
@ -39,7 +38,7 @@ interface SplAutoloader
|
||||
* Add a new resource lookup path.
|
||||
*
|
||||
* @param string $resourceName Resource name, namespace or prefix.
|
||||
* @param mixed $resourcePath Resource single path or multiple paths (array).
|
||||
* @param mixed $resourcePath Resource single path or multiple paths (array).
|
||||
*/
|
||||
public function add($resourceName, $resourcePath = null);
|
||||
|
||||
|
@ -42,8 +42,7 @@ require_once("SplAutoLoader.php");
|
||||
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
|
||||
*/
|
||||
class SplClassLoader implements SplAutoloader
|
||||
{
|
||||
class SplClassLoader implements SplAutoloader{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -67,9 +66,8 @@ class SplClassLoader implements SplAutoloader
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMode($mode)
|
||||
{
|
||||
if ($mode & self::MODE_SILENT && $mode & self::MODE_NORMAL) {
|
||||
public function setMode($mode){
|
||||
if($mode & self::MODE_SILENT && $mode & self::MODE_NORMAL){
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf('Cannot have %s working normally and silently at the same time!', __CLASS__)
|
||||
);
|
||||
@ -83,8 +81,7 @@ class SplClassLoader implements SplAutoloader
|
||||
*
|
||||
* @param string $fileExtension
|
||||
*/
|
||||
public function setFileExtension($fileExtension)
|
||||
{
|
||||
public function setFileExtension($fileExtension){
|
||||
$this->fileExtension = $fileExtension;
|
||||
}
|
||||
|
||||
@ -93,8 +90,7 @@ class SplClassLoader implements SplAutoloader
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFileExtension()
|
||||
{
|
||||
public function getFileExtension(){
|
||||
return $this->fileExtension;
|
||||
}
|
||||
|
||||
@ -103,8 +99,7 @@ class SplClassLoader implements SplAutoloader
|
||||
*
|
||||
* @param boolean $includePathLookup
|
||||
*/
|
||||
public function setIncludePathLookup($includePathLookup)
|
||||
{
|
||||
public function setIncludePathLookup($includePathLookup){
|
||||
$this->includePathLookup = $includePathLookup;
|
||||
}
|
||||
|
||||
@ -113,45 +108,40 @@ class SplClassLoader implements SplAutoloader
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludePathLookup()
|
||||
{
|
||||
public function getIncludePathLookup(){
|
||||
return $this->includePathLookup;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
public function register($prepend = false){
|
||||
spl_autoload_register(array($this, 'load'), true, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
public function unregister(){
|
||||
spl_autoload_unregister(array($this, 'load'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add($resource, $resourcePath = null)
|
||||
{
|
||||
public function add($resource, $resourcePath = null){
|
||||
$this->resources[$resource] = (array) $resourcePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($resourceName)
|
||||
{
|
||||
public function load($resourceName){
|
||||
$resourceAbsolutePath = $this->getResourceAbsolutePath($resourceName);
|
||||
|
||||
switch (true) {
|
||||
switch(true){
|
||||
case ($this->mode & self::MODE_SILENT):
|
||||
if ($resourceAbsolutePath !== false) {
|
||||
if($resourceAbsolutePath !== false){
|
||||
require $resourceAbsolutePath;
|
||||
}
|
||||
break;
|
||||
@ -162,7 +152,7 @@ class SplClassLoader implements SplAutoloader
|
||||
break;
|
||||
}
|
||||
|
||||
if ($this->mode & self::MODE_DEBUG && ! $this->isResourceDeclared($resourceName)) {
|
||||
if($this->mode & self::MODE_DEBUG && !$this->isResourceDeclared($resourceName)){
|
||||
throw new \RuntimeException(
|
||||
sprintf('Autoloader expected resource "%s" to be declared in file "%s".', $resourceName, $resourceAbsolutePath)
|
||||
);
|
||||
@ -176,25 +166,24 @@ class SplClassLoader implements SplAutoloader
|
||||
*
|
||||
* @return string Resource absolute path.
|
||||
*/
|
||||
private function getResourceAbsolutePath($resourceName)
|
||||
{
|
||||
private function getResourceAbsolutePath($resourceName){
|
||||
$resourceRelativePath = $this->getResourceRelativePath($resourceName);
|
||||
|
||||
foreach ($this->resources as $resource => $resourcesPath) {
|
||||
if (strpos($resourceName, $resource) !== 0) {
|
||||
foreach($this->resources as $resource => $resourcesPath){
|
||||
if(strpos($resourceName, $resource) !== 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($resourcesPath as $resourcePath) {
|
||||
foreach($resourcesPath as $resourcePath){
|
||||
$resourceAbsolutePath = $resourcePath . DIRECTORY_SEPARATOR . $resourceRelativePath;
|
||||
|
||||
if (is_file($resourceAbsolutePath)) {
|
||||
if(is_file($resourceAbsolutePath)){
|
||||
return $resourceAbsolutePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->includePathLookup && ($resourceAbsolutePath = stream_resolve_include_path($resourceRelativePath)) !== false) {
|
||||
if($this->includePathLookup && ($resourceAbsolutePath = stream_resolve_include_path($resourceRelativePath)) !== false){
|
||||
return $resourceAbsolutePath;
|
||||
}
|
||||
|
||||
@ -208,17 +197,16 @@ class SplClassLoader implements SplAutoloader
|
||||
*
|
||||
* @return string Resource relative path.
|
||||
*/
|
||||
private function getResourceRelativePath($resourceName)
|
||||
{
|
||||
private function getResourceRelativePath($resourceName){
|
||||
// We always work with FQCN in this context
|
||||
$resourceName = ltrim($resourceName, '\\');
|
||||
$resourcePath = '';
|
||||
|
||||
if (($lastNamespacePosition = strrpos($resourceName, '\\')) !== false) {
|
||||
if(($lastNamespacePosition = strrpos($resourceName, '\\')) !== false){
|
||||
// Namespaced resource name
|
||||
$resourceNamespace = substr($resourceName, 0, $lastNamespacePosition);
|
||||
$resourceName = substr($resourceName, $lastNamespacePosition + 1);
|
||||
$resourcePath = str_replace('\\', DIRECTORY_SEPARATOR, $resourceNamespace) . DIRECTORY_SEPARATOR;
|
||||
$resourceName = substr($resourceName, $lastNamespacePosition + 1);
|
||||
$resourcePath = str_replace('\\', DIRECTORY_SEPARATOR, $resourceNamespace) . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
return $resourcePath . str_replace('_', DIRECTORY_SEPARATOR, $resourceName) . $this->fileExtension;
|
||||
@ -231,8 +219,7 @@ class SplClassLoader implements SplAutoloader
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function isResourceDeclared($resourceName)
|
||||
{
|
||||
private function isResourceDeclared($resourceName){
|
||||
return class_exists($resourceName, false)
|
||||
|| interface_exists($resourceName, false)
|
||||
|| (function_exists('trait_exists') && trait_exists($resourceName, false));
|
||||
|
@ -4,9 +4,9 @@
|
||||
*
|
||||
* WARNING: Do not include this file
|
||||
*
|
||||
* @author Lisachenko Alexander <lisachenko.it@gmail.com>
|
||||
* @author Lisachenko Alexander <lisachenko.it@gmail.com>
|
||||
* @version 2.0.0
|
||||
* @link https://github.com/krakjoe/pthreads/blob/master/examples/stub.php
|
||||
* @link https://github.com/krakjoe/pthreads/blob/master/examples/stub.php
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -68,11 +68,10 @@ define('PTHREADS_ALLOW_GLOBALS', 0x10000000);
|
||||
* Threaded objects, most importantly, provide implicit safety for the programmer;
|
||||
* all operations on the object scope are safe.
|
||||
*
|
||||
* @link http://www.php.net/manual/en/class.threaded.php
|
||||
* @link http://www.php.net/manual/en/class.threaded.php
|
||||
* @since 2.0.0
|
||||
*/
|
||||
class Threaded implements Traversable, Countable, ArrayAccess
|
||||
{
|
||||
class Threaded implements Traversable, Countable, ArrayAccess{
|
||||
/**
|
||||
* Fetches a chunk of the objects properties table of the given size
|
||||
*
|
||||
@ -81,12 +80,14 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.chunk.php
|
||||
* @return array An array of items from the objects member table
|
||||
*/
|
||||
public function chunk($size) {}
|
||||
public function chunk($size){
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function count() {}
|
||||
public function count(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves terminal error information from the referenced object
|
||||
@ -94,7 +95,8 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.getterminationinfo.php
|
||||
* @return array|bool array containing the termination conditions of the referenced object
|
||||
*/
|
||||
public function getTerminationInfo() {}
|
||||
public function getTerminationInfo(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if the referenced object is executing
|
||||
@ -102,7 +104,8 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.isrunning.php
|
||||
* @return bool A boolean indication of state
|
||||
*/
|
||||
public function isRunning() {}
|
||||
public function isRunning(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if the referenced object exited, suffered fatal errors, or threw uncaught exceptions during execution
|
||||
@ -110,7 +113,8 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.isterminated.php
|
||||
* @return bool A boolean indication of state
|
||||
*/
|
||||
public function isTerminated() {}
|
||||
public function isTerminated(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if the referenced object is waiting for notification
|
||||
@ -118,7 +122,8 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.iswaiting.php
|
||||
* @return bool A boolean indication of state
|
||||
*/
|
||||
public function isWaiting() {}
|
||||
public function isWaiting(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock the referenced objects property table
|
||||
@ -126,18 +131,20 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.lock.php
|
||||
* @return bool A boolean indication of state
|
||||
*/
|
||||
public function lock() {}
|
||||
public function lock(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges data into the current object
|
||||
*
|
||||
* @param mixed $from The data to merge
|
||||
* @param bool $overwrite Overwrite existing keys flag, by default true
|
||||
* @param mixed $from The data to merge
|
||||
* @param bool $overwrite Overwrite existing keys flag, by default true
|
||||
*
|
||||
* @link http://www.php.net/manual/en/threaded.merge.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
public function merge($from, $overwrite = true) {}
|
||||
public function merge($from, $overwrite = true){
|
||||
}
|
||||
|
||||
/**
|
||||
* Send notification to the referenced object
|
||||
@ -145,27 +152,32 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.notify.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
public function notify() {}
|
||||
public function notify(){
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetGet($offset) {}
|
||||
public function offsetGet($offset){
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetSet($offset, $value) {}
|
||||
public function offsetSet($offset, $value){
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetExists($offset) {}
|
||||
public function offsetExists($offset){
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetUnset($offset) {}
|
||||
public function offsetUnset($offset){
|
||||
}
|
||||
|
||||
/**
|
||||
* Pops an item from the objects property table
|
||||
@ -173,7 +185,8 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.pop.php
|
||||
* @return mixed The last item from the objects properties table
|
||||
*/
|
||||
public function pop() {}
|
||||
public function pop(){
|
||||
}
|
||||
|
||||
/**
|
||||
* The programmer should always implement the run method for objects that are intended for execution.
|
||||
@ -181,7 +194,8 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.run.php
|
||||
* @return void The methods return value, if used, will be ignored
|
||||
*/
|
||||
public function run() {}
|
||||
public function run(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts an item from the objects properties table
|
||||
@ -189,18 +203,20 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.shift.php
|
||||
* @return mixed The first item from the objects properties table
|
||||
*/
|
||||
public function shift() {}
|
||||
public function shift(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the block while retaining the synchronization lock for the current context.
|
||||
*
|
||||
* @param \Closure $function The block of code to execute
|
||||
* @param mixed $args... Variable length list of arguments to use as function arguments to the block
|
||||
* @param mixed $args ... Variable length list of arguments to use as function arguments to the block
|
||||
*
|
||||
* @link http://www.php.net/manual/en/threaded.synchronized.php
|
||||
* @return mixed The return value from the block
|
||||
*/
|
||||
public function synchronized(\Closure $function, $args = null) {}
|
||||
public function synchronized(\Closure $function, $args = null){
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock the referenced objects storage for the calling context
|
||||
@ -208,7 +224,8 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.unlock.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
public function unlock() {}
|
||||
public function unlock(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for notification from the Stackable
|
||||
@ -218,7 +235,8 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
* @link http://www.php.net/manual/en/threaded.wait.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
public function wait($timeout) {}
|
||||
public function wait($timeout){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,15 +247,15 @@ class Threaded implements Traversable, Countable, ArrayAccess
|
||||
*
|
||||
* @link http://www.php.net/manual/en/class.thread.php
|
||||
*/
|
||||
class Thread extends Threaded
|
||||
{
|
||||
class Thread extends Threaded{
|
||||
|
||||
/**
|
||||
* Detaches a thread
|
||||
*
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
public function detach() {}
|
||||
public function detach(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return the identity of the Thread that created the referenced Thread
|
||||
@ -245,14 +263,16 @@ class Thread extends Threaded
|
||||
* @link http://www.php.net/manual/en/thread.getcreatorid.php
|
||||
* @return int A numeric identity
|
||||
*/
|
||||
public function getCreatorId() {}
|
||||
public function getCreatorId(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return the instance of currently executing thread
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function getCurrentThread() {}
|
||||
public static function getCurrentThread(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return the identity of the currently executing thread
|
||||
@ -260,7 +280,8 @@ class Thread extends Threaded
|
||||
* @link http://www.php.net/manual/en/thread.getcurrentthreadid.php
|
||||
* @return int
|
||||
*/
|
||||
public static function getCurrentThreadId() {}
|
||||
public static function getCurrentThreadId(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return the identity of the referenced Thread
|
||||
@ -268,7 +289,8 @@ class Thread extends Threaded
|
||||
* @link http://www.php.net/manual/en/thread.getthreadid.php
|
||||
* @return int
|
||||
*/
|
||||
public function getThreadId() {}
|
||||
public function getThreadId(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if the referenced Thread has been joined by another context
|
||||
@ -276,7 +298,8 @@ class Thread extends Threaded
|
||||
* @link http://www.php.net/manual/en/thread.isjoined.php
|
||||
* @return bool A boolean indication of state
|
||||
*/
|
||||
public function isJoined() {}
|
||||
public function isJoined(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if the referenced Thread has been started
|
||||
@ -284,7 +307,8 @@ class Thread extends Threaded
|
||||
* @link http://www.php.net/manual/en/thread.isstarted.php
|
||||
* @return bool A boolean indication of state
|
||||
*/
|
||||
public function isStarted() {}
|
||||
public function isStarted(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Causes the calling context to wait for the referenced Thread to finish executing
|
||||
@ -292,14 +316,16 @@ class Thread extends Threaded
|
||||
* @link http://www.php.net/manual/en/thread.join.php
|
||||
* @return bool A boolean indication of state
|
||||
*/
|
||||
public function join() {}
|
||||
public function join(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Kills the referenced thread, dangerously !
|
||||
*
|
||||
* @link http://www.php.net/manual/en/thread.kill.php
|
||||
*/
|
||||
public function kill() {}
|
||||
public function kill(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Will start a new Thread to execute the implemented run method
|
||||
@ -309,17 +335,20 @@ class Thread extends Threaded
|
||||
* @link http://www.php.net/manual/en/thread.start.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
public function start($options = PTHREADS_INHERIT_ALL) {}
|
||||
public function start($options = PTHREADS_INHERIT_ALL){
|
||||
}
|
||||
|
||||
/**
|
||||
* Will execute the Callable in the global scope
|
||||
*
|
||||
* @param Callable $block The code to execute
|
||||
* @param Callable $block The code to execute
|
||||
* @param ... $args Variable length list of arguments to pass to the Callable upon execution
|
||||
* @link http://www.php.net/manual/en/thread.start.php
|
||||
*
|
||||
* @link http://www.php.net/manual/en/thread.start.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
public static function globally(Callable $block, $args = null){}
|
||||
public static function globally(Callable $block, $args = null){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -337,8 +366,7 @@ class Thread extends Threaded
|
||||
*
|
||||
* @link http://www.php.net/manual/en/class.worker.php
|
||||
*/
|
||||
class Worker extends Thread
|
||||
{
|
||||
class Worker extends Thread{
|
||||
|
||||
/**
|
||||
* Returns the number of threaded tasks waiting to be executed by the referenced Worker
|
||||
@ -346,7 +374,8 @@ class Worker extends Thread
|
||||
* @link http://www.php.net/manual/en/worker.getstacked.php
|
||||
* @return int An integral value
|
||||
*/
|
||||
public function getStacked() {}
|
||||
public function getStacked(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if the referenced Worker has been shutdown
|
||||
@ -354,7 +383,8 @@ class Worker extends Thread
|
||||
* @link http://www.php.net/manual/en/worker.isshutdown.php
|
||||
* @return bool A boolean indication of state
|
||||
*/
|
||||
public function isShutdown() {}
|
||||
public function isShutdown(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if a Worker is executing threaded tasks
|
||||
@ -362,7 +392,8 @@ class Worker extends Thread
|
||||
* @link http://www.php.net/manual/en/worker.isworking.php
|
||||
* @return bool A boolean indication of state
|
||||
*/
|
||||
public function isWorking() {}
|
||||
public function isWorking(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts down the Worker after executing all the threaded tasks previously stacked
|
||||
@ -370,7 +401,8 @@ class Worker extends Thread
|
||||
* @link http://www.php.net/manual/en/worker.shutdown.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
public function shutdown() {}
|
||||
public function shutdown(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the referenced object to the stack of the referenced Worker
|
||||
@ -380,7 +412,8 @@ class Worker extends Thread
|
||||
* @link http://www.php.net/manual/en/worker.stack.php
|
||||
* @return int The new length of the stack
|
||||
*/
|
||||
public function stack(Threaded &$work) {}
|
||||
public function stack(Threaded &$work){
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the referenced object ( or all objects if parameter is null ) from stack of the referenced Worker
|
||||
@ -390,7 +423,8 @@ class Worker extends Thread
|
||||
* @link http://www.php.net/manual/en/worker.unstack.php
|
||||
* @return int The new length of the stack
|
||||
*/
|
||||
public function unstack(Threaded &$work = null) {}
|
||||
public function unstack(Threaded &$work = null){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -400,8 +434,7 @@ class Worker extends Thread
|
||||
*
|
||||
* @link http://www.php.net/manual/en/class.mutex.php
|
||||
*/
|
||||
class Mutex
|
||||
{
|
||||
class Mutex{
|
||||
|
||||
/**
|
||||
* Create, and optionally lock a new Mutex for the caller
|
||||
@ -411,7 +444,8 @@ class Mutex
|
||||
* @link http://www.php.net/manual/en/mutex.create.php
|
||||
* @return int A newly created and optionally locked Mutex handle
|
||||
*/
|
||||
final public static function create($lock = false) {}
|
||||
final public static function create($lock = false){
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy mutex
|
||||
@ -424,7 +458,8 @@ class Mutex
|
||||
* @link http://www.php.net/manual/en/mutex.destroy.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
final public static function destroy($mutex) {}
|
||||
final public static function destroy($mutex){
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to lock the Mutex for the caller.
|
||||
@ -436,7 +471,8 @@ class Mutex
|
||||
* @link http://www.php.net/manual/en/mutex.lock.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
final public static function lock($mutex) {}
|
||||
final public static function lock($mutex){
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to lock the Mutex for the caller without blocking if the Mutex is owned (locked) by another Thread.
|
||||
@ -446,7 +482,8 @@ class Mutex
|
||||
* @link http://www.php.net/manual/en/mutex.trylock.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
final public static function trylock($mutex) {}
|
||||
final public static function trylock($mutex){
|
||||
}
|
||||
|
||||
/**
|
||||
* Release mutex
|
||||
@ -454,13 +491,14 @@ class Mutex
|
||||
* Attempts to unlock the Mutex for the caller, optionally destroying the Mutex handle.
|
||||
* The calling thread should own the Mutex at the time of the call.
|
||||
*
|
||||
* @param int $mutex A handle returned by a previous call to Mutex::create().
|
||||
* @param int $mutex A handle returned by a previous call to Mutex::create().
|
||||
* @param bool $destroy When true pthreads will destroy the Mutex after a successful unlock.
|
||||
*
|
||||
* @link http://www.php.net/manual/en/mutex.unlock.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
final public static function unlock($mutex, $destroy = false) {}
|
||||
final public static function unlock($mutex, $destroy = false){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -470,8 +508,7 @@ class Mutex
|
||||
*
|
||||
* @link http://www.php.net/manual/en/class.cond.php
|
||||
*/
|
||||
class Cond
|
||||
{
|
||||
class Cond{
|
||||
/**
|
||||
* Broadcast to all Threads blocking on a call to Cond::wait().
|
||||
*
|
||||
@ -480,7 +517,8 @@ class Cond
|
||||
* @link http://www.php.net/manual/en/cond.broadcast.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
final public static function broadcast($condition) {}
|
||||
final public static function broadcast($condition){
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Condition Variable for the caller.
|
||||
@ -488,7 +526,8 @@ class Cond
|
||||
* @link http://www.php.net/manual/en/cond.create.php
|
||||
* @return int A handle to a Condition Variable
|
||||
*/
|
||||
final public static function create() {}
|
||||
final public static function create(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a condition
|
||||
@ -502,7 +541,8 @@ class Cond
|
||||
* @link http://www.php.net/manual/en/cond.destroy.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
final public static function destroy($condition) {}
|
||||
final public static function destroy($condition){
|
||||
}
|
||||
|
||||
/**
|
||||
* Signal a Condition
|
||||
@ -512,18 +552,20 @@ class Cond
|
||||
* @link http://www.php.net/manual/en/cond.signal.php
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
final public static function signal($condition) {}
|
||||
final public static function signal($condition){
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for a signal on a Condition Variable, optionally specifying a timeout to limit waiting time.
|
||||
*
|
||||
* @param int $condition A handle to a Condition Variable returned by a previous call to Cond::create()
|
||||
* @param int $mutex A handle returned by a previous call to Mutex::create() and owned (locked) by the caller.
|
||||
* @param int $timeout An optional timeout, in microseconds
|
||||
* @param int $mutex A handle returned by a previous call to Mutex::create() and owned (locked) by the caller.
|
||||
* @param int $timeout An optional timeout, in microseconds
|
||||
*
|
||||
* @return bool A boolean indication of success
|
||||
*/
|
||||
final public static function wait($condition, $mutex, $timeout = null) {}
|
||||
final public static function wait($condition, $mutex, $timeout = null){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -535,8 +577,7 @@ class Cond
|
||||
*
|
||||
* @link http://www.php.net/manual/en/class.pool.php
|
||||
*/
|
||||
class Pool
|
||||
{
|
||||
class Pool{
|
||||
/**
|
||||
* The maximum number of Worker threads allowed in this Pool
|
||||
*
|
||||
@ -582,20 +623,22 @@ class Pool
|
||||
/**
|
||||
* Construct a new Pool of Workers
|
||||
*
|
||||
* @param integer $size The maximum number of Workers this Pool can create
|
||||
* @param string $class The class for new Workers
|
||||
* @param array $ctor An array of arguments to be passed to new Workers
|
||||
* @param integer $size The maximum number of Workers this Pool can create
|
||||
* @param string $class The class for new Workers
|
||||
* @param array $ctor An array of arguments to be passed to new Workers
|
||||
*
|
||||
* @link http://www.php.net/manual/en/pool.__construct.php
|
||||
*/
|
||||
public function __construct($size, $class, array $ctor = array()) {}
|
||||
public function __construct($size, $class, array $ctor = array()){
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts down all Workers, and collect all Stackables, finally destroys the Pool
|
||||
*
|
||||
* @link http://www.php.net/manual/en/pool.__destruct.php
|
||||
*/
|
||||
public function __destruct() {}
|
||||
public function __destruct(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect references to completed tasks
|
||||
@ -606,7 +649,8 @@ class Pool
|
||||
*
|
||||
* @link http://www.php.net/manual/en/pool.collect.php
|
||||
*/
|
||||
public function collect(callable $collector) {}
|
||||
public function collect(callable $collector){
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the Pool
|
||||
@ -615,14 +659,16 @@ class Pool
|
||||
*
|
||||
* @link http://www.php.net/manual/en/pool.resize.php
|
||||
*/
|
||||
public function resize($size) {}
|
||||
public function resize($size){
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown all Workers in this Pool
|
||||
*
|
||||
* @link http://www.php.net/manual/en/pool.shutdown.php
|
||||
*/
|
||||
public function shutdown() {}
|
||||
public function shutdown(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the task to the next Worker in the Pool
|
||||
@ -631,15 +677,17 @@ class Pool
|
||||
*
|
||||
* @return int the identifier of the Worker executing the object
|
||||
*/
|
||||
public function submit(Threaded $task) {}
|
||||
public function submit(Threaded $task){
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the task to the specific Worker in the Pool
|
||||
*
|
||||
* @param int $worker The worker for execution
|
||||
* @param Threaded $task The task for execution
|
||||
* @param int $worker The worker for execution
|
||||
* @param Threaded $task The task for execution
|
||||
*
|
||||
* @return int the identifier of the Worker that accepted the object
|
||||
*/
|
||||
public function submitTo($worker, Threaded $task) {}
|
||||
public function submitTo($worker, Threaded $task){
|
||||
}
|
||||
}
|
@ -46,7 +46,8 @@ define("YAML_CRLN_BREAK", 3);
|
||||
* @link http://www.php.net/manual/en/function.yaml-emit-file.php
|
||||
* @return bool
|
||||
*/
|
||||
function yaml_emit_file($filename, $data, $encoding = YAML_ANY_ENCODING, $linebreak = YAML_ANY_BREAK, array $callbacks = array()){}
|
||||
function yaml_emit_file($filename, $data, $encoding = YAML_ANY_ENCODING, $linebreak = YAML_ANY_BREAK, array $callbacks = array()){
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the YAML representation of a value
|
||||
@ -59,7 +60,8 @@ function yaml_emit_file($filename, $data, $encoding = YAML_ANY_ENCODING, $linebr
|
||||
* @link http://www.php.net/manual/en/function.yaml-emit.php
|
||||
* @return string
|
||||
*/
|
||||
function yaml_emit($data, $encoding = YAML_ANY_ENCODING, $linebreak = YAML_ANY_BREAK, array $callbacks = array()){}
|
||||
function yaml_emit($data, $encoding = YAML_ANY_ENCODING, $linebreak = YAML_ANY_BREAK, array $callbacks = array()){
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a YAML stream from a file
|
||||
@ -72,7 +74,8 @@ function yaml_emit($data, $encoding = YAML_ANY_ENCODING, $linebreak = YAML_ANY_B
|
||||
* @link http://www.php.net/manual/en/function.yaml-parse-file.php
|
||||
* @return mixed
|
||||
*/
|
||||
function yaml_parse_file($filename, $pos = 0, &$ndocs = null, array $callbacks = array()){}
|
||||
function yaml_parse_file($filename, $pos = 0, &$ndocs = null, array $callbacks = array()){
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a YAML stream from a URL
|
||||
@ -85,7 +88,8 @@ function yaml_parse_file($filename, $pos = 0, &$ndocs = null, array $callbacks =
|
||||
* @link http://www.php.net/manual/en/function.yaml-parse-url.php
|
||||
* @return mixed
|
||||
*/
|
||||
function yaml_parse_url($url, $pos = 0, &$ndocs = null, array $callbacks = array()){}
|
||||
function yaml_parse_url($url, $pos = 0, &$ndocs = null, array $callbacks = array()){
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a YAML stream
|
||||
@ -98,4 +102,5 @@ function yaml_parse_url($url, $pos = 0, &$ndocs = null, array $callbacks = array
|
||||
* @link http://www.php.net/manual/en/function.yaml-parse.php
|
||||
* @return mixed
|
||||
*/
|
||||
function yaml_parse($input, $pos = 0, &$ndocs = null, array $callbacks = array()){}
|
||||
function yaml_parse($input, $pos = 0, &$ndocs = null, array $callbacks = array()){
|
||||
}
|
@ -15,7 +15,7 @@ function testCase($name, $output, $expected){
|
||||
global $testErrors;
|
||||
if($output === $expected){
|
||||
console("[TEST] $name: " . Utils\TextFormat::GREEN . "Ok.");
|
||||
} else{
|
||||
}else{
|
||||
console("[TEST] $name: " . Utils\TextFormat::RED . "Error.");
|
||||
console("Expected " . print_r($expected, true) . ", got " . print_r($output, true));
|
||||
++$testErrors;
|
||||
@ -33,7 +33,7 @@ if(!class_exists("\\PocketMine\\Server", false)){
|
||||
if($testErrors === 0){
|
||||
console(Utils\TextFormat::GREEN . "[TEST] No errors. Test complete.");
|
||||
exit(0);
|
||||
} else{
|
||||
}else{
|
||||
console(Utils\TextFormat::RED . "[TEST] Errors found.");
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user