Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Composer.json and namespaces to the classes #42

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.project
/.settings
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: php

php:
- 5.3.3
- 5.3
- 5.4

before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev
3 changes: 3 additions & 0 deletions TropoClasses.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
// This file is deprecated and is here for backward compatibility
require 'tropo.class.php';

// TODO require classes via autoloader

?>

16 changes: 16 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"description": "This repository contains an PHP5.3+ version of the original tropo/tropo-webapi-php repository.",
"name": "rvanlaak/tropo-webapi-php",
"type": "library",
"keywords" : ["tropo", "php", "sms", "voip"],
"homepage": "https://github.com/tropo/tropo-webapi-php",
"require": {
"php": ">=5.3.3"
},
"autoload": {
"psr-0": {
"Tropo": "src/"
}
},
"target-dir": "Tropo/WebapiBundle"
}
1 change: 0 additions & 1 deletion samples/orchestra
Submodule orchestra deleted from 56e8df
48 changes: 48 additions & 0 deletions src/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* This library contains PHP classes that can be used to interact with the Tropo WebAPI/
* @see https://www.tropo.com/docs/webapi/
*
* @copyright 2010 Mark J. Headd (http://www.voiceingov.org)
* @package TropoPHP
* @author Mark Headd
* @author Adam Kalsey
*/

namespace Tropo;

/**
* Application class. Represents a Tropo application.
*
*/
class Application
{

public function __construct($href = NULL, $name = NULL, $voiceUrl = NULL, $messagingUrl = NULL, $platform = NULL, $partition = NULL)
{
if (isset($href)) {
$this->href = $href;
}
if (isset($name)) {
$this->name = $name;
}
if (isset($voiceUrl)) {
$this->voiceUrl = $voiceUrl;
}
if (isset($messagingUrl)) {
$this->messagingUrl = $messagingUrl;
}
if (isset($platform)) {
$this->platform = $platform;
}
if (isset($partition)) {
$this->partition = $partition;
}
}

public function __set($attribute, $value)
{
$this->$attribute = $value;
}
}
47 changes: 47 additions & 0 deletions src/Entity/Address.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace Tropo\Entity;

/**
* Address class. Represents an address assigned to a Tropo application.
*
*/
class Address
{

public function __construct($type = NULL, $prefix = NULL, $number = NULL, $city = NULL, $state = NULL, $channel = NULL, $username = NULL, $password = NULL, $token = NULL)
{
if (isset($type)) {
$this->type = $type;
}
if (isset($prefix)) {
$this->prefix = $prefix;
}
if (isset($number)) {
$this->number = $number;
}
if (isset($city)) {
$this->type = $type;
}
if (isset($state)) {
$this->state = $state;
}
if (isset($channel)) {
$this->channel = $channel;
}
if (isset($username)) {
$this->username = $username;
}
if (isset($password)) {
$this->password = $password;
}
if (isset($token)) {
$this->token = $token;
}
}

public function __set($attribute, $value)
{
$this->$attribute = $value;
}
}
19 changes: 19 additions & 0 deletions src/Entity/AddressType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Tropo\Entity;

/**
* Helper class listing the type of addresses available to use with Tropo applications.
*
*/
class AddressType
{
public static $number = "number";
public static $token = "token";
public static $aim = "aim";
public static $gtalk = "gtalk";
public static $jabber = "jabber";
public static $msn = "msn";
public static $yahoo = "yahoo";
public static $skype = "skype";
}
13 changes: 13 additions & 0 deletions src/Entity/AudioFormat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Tropo\Entity;

/**
* AudioFormat Helper class.
* @package TropoPHP_Support
*/
class AudioFormat
{
public static $wav = "audio/wav";
public static $mp3 = "audio/mp3";
}
13 changes: 13 additions & 0 deletions src/Entity/Channel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Tropo\Entity;

/**
* Channel Helper class.
* @package TropoPHP_Support
*/
class Channel
{
public static $voice = "VOICE";
public static $text = "TEXT";
}
20 changes: 20 additions & 0 deletions src/Entity/Date.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Tropo\Entity;

/**
* Date Helper class.
* @package TropoPHP_Support
*/
class Date
{
public static $monthDayYear = "mdy";
public static $dayMonthYear = "dmy";
public static $yearMonthDay = "ymd";
public static $yearMonth = "ym";
public static $monthYear = "my";
public static $monthDay = "md";
public static $year = "y";
public static $month = "m";
public static $day = "d";
}
16 changes: 16 additions & 0 deletions src/Entity/Duration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Tropo\Entity;

/**
* Duration Helper class.
* @package TropoPHP_Support
*/
class Duration
{
public static $hoursMinutesSeconds = "hms";
public static $hoursMinutes = "hm";
public static $hours = "h";
public static $minutes = "m";
public static $seconds = "s";
}
19 changes: 19 additions & 0 deletions src/Entity/Event.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Tropo\Entity;

/**
* Event Helper class.
* @package TropoPHP_Support
*/
class Event
{

public static $continue = 'continue';
public static $incomplete = 'incomplete';
public static $error = 'error';
public static $hangup = 'hangup';
public static $join = 'join';
public static $leave = 'leave';
public static $ring = 'ring';
}
35 changes: 35 additions & 0 deletions src/Entity/Exchange.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Tropo\Entity;

/**
* Exchange class. Represents an exchange.
*
*/
class Exchange
{

public function __construct($prefix = NULL, $city = NULL, $state = NULL, $country = NULL)
{
if (isset($prefix)) {
$this->prefix = $prefix;
}
if (isset($city)) {
$this->city = $city;
}
if (isset($state)) {
$this->state = $state;
}
if (isset($country)) {
$this->country = $country;
}
if (isset($description)) {
$this->description = $description;
}
}

public function __set($attribute, $value)
{
$this->$attribute = $value;
}
}
21 changes: 21 additions & 0 deletions src/Entity/Format.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Tropo\Entity;

/**
* Format Helper class.
* @package TropoPHP_Support
*/
class Format
{
public $date;
public $duration;
public static $ordinal = "ordinal";
public static $digits = "digits";

public function __construct($date = NULL, $duration = NULL)
{
$this->date = $date;
$this->duration = $duration;
}
}
21 changes: 21 additions & 0 deletions src/Entity/Headers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Tropo\Entity;

/**
* SIP Headers Helper class.
* @package TropoPHP_Support
*/
class Headers
{

public function __set($name, $value)
{
if (!strstr($name, "-")) {
$this->$name = $value;
} else {
$name = str_replace("-", "_", $name);
$this->$name = $value;
}
}
}
20 changes: 20 additions & 0 deletions src/Entity/Network.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Tropo\Entity;

/**
* Network Helper class.
* @package TropoPHP_Support
*/
class Network
{
public static $pstn = "PSTN";
public static $voip = "VOIP";
public static $aim = "AIM";
public static $gtalk = "GTALK";
public static $jabber = "JABBER";
public static $msn = "MSN";
public static $sms = "SMS";
public static $yahoo = "YAHOO";
public static $twitter = "TWITTER";
}
22 changes: 22 additions & 0 deletions src/Entity/Recognizer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Tropo\Entity;

/**
* Recognizer Helper class
* @package TropoPHP_Support
*
*/
class Recognizer
{
public static $German = 'de-de';
public static $British_English = 'en-gb';
public static $US_English = 'en-us';
public static $Castilian_Spanish = 'es-es';
public static $Mexican_Spanish = 'es-mx';
public static $French_Canadian = 'fr-ca';
public static $French = 'fr-fr';
public static $Italian = 'it-it';
public static $Polish = 'pl-pl';
public static $Dutch = 'nl-nl';
}
14 changes: 14 additions & 0 deletions src/Entity/SayAs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Tropo\Entity;

/**
* SayAs Helper class.
* @package TropoPHP_Support
*/
class SayAs
{
public static $date = "DATE";
public static $digits = "DIGITS";
public static $number = "NUMBER";
}
Loading