Skip to content

Commit

Permalink
Implement #6: add 'discovery' package
Browse files Browse the repository at this point in the history
  • Loading branch information
Bui Sy Nguyen committed Jan 22, 2016
1 parent cc46204 commit 2328401
Show file tree
Hide file tree
Showing 5 changed files with 416 additions and 0 deletions.
55 changes: 55 additions & 0 deletions fproject/amf/discovery/ClassFindInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
///////////////////////////////////////////////////////////////////////////////
//
// © Copyright f-project.net 2010-present.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////

namespace fproject\amf\discovery;

/**
* The information necessary for a service router to be able to load a class' file and instanciate it
* could be extended later with namespaces when they become mainstream
*
* @package Amfphp_Core_Common
* @author Ariel Sommeria-klein
*/
class ClassFindInfo {

/**
* the absolute path to the file containing the class definition
* @var String
*/
public $absolutePath;

/**
* the name of the class.
* @var String
*/
public $className;

/**
* constructor
* @param String $absolutePath
* @param String $className
*/
public function __construct($absolutePath, $className) {
$this->absolutePath = $absolutePath;
$this->className = $className;
}

}

?>
70 changes: 70 additions & 0 deletions fproject/amf/discovery/MethodDescriptor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
///////////////////////////////////////////////////////////////////////////////
//
// © Copyright f-project.net 2010-present.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////

namespace fproject\amf\discovery;

/**
* Contains all collected information about a service method.
*
* @author Ariel Sommeria-klein
* @package Amfphp_Plugins_Discovery
*/
class MethodDescriptor {

/**
* name
* @var string
*/
public $name;

/**
*
* @var ParameterDescriptor[] array of ParameterDescriptor
*/
public $parameters;

/**
*
* @var string method level comment
*/
public $comment;

/**
* return type
* @var string
*/
public $returnType;

/**
* constructor
* @param string $name
* @param array $parameters
* @param string $comment
* @param string $returnType
*/
public function __construct($name, array $parameters, $comment, $returnType) {
$this->name = $name;
$this->parameters = $parameters;
$this->comment = $comment;
$this->returnType = $returnType;
}

}

?>
54 changes: 54 additions & 0 deletions fproject/amf/discovery/ParameterDescriptor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
///////////////////////////////////////////////////////////////////////////////
//
// © Copyright f-project.net 2010-present.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////

namespace fproject\amf\discovery;

/**
* Contains all collected information about a service method parameter
*
* @author Ariel Sommeria-klein
* @package Amfphp_Plugins_Discovery
*/
class ParameterDescriptor {

/**
* name
* @var string
*/
public $name;

/**
* This can be gathered in 2 manners: commentary tag analysis and type hinting analysis. For starters only the second method is used
* @var String
*/
public $type;

/**
* constructor
* @param String $name
* @param String $type
*/
public function __construct($name, $type) {
$this->name = $name;
$this->type = $type;
}

}

?>
59 changes: 59 additions & 0 deletions fproject/amf/discovery/ServiceDescriptor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
///////////////////////////////////////////////////////////////////////////////
//
// © Copyright f-project.net 2010-present.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////

namespace fproject\amf\discovery;

/**
* Contains all collected information about a service. This information will be used by the generator.
*
* @author Ariel Sommeria-klein
* @package Amfphp_Plugins_Discovery
*/
class ServiceDescriptor {
/**
*name
* @var string
*/
public $name;
/**
* methods
* @var MethodDescriptor[] an array of MethodDescriptor
*/
public $methods;

/**
* class level comment
* @var string
*/
public $comment;

/**
* constructor
* @param string $name
* @param MethodDescriptor[] $methods
* @param string $comment
*/
public function __construct($name, array $methods, $comment) {
$this->name = $name;
$this->methods = $methods;
$this->comment = $comment;
}
}

?>
Loading

0 comments on commit 2328401

Please sign in to comment.