Skip to content

Interface CookBook

Gerd Christian Kunze edited this page May 28, 2013 · 18 revisions

Definition


Common

MOC\Generic\Common\Instance.php
MOC\Generic\Common\Depending.php
MOC\Generic\Common\Changelog.php
MOC\Generic\Common.php

Device

MOC\Generic\Device\Core.php
MOC\Generic\Device\Extension.php
MOC\Generic\Device\Module.php
MOC\Generic\Device\Plugin.php
MOC\Generic\Device\Adapter.php

Structure


Rule #1:

Every top-level class is considered a 'device' and therefore has to be derived from the corresponding generic device class

Rule #2:

Every top-level file has to match the resulting filesystem location

Rule #3:

Every sub-level file has to fit in the resulting top-level directory location

Filesystem:

  • MOC\[DeviceTypeName]\[TopLevelClassName].php
  • MOC\[DeviceTypeName]\[TopLevelClassName]\[SubLevelClassName].php
  • ...

Namespace:

  • Top-level Class: MOC\[DeviceTypeName]
  • Sub-level Class: MOC\[DeviceTypeName]\[TopLevelClassName]
  • ...

Classname:

  • [(Top|Sub|...)LevelClassName]

Example


Top-Level

namespace MOC\Plugin;
use MOC\Generic\Device\Plugin;
class PluginClassName implements Plugin {}

Resulting location: MOC\Plugin\PluginClassName.php

Sub-Level

namespace MOC\Plugin\PluginClassName;
use MOC\Generic\Common;
class SubPluginClassName implements Common {}

Resulting location: MOC\Plugin\PluginClassName\SubPluginClassName.php

Clone this wiki locally