Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6792039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:55:11+00:00 2026-05-26T17:55:11+00:00

I am trying to write documents for methods that use design patterns in PHP.

  • 0

I am trying to write documents for methods that use design patterns in PHP. Generally a method contains observers, intercepting filters and notifiers. How can I write this into a format that will fit the php docs? An example of a function that I am writing documentation for is below. And please tell if my formatting is off so I can get better at writing docs.

/**
     * Creates a checkbox input element with options passed too it.
     * 
     * @see PVHTML::getStandardAttributes()
     * @see PVHTML::getEventAttributes()
     * @see PVHTML::getStandardAttributes()
     * @see self::getFormAttributes()
     * 
     * @param string $name The name of the input being generated. Will be the input field's name
     * @param array $options Options than can be used to further distinguish the element. The options are
     *              the same values that will be passed through PVHTML::getStandardAttributes, PVHTML::getEventAttributes
     *              and get the self::getFormAttributes functions
     * @param array $css_options Options than can define how the CSS is styled around the form the div around the element.
     *              Options will be passed to PVHTML::getStandardAttributes() and PVHTML::getEventAttributes(). Have the option
     *              'disable_css' will disable the div surrouding the element.
     * 
     * @return string $element The string that creates the element
     * @access public
     */
    public static function checkbox($name, $options=array(), $css_options=array()) {

        if(self::_hasAdapter(get_class(), __FUNCTION__) )
            return self::_callAdapter(get_class(), __FUNCTION__, $name, $options, $css_options);

        $filtered = self::_applyFilter( get_class(), __FUNCTION__ ,  array('name'=>$name, 'options'=>$options, 'css_options'=>$css_options ), array('event'=>'args'));
        $name = $filtered['name'];
        $options = $filtered['options'];
        $css_options = $filtered['css_options'];

        $css_defaults=array('class'=>'form-checkbox');
        $css_options += $css_defaults;

        $input = self::input($name, 'checkbox', $options, $css_options);;
        self::_notify(get_class().'::'.__FUNCTION__, $input, $name, $options, $css_options);
        $input = self::_applyFilter( get_class(), __FUNCTION__ , $input , array('event'=>'return'));    

        return $input;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:55:12+00:00Added an answer on May 26, 2026 at 5:55 pm

    You have a tendency to write too much in comments, keep comments to a minimum. E.g. if the function is called checkbox and the parameter is $name – you don’t need to document that it’s the name of the checkbox. It’s obvious.

    You don’t need to use @see that way as well. That’s duplicate code. If it changes you need to change the comment as well. This will never be done correctly, so will result in misleading documentation in the future. That should be avoided.

    In any case you see which functions are used if you look into the code.

    If you write in comments, use small sentences that have the basic things: Who does what (and not why). If something is created, write by whom. Not just “The string that creates the element”. What element? How does the string create something? It’s just data. As it’s just data, maybe better

     * @return string HTML
    

    So it’s clear what the function returns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a method in Ruby that uses a here-document of
Trying to write a PowerShell cmdlet that will mute the sound at start, unless
Trying to write a couple of functions that will encrypt or decrypt a file
im trying to write an app that will display a list off lines from
I'm trying to write a regex function that will identify and replace a single
I'm trying to write some JavaScript for my website that will select all the
I am working with the classes in the System.Windows.Documents namespace, trying to write some
I am trying to write a small Cocoa application that helps me manage my
i'm trying to write a jquery plugin that when i click on a image
I'm trying to write an encrpytion using the OTP method. In keeping with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.