Skip to content

Commit

Permalink
Initial import from SVN.
Browse files Browse the repository at this point in the history
  • Loading branch information
schst committed May 22, 2012
0 parents commit 6d0a2b5
Show file tree
Hide file tree
Showing 179 changed files with 11,544 additions and 0 deletions.
504 changes: 504 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions UPGRADE
@@ -0,0 +1,22 @@
Upgrading from v0.3.x and lower to v0.4.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This document describes the steps you need to do when upgrading XJConf from any
of the 0.3.x versions and lower to 0.4.0.

1. Remove all includes of XJConf classes by hand. Instead, just include
XJConf/XJConf.php at the beginning of your application or script. This will
register an autoload method that takes care of loading all other classes
from XJConf.

2. Replace every occurance of XJConfLoader::load('package.ClassName'); with
use net::xjconf::package::ClassName;.
For example, if you use the XJConfFacade, you need to replace
XJConfLoader::load('XJConfFacade');
with
use net::xjconf::XJConfFacade;
while using
XJConfLoader::load('DefinitionParser', 'XmlParser');
needs to be replaced with
use net::xjconf::DefinitionParser;
use net::xjconf::XmlParser;
120 changes: 120 additions & 0 deletions autopackage2.php
@@ -0,0 +1,120 @@
<?php
/**
* script to automate the generation of the
* package.xml file.
*
* $Id: package.php 442 2006-08-20 13:21:58Z schst $
*
* @author Stephan Schmidt <schst@php-tools.net>
* @package XJConfForPHP
* @subpackage Tools
*/

/**
* uses PackageFileManager
*/
require_once 'PEAR/PackageFileManager2.php';
require_once 'PEAR/PackageFileManager/Svn.php';

/**
* Base version
*/
$baseVersion = '0.2.0';

/**
* current version
*/
$version = $baseVersion . 'dev' . $argv[1];
$dir = dirname( __FILE__ );

/**
* Current API version
*/
$apiVersion = '0.2.0';

/**
* current state
*/
$state = 'devel';

/**
* current API stability
*/
$apiStability = 'alpha';

/**
* release notes
*/
$notes = <<<EOT
Feature additions:
- New feature to define abstract tags, which enables yo to define the concrete type in the tag instead of the definition (mikey)
- It is now possible to define an explicit setter method for character data inside a tag (schst)
- Added possibility to declare tags as static (schst)
- Added several unit tests (mikey)
- Added possibility to package XJConfForPHP as a STAR archive (mikey, schst)
- Added new value type "xjonf:auto-primitive" to guess the type of a scalar value (schst)
- Added implicit and explicit call to __set as well as possibility for setting public properties (mikey)
Bugfixes:
- Fixed bug #6: Enable factory methods without parameters in PHP 5.0.x (schst)
- Fixed bug #7: check, whether factory method can be called statically (schst)
- Fixed bug: prevent errors in case factory method does not return an instance of an object (mikey)
EOT;

/**
* package description
*/
$description = <<<EOT
XJConfForPHP is a port of XJConf. It enables you to create complex data structures consisting of
objects, arrays and primitives from virtually any XML document. It provides a simple XML language
to define the XML-to-object mappings. It features namespace support and is easily extendible.
EOT;

$package = new PEAR_PackageFileManager2();

$result = $package->setOptions(array(
'filelistgenerator' => 'file',
'ignore' => array( 'package.php', 'autopackage2.php', 'package.xml', '.svn', 'rfcs' ),
'simpleoutput' => true,
'baseinstalldir' => '/',
'packagedirectory' => './',
'dir_roles' => array(
'docs' => 'doc',
'examples' => 'doc',
'tests' => 'test',
)
));
if (PEAR::isError($result)) {
echo $result->getMessage();
die();
}

$package->setPackage('XJConfForPHP');
$package->setSummary('XML-to-object mapper.');
$package->setDescription($description);

$package->setChannel('pear.php-tools.net');
$package->setAPIVersion($apiVersion);
$package->setReleaseVersion($version);
$package->setReleaseStability($state);
$package->setAPIStability($apiStability);
$package->setNotes($notes);
$package->setPackageType('php');
$package->setLicense('LGPL', 'http://www.gnu.org/copyleft/lesser.txt');

$package->addMaintainer('lead', 'schst', 'Stephan Schmidt', 'schst@xjconf.net', 'yes');
$package->addMaintainer('lead', 'mikey', 'Frank Kleine', 'mikey@xjconf.net', 'yes');

$package->setPhpDep('5.0.0');
$package->setPearinstallerDep('1.4.0');

$package->addExtensionDep('required', 'xmlreader');

$package->generateContents();

$result = $package->writePackageFile();

if (PEAR::isError($result)) {
echo $result->getMessage();
die();
}
?>
19 changes: 19 additions & 0 deletions build.php
@@ -0,0 +1,19 @@
<?php
require 'star/starWriter.php';
$starArchive = new StarArchive(new StarWriter('build/xjconf.star'));
$dirIt = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('XJConf'));
foreach ($dirIt as $file) {
if ($file->isFile() == false || substr($file->getPathname(), -4) != '.php') {
continue;
}

$fqClassName = str_replace('/', '::', str_replace('XJConf/', 'net/xjconf/', str_replace(DIRECTORY_SEPARATOR, '/', str_replace('.php', '', $file->getPathname()))));
$starArchive->add(new StarFile($file->getPathname(), __DIR__), $fqClassName);
}
$starArchive->addMetaData('title', 'XJConf for PHP');
$starArchive->addMetaData('package', 'net::xjconf');
$starArchive->addMetaData('version', '0.4.0dev');
$starArchive->addMetaData('author', 'XJConf Development Team <http://php.xjconf.net>');
$starArchive->addMetaData('copyright', '(c) 2007-2008 XJConf Development Team');
$starArchive->create();
?>
52 changes: 52 additions & 0 deletions examples/AnotherClass.php
@@ -0,0 +1,52 @@
<?php
/**
* Class for example purposes.
*
* @author Stephan Schmidt <stephan.schmidt@schlund.de>
* @author Frank Kleine <mikey@xjconf.net>
*/
require_once __DIR__ . '/MyInterface.php';
/**
* Class for example purposes.
*
* @package XJConf
* @subpackage examples
*/
class AnotherClass implements MyInterface
{
/**
* hold bar
*
* @var MyInterface
*/
private $bar;

/**
* just foo
*/
public function foo()
{
// nothing to do here
}

/**
* set bar
*
* @param MyInterface $bar
*/
public function setBar(MyInterface $bar)
{
$this->bar = $bar;
}

/**
* return bar
*
* @return MyInterface
*/
public function getBar()
{
return $this->bar;
}
}
?>
8 changes: 8 additions & 0 deletions examples/AnotherDog.php
@@ -0,0 +1,8 @@
<?php
class AnotherDog
{
public $species;

public $name;
}
?>
27 changes: 27 additions & 0 deletions examples/CDataColor.php
@@ -0,0 +1,27 @@
<?php
/**
* example class
*
* @author Frank Kleine <mikey@xjconf.net>
*/
/**
* example class
*
* @package XJConf
* @subpackage examples
*/
class CDataColor
{
protected $hex;

public function __construct($hex)
{
$this->hex = $hex;
}

public function getHex()
{
return $this->hex;
}
}
?>
135 changes: 135 additions & 0 deletions examples/ColorPrimitives.php
@@ -0,0 +1,135 @@
<?php
/**
* example class
*
* @author Stephan Schmidt <stephan.schmidt@schlund.de>
* @author Frank Kleine <mikey@xjconf.net>
*/
/**
* example class
*
* @package XJConf
* @subpackage examples
*/
class ColorPrimitives
{
/**
* the red part of the color
*
* @var int
*/
private $red;
/**
* the green part of the color
*
* @var int
*/
private $green;
/**
* the blue part of the color
*
* @var int
*/
private $blue;
/**
* the name of the color
*
* @var int
*/
private $name = null;
/**
* the title of the color
*
* @var int
*/
private $colorTitle = null;

/**
* constructor
*
* @var string $name name of the color
*/
public function __construct($name)
{
$this->name = $name;
}

/**
* set the red part
*
* @param int $val
*/
public function setRed($val)
{
$this->red = $val;
}

/**
* set the green part
*
* @param int $val
*/
public function setGreen($val) {
$this->green = $val;
}

/**
* set the blue part
*
* @param int $val
*/
public function setBlue($val) {
$this->blue = $val;
}

/**
* set the title of the color
*
* @param string $title
*/
public function setColorTitle($title)
{
$this->colorTitle = $title;
}

/**
* get the rgb value as hex
*
* @return string
*/
public function getRGB()
{
return "#" . dechex($this->red) . dechex($this->green) . dechex($this->blue);
}

/**
* return the name of the color
*
* @return string
*/
public function getName()
{
return $this->name;
}

/**
* return the title of the color
*
* @return string
*/
public function getColorTitle()
{
return $this->colorTitle;
}

/**
* returns string representation
*
* @return string
*/
public function __toString()
{
return $this->name . "(" . $this->getRGB() . ")";
}
}
?>

0 comments on commit 6d0a2b5

Please sign in to comment.