33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-12-29 20:56:28 +00:00
jedchecker/builds/phingext/explodetask.php

56 lines
1.1 KiB
PHP
Raw Normal View History

2012-05-21 08:33:11 +00:00
<?php
require_once "phing/Task.php";
class explodeTask extends Task
{
public function setString($string)
{
$this->string = $string;
}
public function setDelimiter($delimiter) {
$this->delimiter = $delimiter;
}
public function setKey($key) {
$this->key = $key;
}
/**
* Defines the name of a property to be set .
*
* @param string $name Name for the property to be set from input
*/
public function setPropertyName($name) {
$this->propertyName = $name;
}
/**
* The init method: Do init steps.
*/
public function init()
{
// nothing to do here
}
/**
* The main entry point method.
*/
public function main()
{
if ($this->propertyName === null) {
throw new BuildException("You must specify a value for propertyName attribute.");
}
$value = explode($this->delimiter, $this->string);
if ($value !== null) {
$this->project->setUserProperty($this->propertyName, $value[$this->key]);
}
}
}