Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jagadeeshramuj created an issue. See original summary.

jagadeeshramuj’s picture

jagadeeshramuj’s picture

Status: Active » Needs review
jagadeeshramuj’s picture

added additional field for download title

jagadeeshramuj’s picture

Albert Volkman’s picture

Please move the business logic (functions that are not hooks) to the bottom of the module file, or to their own namespaced class if you want to get fancy.

  1. +++ b/amazons3_signed/amazons3_signed.info
    @@ -0,0 +1,7 @@
    +name = Amazon S3 signed url
    

    name = Amazon S3 Signed URL

  2. +++ b/amazons3_signed/amazons3_signed.module
    @@ -0,0 +1,241 @@
    + * Get the instance of the s3 object.
    

    S3

  3. +++ b/amazons3_signed/amazons3_signed.module
    @@ -0,0 +1,241 @@
    + * @return class
    

    Should be-

    @return \Aws\S3\S3Client
      The S3 Client.
  4. +++ b/amazons3_signed/amazons3_signed.module
    @@ -0,0 +1,241 @@
    +    try {
    

    Is this try/catch necessary? The base module doesn't do a similar check.

  5. +++ b/amazons3_signed/amazons3_signed.module
    @@ -0,0 +1,241 @@
    +      $s3 = \Drupal\amazons3\S3Client::factory();
    

    Add this class as a use statement at the top of the module file. Then change this line to read-
    $s3 = S3Client::factory();

  6. +++ b/amazons3_signed/amazons3_signed.module
    @@ -0,0 +1,241 @@
    + * Amazon s3 list of buckets.
    

    Capitalize s in "s3". Also, missing the return-

    @return \Guzzle\Service\Resource\Model
      The list of available S3 buckets.
  7. +++ b/amazons3_signed/amazons3_signed.module
    @@ -0,0 +1,241 @@
    +  else {
    

    Remove this conditional, and the return above. Simply have a singule `return $buckets` at the end.

  8. +++ b/amazons3_signed/amazons3_signed.module
    @@ -0,0 +1,241 @@
    +  if (empty($item['amazons3_signed']['object'])) {
    +    return TRUE;
    +  }
    +  return FALSE;
    

    Should be-
    return empty($item['amazons3_signed']['object']);

Albert Volkman’s picture

Status: Needs review » Needs work
jagadeeshramuj’s picture

HI Albert,

Thank you for your suggestions, i have fixed all the above issues other than issue no. 4
I am thinking having try...catch is good for error handler here, Kindly suggest me.

jagadeeshramuj’s picture

Status: Needs work » Needs review
Albert Volkman’s picture

I feel like #4 should be addressed within the amazons3 module's factory, or even the AWS factory itself. What does it return currently if the credentials are missing? A fatal error? For #8, return (empty($item['amazons3_signed']['object'])) ? TRUE : FALSE; is redundant, as empty() will already return TRUE/FALSE. That's why I had suggested return empty($item['amazons3_signed']['object']);.

jagadeeshramuj’s picture

HI Albert,

As per your suggestions i addressed #4 and #8 issues, kindly go through once and suggest me any changes required.