Modified: shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php (original) +++ shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php Fri Jan 14 14:41:43 2011 @@ -130,11 +130,12 @@ class OAuthFetcher extends RemoteContent /** * - * @param oauthCrypter used to encrypt transient information we store on the + * @param $tokenStore storage for long lived tokens. + * @param $oauthCrypter used to encrypt transient information we store on the * client. - * @param authToken user's gadget security token - * @param params OAuth fetch parameters sent from makeRequest - * @param tokenStore storage for long lived tokens. + * @param RemoteContentFetcher $fetcher + * @param $authToken user's gadget security token + * @param OAuthRequestParams $params OAuth fetch parameters sent from makeRequest */ public function __construct($tokenStore, $oauthCrypter, $fetcher, $authToken, OAuthRequestParams $params) { $this->fetcher = $fetcher; @@ -159,6 +160,11 @@ class OAuthFetcher extends RemoteContent $this->tokenStore = $tokenStore; } + /** + * + * @param Exception $e + * @return RemoteContentRequest + */ private function buildErrorResponse(Exception $e) { if ($this->error == null) { $this->error = OAuthError::$UNKNOWN_PROBLEM; @@ -209,6 +215,10 @@ class OAuthFetcher extends RemoteContent } } + /** + * + * @return TokenKey + */ private function buildTokenKey() { $tokenKey = new TokenKey(); // need to URLDecode so when comparing with the ProviderKey it goes thought @@ -224,6 +234,11 @@ class OAuthFetcher extends RemoteContent return $tokenKey; } + /** + * + * @param RemoteContentRequest $request + * @return RemoteContentRequest + */ public function fetch($request) { $this->realRequest = $request; try { @@ -237,6 +252,7 @@ class OAuthFetcher extends RemoteContent } /** + * @param RemoteContentRequest $request * @return RemoteContentRequest */ public function fetchRequest(RemoteContentRequest $request) { @@ -260,12 +276,18 @@ class OAuthFetcher extends RemoteContent return $this->fetchData(); } + /** + * + * @return RemoteContentRequest + */ private function buildOAuthApprovalResponse() { return $this->buildNonDataResponse(); } /** * Do we need to get the user's approval to access the data? + * + * @return boolean */ private function needApproval() { if ($this->accessorInfo == NULL) { @@ -298,6 +320,7 @@ class OAuthFetcher extends RemoteContent /** * + * @param RemoteContentRequest $request * @throws GadgetException */ private function fetchRequestToken(RemoteContentRequest $request) { @@ -325,7 +348,10 @@ class OAuthFetcher extends RemoteContent } /** - * @return OAuthRequest + * @param string $method + * @param string $url + * @param $params + * @return ShindigOAuthRequest */ private function newRequestMessageMethod($method, $url, $params) { if (! isset($params)) { @@ -348,6 +374,9 @@ class OAuthFetcher extends RemoteContent /* * @deprecated (All outgoing messages must send additional params * like XOAUTH_APP_URL, so use newRequestMessageParams instead) + * + * @param string $url + * @return ShindigOAuthRequest */ private function newRequestMessageUrlOnly($url) { $params = array(); @@ -355,7 +384,9 @@ class OAuthFetcher extends RemoteContent } /** - * @return OAuthRequest + * @param string $url + * @param string $params + * @return ShindigOAuthRequest */ private function newRequestMessageParams($url, $params) { $method = "POST"; @@ -365,6 +396,13 @@ class OAuthFetcher extends RemoteContent return $this->newRequestMessageMethod($method, $url, $params); } + /** + * + * @param string $url + * @param string $method + * @param array $params + * @return ShindigOAuthRequest + */ private function newRequestMessage($url = null, $method = null, $params = null) { if (isset($method) && isset($url) && isset($params)) { return $this->newRequestMessageMethod($method, $url, $params); @@ -375,6 +413,11 @@ class OAuthFetcher extends RemoteContent } } + /** + * + * @param array $oauthParams + * @return string + */ private function getAuthorizationHeader($oauthParams) { $result = "OAuth "; $first = true; @@ -390,6 +433,13 @@ class OAuthFetcher extends RemoteContent } /** + * @param array $oauthParams + * @param string $method + * @param string $url + * @param array $headers + * @param string $contentType + * @param string $postBody + * @param Options $options * @return RemoteContentRequest */ private function createRemoteContentRequest($oauthParams, $method, $url, $headers, $contentType, $postBody, $options) { @@ -429,6 +479,9 @@ class OAuthFetcher extends RemoteContent /** * Sends OAuth request token and access token messages. + * + * @param ShindigOAuthRequest $request + * @return ShindigOAuthRequest */ private function sendOAuthMessage(ShindigOAuthRequest $request) { $rcr = $this->createRemoteContentRequest($this->filterOAuthParams($request), $request->get_normalized_http_method(), $request->get_url(), null, RemoteContentRequest::$DEFAULT_CONTENT_TYPE, null, RemoteContentRequest::getDefaultOptions()); @@ -445,6 +498,8 @@ class OAuthFetcher extends RemoteContent /** * Builds the data we'll cache on the client while we wait for approval. + * + * @throws GadgetException */ private function buildClientApprovalState() { try { @@ -481,6 +536,8 @@ class OAuthFetcher extends RemoteContent /** * Do we need to exchange a request token for an access token? + * + * @return boolean */ private function needAccessToken() { return ($this->accessorInfo->getAccessor()->requestToken != null && $this->accessorInfo->getAccessor()->accessToken == null); @@ -488,6 +545,9 @@ class OAuthFetcher extends RemoteContent /** * Implements section 6.3 of the OAuth spec. + * + * @param RemoteContentRequest $request + * @throws GadgetException */ private function exchangeRequestToken(RemoteContentRequest $request) { try { @@ -534,6 +594,8 @@ class OAuthFetcher extends RemoteContent /** * Builds the data we'll cache on the client while we make requests. + * + * @throws GadgetException */ private function buildClientAccessState() { try { @@ -550,6 +612,8 @@ class OAuthFetcher extends RemoteContent /** * Get honest-to-goodness user data. + * + * @return RemoteContentRequest */ private function fetchData() { try { @@ -616,9 +680,9 @@ class OAuthFetcher extends RemoteContent * Parse OAuth WWW-Authenticate header and either add them to an existing * message or create a new message. * - * @param msg - * @param resp - * @return the updated message. + * @param ShindigOAuthRequest $msg + * @param RemoteContentRequest $resp + * @return string the updated message. */ private function parseAuthHeader(ShindigOAuthRequest $msg = null, RemoteContentRequest $resp) { if ($msg == null) { @@ -639,12 +703,12 @@ class OAuthFetcher extends RemoteContent * they, and only they, may have to be put into an Authorization: header or * some such thing. * - * @param message the OAuthMessage object, which holds non-OAuth parameters + * @param string $message the OAuthMessage object, which holds non-OAuth parameters * such as foo=bar (which may have been in the original URI query part, or * perhaps in the POST body), as well as OAuth-related parameters (such as * oauth_timestamp or oauth_signature). * - * @return a list that contains only the oauth_related parameters. + * @return array a list that contains only the oauth_related parameters. * * @throws IOException */ @@ -658,12 +722,16 @@ class OAuthFetcher extends RemoteContent return $result; } + /** + * + * @return array + */ public function getResponseMetadata() { return $this->responseMetadata; } /** - * @var RemoteContentRequest $response + * @param RemoteContentRequest $response */ public function addResponseMetadata(RemoteContentRequest $response) { $response->setHttpCode(200); @@ -685,9 +753,16 @@ class OAuthFetcher extends RemoteContent } } + /** + * @param array $requests + */ public function multiFetchRequest(Array $requests) {// Do nothing -} + } + /** + * @param array $params + * @param SecurityToken $token + */ private static function addIdentityParams(array & $params, SecurityToken $token) { $params['opensocial_owner_id'] = $token->getOwnerId(); $params['opensocial_viewer_id'] = $token->getViewerId(); @@ -695,6 +770,10 @@ class OAuthFetcher extends RemoteContent $params['opensocial_app_url'] = $token->getAppUrl(); } + /** + * + * @param RemoteContentRequest $response + */ private static function setStrictNoCache(RemoteContentRequest $response) { $response->setResponseHeader('Pragma', 'no-cache'); $response->setResponseHeader('Cache-Control', 'no-cache');
Modified: shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php (original) +++ shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php Fri Jan 14 14:41:43 2011 @@ -23,17 +23,29 @@ */ class OAuthFetcherFactory { - /** used to encrypt state stored on the client */ + /** + * used to encrypt state stored on the client + * @var BlobCrypter + */ protected $oauthCrypter; - /** persistent storage for OAuth tokens */ + /** + * persistent storage for OAuth tokens + * @var OAuthStore + */ protected $tokenStore; + /** + * + * @param SigningFetcher $fetcher + * @param BlobCrypter $oauthCrypter + * @param OAuthStore $tokenStore + */ public function __construct($fetcher = null, $oauthCrypter = null, $tokenStore = null) { if (isset($oauthCrypter) && isset($tokenStore)) { - return $this->OAuthFetcherFactoryCreate($oauthCrypter, $tokenStore); + $this->OAuthFetcherFactoryCreate($oauthCrypter, $tokenStore); } elseif (isset($fetcher)) { - return $this->OAuthFetcherFactoryInit($fetcher); + $this->OAuthFetcherFactoryInit($fetcher); } else { throw new Exception('Wrong number of parameters in the OAuthFetcherFactory constuct'); } @@ -42,6 +54,8 @@ class OAuthFetcherFactory { /** * Initialize the OAuth factory with a default implementation of * BlobCrypter and consumer keys/secrets read from oauth.js + * + * @param SigningFetcher $fetcher */ public function OAuthFetcherFactoryInit($fetcher) { try { @@ -59,8 +73,8 @@ class OAuthFetcherFactory { /** * Creates an OAuthFetcherFactory based on prepared crypter and token store. * - * @param oauthCrypter used to wrap client side state - * @param tokenStore used as interface to persistent token store. + * @param $oauthCrypter used to wrap client side state + * @param OAuthStore $tokenStore used as interface to persistent token store. */ protected function OAuthFetcherFactoryCreate($oauthCrypter, $tokenStore) { $this->oauthCrypter = $oauthCrypter; @@ -71,10 +85,10 @@ class OAuthFetcherFactory { * Produces an OAuthFetcher that will sign requests and delegate actual * network retrieval to the {@code fetcher} * - * @param fetcher The fetcher that will fetch real content - * @param token The gadget token used to identity the user and gadget - * @param params The parsed parameters the gadget requested - * @return The oauth fetcher. + * @param RemoteContentFetcher $fetcher The fetcher that will fetch real content + * @param SecurityToken $token The gadget token used to identity the user and gadget + * @param OAuthRequestParams $params The parsed parameters the gadget requested + * @return OAuthFetcher * @throws GadgetException */ public function getOAuthFetcher(RemoteContentFetcher $fetcher, SecurityToken $token, OAuthRequestParams $params) { Modified: shindig/trunk/php/src/gadgets/oauth/OAuthRequestParams.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthRequestParams.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/oauth/OAuthRequestParams.php (original) +++ shindig/trunk/php/src/gadgets/oauth/OAuthRequestParams.php Fri Jan 14 14:41:43 2011 @@ -37,6 +37,10 @@ class OAuthRequestParams { protected $receivedCallback; protected $bypassSpecCache; + /** + * + * @param array $arguments + */ public function __construct(array $arguments) { $this->serviceName = self::getParam($arguments, self::$SERVICE_PARAM, ""); $this->tokenName = self::getParam($arguments, self::$TOKEN_PARAM, ""); @@ -47,6 +51,13 @@ class OAuthRequestParams { $this->bypassSpecCache = '1' == self::getParam($arguments, self::$BYPASS_SPEC_CACHE_PARAM, null); } + /** + * + * @param array $arguments + * @param string $name + * @param string $defaultValue + * @return array + */ private static function getParam(array $arguments, $name, $defaultValue) { if (isset($arguments[$name])) { return $arguments[$name]; @@ -55,30 +66,51 @@ class OAuthRequestParams { } } + /** + * @return string + */ public function getBypassSpecCache() { return $this->bypassSpecCache; } + /** + * @return string + */ public function getRequestToken() { return $this->requestToken; } + /** + * @return string + */ public function getRequestTokenSecret() { return $this->requestTokenSecret; } + /** + * @return string + */ public function getServiceName() { return $this->serviceName; } + /** + * @return string + */ public function getTokenName() { return $this->tokenName; } + /** + * @return string + */ public function getOrigClientState() { return $this->origClientState; } + /** + * @return string + */ public function getReceivedCallback() { return $this->receivedCallback; } Modified: shindig/trunk/php/src/gadgets/oauth/OAuthService.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthService.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/oauth/OAuthService.php (original) +++ shindig/trunk/php/src/gadgets/oauth/OAuthService.php Fri Jan 14 14:41:43 2011 @@ -26,24 +26,32 @@ class OAuthService { private static $URL_ATTR = "url"; private static $PARAM_LOCATION_ATTR = "param_location"; private static $METHOD_ATTR = "method"; - + + /** + * @var string + */ private $name; /** - * @var EndPoint + * @var string EndPoint */ private $requestUrl; /** - * @var EndPoint + * @var string EndPoint */ private $authorizationUrl; /** - * @var EndPoint + * @var string EndPoint */ private $accessUrl; + /** + * + * @param DOMElement $service + * @throws SpecParserException + */ public function __construct(DOMElement $service) { $this->name = (string)$service->getAttribute('name'); $elements = $service->getElementsByTagName('*'); @@ -90,6 +98,11 @@ class OAuthService { } } + /** + * + * @param DOMElement $element + * @return EndPoint + */ private function parseEndPoint($element) { $url = trim($element->getAttribute(OAuthService::$URL_ATTR)); if (empty($url)) { @@ -108,18 +121,30 @@ class OAuthService { return new EndPoint($url, $method, $location); } + /** + * @return string + */ public function getName() { return $this->name; } + /** + * @return string + */ public function getRequestUrl() { return $this->requestUrl; } + /** + * @return string + */ public function getAuthorizationUrl() { return $this->authorizationUrl; } + /** + * @return string + */ public function getAccessUrl() { return $this->accessUrl; } @@ -147,10 +172,27 @@ class Location { * Description of an OAuth request token or access token URL. */ class EndPoint { + /** + * @var string + */ public $url; + + /** + * @var string + */ public $method; + + /** + * @var string + */ public $location; + /** + * + * @param string $url + * @param string $method + * @param string $location + */ public function __construct($url, $method, $location) { $this->url = $url; $this->method = $method; Modified: shindig/trunk/php/src/gadgets/oauth/OAuthServiceProvider.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthServiceProvider.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/oauth/OAuthServiceProvider.php (original) +++ shindig/trunk/php/src/gadgets/oauth/OAuthServiceProvider.php Fri Jan 14 14:41:43 2011 @@ -19,11 +19,27 @@ */ class OAuthServiceProvider { - + /** + * @var string + */ public $requestTokenURL; + + /** + * @var string + */ public $userAuthorizationURL; + + /** + * @var string + */ public $accessTokenURL; + /** + * + * @param string $requestTokenURL + * @param string $userAuthorizationURL + * @param string $accessTokenURL + */ public function __construct($requestTokenURL, $userAuthorizationURL, $accessTokenURL) { $this->requestTokenURL = $requestTokenURL; $this->userAuthorizationURL = $userAuthorizationURL; Modified: shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php (original) +++ shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php Fri Jan 14 14:41:43 2011 @@ -23,9 +23,17 @@ * Now, it only has 1 property, but this class was designed to be reusable **/ class OAuthSpec { - + + /** + * + * @var array + */ private $oAuthServices = array(); + /** + * + * @param array $services + */ public function __construct($services) { foreach ($services as $service) { $oauthService = new OAuthService($service); @@ -33,6 +41,10 @@ class OAuthSpec { } } + /** + * + * @return array + */ public function getServices() { return $this->oAuthServices; } Modified: shindig/trunk/php/src/gadgets/oauth/OAuthStore.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/oauth/OAuthStore.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/oauth/OAuthStore.php (original) +++ shindig/trunk/php/src/gadgets/oauth/OAuthStore.php Fri Jan 14 14:41:43 2011 @@ -29,14 +29,14 @@ interface OAuthStore { /** * Retrieve an OAuthAccessor that is ready to sign OAuthMessages for * resource access. - * @param tokenKey a structure uniquely identifying the token: a userId, + * @param TokenKey $tokenKey a structure uniquely identifying the token: a userId, * a gadgetId, a moduleId (in case there are more than one * gadget of the same type on a page), a tokenName (which * distinguishes this token from others that the same gadget * might hold for the same service provider) and a serviceName * (which is the same as the service name in the ProviderKey * structure). - * @param provInfo provider information. The store combines information stored + * @param ProviderInfo $provInfo provider information. The store combines information stored * in the store (consumer key/secret, token, token secret, * etc.) with the provider information (access URL, request * URL etc.) passed in here to create an AccessorInfo object. Modified: shindig/trunk/php/src/gadgets/render/GadgetHtmlRenderer.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/render/GadgetHtmlRenderer.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/render/GadgetHtmlRenderer.php (original) +++ shindig/trunk/php/src/gadgets/render/GadgetHtmlRenderer.php Fri Jan 14 14:41:43 2011 @@ -27,6 +27,11 @@ require 'GadgetBaseRenderer.php'; */ class GadgetHtmlRenderer extends GadgetBaseRenderer { + /** + * + * @param Gadget $gadget + * @param array $view + */ public function renderGadget(Gadget $gadget, $view) { $this->setGadget($gadget); // Was a privacy policy header configured? if so set it Modified: shindig/trunk/php/src/gadgets/render/GadgetRenderer.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/render/GadgetRenderer.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/render/GadgetRenderer.php (original) +++ shindig/trunk/php/src/gadgets/render/GadgetRenderer.php Fri Jan 14 14:41:43 2011 @@ -23,8 +23,15 @@ * */ abstract class GadgetRenderer { + /** + * @var GadgetContext + */ protected $context; + /** + * + * @param GadgetContext $context + */ public function __construct(GadgetContext $context) { $this->context = $context; } @@ -34,7 +41,6 @@ abstract class GadgetRenderer { * javascript content (?v=<md5 of js>) for cache busting * * @param array $features - * @param Gadget $gadget * @return string the list of libraries in core:caja:etc.js?v=checksum> format */ protected function getJsUrl($features) { @@ -67,5 +73,9 @@ abstract class GadgetRenderer { return $ret; } + /** + * @param Gadget $gadget + * @param array $view + */ abstract function renderGadget(Gadget $gadget, $view); } Modified: shindig/trunk/php/src/gadgets/rewrite/ContentRewriter.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/rewrite/ContentRewriter.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/rewrite/ContentRewriter.php (original) +++ shindig/trunk/php/src/gadgets/rewrite/ContentRewriter.php Fri Jan 14 14:41:43 2011 @@ -27,8 +27,18 @@ class ContentRewriter extends DomRewriter { private $rewrite; private $baseUrl; + + /** + * + * @var array + */ private $defaultRewrite = array('include-url' => array('*'), 'exclude-url' => array(), 'refresh' => '86400'); + /** + * + * @param GadgetContext $context + * @param Gadget $gadget + */ public function __construct(GadgetContext $context, Gadget &$gadget) { parent::__construct($context, $gadget); // if no rewrite params are set in the gadget but rewrite_by_default is on, use our default rules (rewrite all) @@ -59,6 +69,7 @@ class ContentRewriter extends DomRewrite * url so that the proxy server knows to rewrite it's content or not * * @param string $url + * @return string */ private function getProxyUrl($url) { if (strpos(strtolower($url), 'http://') === false && strpos(strtolower($url), 'https://') === false) { @@ -75,6 +86,7 @@ class ContentRewriter extends DomRewrite * Checks the URL against the include-url and exclude-url params * * @param string $url + * @param boolean */ private function includedUrl($url) { $included = $excluded = false; Modified: shindig/trunk/php/src/gadgets/rewrite/DomRewriter.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/rewrite/DomRewriter.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/rewrite/DomRewriter.php (original) +++ shindig/trunk/php/src/gadgets/rewrite/DomRewriter.php Fri Jan 14 14:41:43 2011 @@ -24,9 +24,23 @@ * */ abstract class DomRewriter { + /** + * + * @var GadgetContext + */ protected $context; + + /** + * + * @var Gadget + */ protected $gadget; + /** + * + * @param GadgetContext $context + * @param Gadget $gadget + */ public function __construct(GadgetContext $context, Gadget &$gadget) { $this->context = $context; $this->gadget = $gadget; Modified: shindig/trunk/php/src/gadgets/rewrite/GadgetRewriter.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/rewrite/GadgetRewriter.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/rewrite/GadgetRewriter.php (original) +++ shindig/trunk/php/src/gadgets/rewrite/GadgetRewriter.php Fri Jan 14 14:41:43 2011 @@ -24,10 +24,23 @@ * listeners */ class GadgetRewriter { + /** + * + * @var GadgetContext + */ private $context; private $doc; + + /** + * + * @var array + */ private $domObservers = array(); + /** + * + * @param GadgetContext $context + */ public function __construct(GadgetContext $context) { $this->context = $context; } @@ -37,6 +50,8 @@ class GadgetRewriter { * * @param string $content * @param Gadget $gadget + * @param boolean $checkDocument + * @return string */ public function rewrite($content, Gadget &$gadget, $checkDocument = false) { // Check to see if the gadget requested rewriting, or if rewriting is forced in the configuration Modified: shindig/trunk/php/src/gadgets/sample/BasicGadgetBlacklist.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/sample/BasicGadgetBlacklist.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/sample/BasicGadgetBlacklist.php (original) +++ shindig/trunk/php/src/gadgets/sample/BasicGadgetBlacklist.php Fri Jan 14 14:41:43 2011 @@ -25,8 +25,14 @@ * */ class BasicGadgetBlacklist implements GadgetBlacklist { + /** + * @var array + */ private $rules = array(); + /** + * @param string $file + */ public function __construct($file = false) { if (! $file) { $file = Config::get('base_path') . '/blacklist.txt'; Modified: shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php (original) +++ shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php Fri Jan 14 14:41:43 2011 @@ -22,9 +22,16 @@ * Basic implementation of a gadget spec factory. */ class BasicGadgetSpecFactory { - private $cache; + /** + * @var GadgetContext + */ private $context; + /** + * + * @param GadgetContext $context + * @return GadgetSpec + */ public function getGadgetSpec(GadgetContext $context) { $this->context = $context; return $this->getGadgetSpecUri($context->getUrl(), $context->getIgnoreCache()); @@ -32,6 +39,10 @@ class BasicGadgetSpecFactory { /** * Retrieves a gadget specification from the cache or from the Internet. + * + * @param string $url + * @param boolean $ignoreCache + * @return GadgetSpec */ public function getGadgetSpecUri($url, $ignoreCache) { return $this->fetchFromWeb($url, $ignoreCache); @@ -40,6 +51,10 @@ class BasicGadgetSpecFactory { /** * Retrieves a gadget specification from the Internet, processes its views and * adds it to the cache. + * + * @param string $url + * @param boolean $ignoreCache + * @return GadgetSpec */ private function fetchFromWeb($url, $ignoreCache) { $remoteContentRequest = new RemoteContentRequest($url); Modified: shindig/trunk/php/src/gadgets/templates/DataPipelining.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/templates/DataPipelining.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/templates/DataPipelining.php (original) +++ shindig/trunk/php/src/gadgets/templates/DataPipelining.php Fri Jan 14 14:41:43 2011 @@ -28,7 +28,8 @@ class DataPipelining { * Parses the data-pipelining tags of from a html/href view, or from a os-data script tag and returns a * normalized array of requests to perform (which can be used to call DataPipelining::fetch) * - * @param DOMNodeList $dataTags + * @param DOMElement $viewNode + * @return array */ static public function parse(DOMElement &$viewNode) { $dataTags = $viewNode->getElementsByTagName('*'); @@ -119,6 +120,7 @@ class DataPipelining { * * @param array $returnedResults * @param array $dataContext + * @return array */ static private function addResultToContext($returnedResults, $dataContext) { foreach ($returnedResults as $val) { @@ -145,9 +147,10 @@ class DataPipelining { * both request types use the current security token ($_GET['st']) when performing the requests so they happen in the correct context * * @param array $requests + * @param GadgetContext $context * @return array response */ - static private function performRequests($requests, $context) { + static private function performRequests($requests, GadgetContext $context) { $jsonRequests = array(); $httpRequests = array(); $decodedResponse = array(); @@ -250,6 +253,8 @@ class DataPipelining { * array, returning the parsed request on success, or FALSE on failure to resolve. * * @param array $request + * @param array $result + * @return array */ static private function resolveRequest($request, $result) { $dataContext = self::makeContextData($result); Modified: shindig/trunk/php/src/gadgets/templates/ExpType.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/templates/ExpType.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/templates/ExpType.php (original) +++ shindig/trunk/php/src/gadgets/templates/ExpType.php Fri Jan 14 14:41:43 2011 @@ -29,9 +29,21 @@ */ class Token { + /** + * @var string + */ public $type; + + /** + * @var mixed + */ public $value; + /** + * + * @param string $type + * @param mixed $value + */ function __construct($type, $value = null) { $this->type = $type; $this->value = $value; @@ -66,6 +78,11 @@ class ExpType { private static $ESCAPE_CHARS = array('\"' => '"', "\'" => "'", '\\\\' => '\\'); + /** + * + * @param mixed $value + * @return string + */ public static function detectType($value) { if (is_int($value)) { return ExpType::$INT; @@ -86,6 +103,10 @@ class ExpType { } } + /** + * @param Token $token + * @return Token + */ public static function coerceToNumber($token) { $INTEGER_PATTERN = "/^[0-9]+$/"; $type = $token->type; @@ -101,6 +122,10 @@ class ExpType { throw new ExpTypeException("Unable to coerce token " . print_r($token, true) . " to number"); } + /** + * @param Token $token + * @return Token + */ public static function coerceToString($token) { $PRIMITIVE_TYPES = array(ExpType::$INT, ExpType::$FLOAT, ExpType::$STRING, ExpType::$BOOL, ExpType::$NULL); $COMPOSITE_TYPES = array(ExpType::$ARRAY, ExpType::$OBJECT); @@ -123,6 +148,10 @@ class ExpType { return $string; } + /** + * @param Token $token + * @return Token + */ public static function coerceToBool($token) { $PRIMITIVE_TYPES = array(ExpType::$INT, ExpType::$FLOAT, ExpType::$STRING, ExpType::$BOOL, ExpType::$NULL); $COMPOSITE_TYPES = array(ExpType::$ARRAY, ExpType::$OBJECT); @@ -141,6 +170,10 @@ class ExpType { return $bool; } + /** + * @param Token $token + * @return Token + */ public static function coerceToNull($token) { $COMPOSITE_TYPES = array(ExpType::$ARRAY, ExpType::$OBJECT); $type = $token->type; Modified: shindig/trunk/php/src/gadgets/templates/ExpressionParser.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/templates/ExpressionParser.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/templates/ExpressionParser.php (original) +++ shindig/trunk/php/src/gadgets/templates/ExpressionParser.php Fri Jan 14 14:41:43 2011 @@ -73,6 +73,9 @@ class ExpressionParser { * on array, return "1, 2, 3, 4" * on int, return "1" * on string, return as is + * + * @param mixed $val + * @return string */ public static function stringValue($val) { if (is_array($val)) { Modified: shindig/trunk/php/src/gadgets/templates/TemplateLibrary.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/templates/TemplateLibrary.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/templates/TemplateLibrary.php (original) +++ shindig/trunk/php/src/gadgets/templates/TemplateLibrary.php Fri Jan 14 14:41:43 2011 @@ -27,12 +27,32 @@ * </Require> */ class TemplateLibrary { + /** + * + * @var array + */ private $osmlTags = array('os:Name', 'os:PeopleSelector', 'os:Badge'); + /** + * + * @var array + */ private $templates = array(); + /** + * + * @var boolean + */ private $osmlLoaded = false; + /** + * + * @var GadgetContext + */ private $gadgetContext; - public function __construct($gadgetContext) { + /** + * + * @param GadgetContext $gadgetContext + */ + public function __construct(GadgetContext $gadgetContext) { $this->gadgetContext = $gadgetContext; } @@ -98,6 +118,12 @@ class TemplateLibrary { $this->templates[$tag] = $template; } + /** + * + * @param DOMElement $node + * @param TemplateLibraryContent $globalScript + * @param TemplateLibraryContent $globalStyle + */ private function addTemplateDef(DOMElement &$node, $globalScript, $globalStyle) { $tag = $node->getAttribute('tag'); if (empty($tag)) { @@ -198,6 +224,9 @@ class TemplateLibrary { return $this->templates[$tag]; } + /* + * + */ private function loadOsmlLibrary() { $container = $this->gadgetContext->getContainer(); $containerConfig = $this->gadgetContext->getContainerConfig(); Modified: shindig/trunk/php/src/gadgets/templates/TemplateParser.php URL: http://svn.apache.org/viewvc/shindig/trunk/php/src/gadgets/templates/TemplateParser.php?rev=1059023&r1=1059022&r2=1059023&view=diff ============================================================================== --- shindig/trunk/php/src/gadgets/templates/TemplateParser.php (original) +++ shindig/trunk/php/src/gadgets/templates/TemplateParser.php Fri Jan 14 14:41:43 2011 @@ -25,9 +25,21 @@ require_once 'ExpressionParser.php'; class TemplateParser { + /** + * @var array + */ private $dataContext; + /** + * @var TemplateLibrary + */ private $templateLibrary; + /** + * dumps a node to stdout + * + * @param DOMnode $node + * @param string $function + */ public function dumpNode($node, $function) { $doc = new DOMDocument(null, 'utf-8'); $doc->preserveWhiteSpace = true; @@ -46,9 +58,11 @@ class TemplateParser { /** * Processes an os-template * - * @param string $template + * @param DOMnode $osTemplate + * @param array $dataContext + * @param TemplateLibrary $templateLibrary */ - public function process(DOMnode &$osTemplate, $dataContext, $templateLibrary) { + public function process(DOMnode &$osTemplate, $dataContext, TemplateLibrary $templateLibrary) { $this->setDataContext($dataContext); $this->templateLibrary = $templateLibrary; if ($osTemplate instanceof DOMElement) { @@ -80,6 +94,10 @@ class TemplateParser { return $this->dataContext; } + /** + * @param DOMNode $node + * @return boolean + */ public function parseNode(DOMNode &$node) { $removeNode = false; if ($node instanceof DOMText) { @@ -167,6 +185,10 @@ class TemplateParser { } } + /** + * + * @param DOMText $node + */ private function parseNodeText(DOMText &$node) { if (strpos($node->nodeValue, '${') !== false) { $expressions = array(); @@ -181,6 +203,11 @@ class TemplateParser { } } + /** + * + * @param DOMNode $node + * @return DOMNode or false + */ private function parseNodeAttributes(DOMNode &$node) { if ($node->hasAttributes()) { foreach ($node->attributes as $attr) { @@ -318,6 +345,7 @@ class TemplateParser { * Function that handles the os: and osx: tags * * @param DOMNode $node + * @return DOMNode or false */ private function parseOsmlNode(DOMNode &$node) { $tagName = strtolower($node->tagName); @@ -548,6 +576,7 @@ class TemplateParser { * true if the expression is true or no if attribute is set * * @param DOMElement $node + * @return boolean */ private function checkIf(DOMElement &$node) { if (($if = $node->getAttribute('if'))) { @@ -571,6 +600,13 @@ class SwfConfig { 'allowfullscreen', 'allownetworking'); public static $ATTRS = array('id', 'name', 'styleclass', 'align'); + /** + * + * @param array $swfConfig + * @param string $altContentId + * @param string $flashVars + * @return string + */ public static function buildSwfObjectCall($swfConfig, $altContentId, $flashVars = 'null') { $params = SwfConfig::buildJsObj($swfConfig, SwfConfig::$PARAMS); $attrs = SwfConfig::buildJsObj($swfConfig, SwfConfig::$ATTRS);
