for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* MslsOptionsPost
* @author Dennis Ploetner <[email protected]>
* @since 0.9.8
*/
namespace lloc\Msls;
* Post options
* @package Msls
class MslsOptionsPost extends MslsOptions {
* Separator
* @var string
protected $sep = '_';
* Autoload
protected $autoload = 'no';
* Get postlink
* @param string $language
* @return string
public function get_postlink( $language ) {
if ( ! $this->has_value( $language ) ) {
return '';
}
$post = get_post( (int) $this->__get( $language ) );
if ( is_null( $post ) || 'publish' != $post->post_status ) {
if ( is_null( $this->with_front ) ) {
$post_object = get_post_type_object( $post->post_type );
$this->with_front = ! empty( $post_object->rewrite['with_front'] );
global $current_site;
$blog_id = MslsBlogCollection::instance()->get_blog_id( $language );
if ( $current_site->blog_id != $blog_id ) {
$option = get_blog_option( $blog_id, 'msls' );
$option
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
//error_log( print_r( $option, true ) );
return apply_filters( 'check_url', get_permalink( $post ), $this );
* Get current link
public function get_current_link() {
return (string) get_permalink( $this->get_arg( 0, 0 ) );
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.