Completed
Pull Request — master (#90)
by Janis
15:10
created

js/temp/app.js   A

Complexity

Total Complexity 7
Complexity/F 1.75

Size

Lines of Code 66
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 66
rs 10
c 0
b 0
f 0
cc 0
nc 1
mnd 1
bc 7
fnc 4
bpm 1.75
cpm 1.75
noi 3

2 Functions

Rating   Name   Duplication   Size   Complexity  
B App.constructor 0 40 1
A app.js ➔ App 0 20 1
1
/**
2
 * nextCloud - ocr
3
 *
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later. See the COPYING file.
6
 *
7
 * @author Janis Koehr <[email protected]>
8
 * @copyright Janis Koehr 2017
9
 */
10
(function (OC, OCA, window, $) {
0 ignored issues
show
Unused Code introduced by
The parameter $ is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
11
	'use strict';
12
13
	/**
14
	 * Instantiates all necessary objects to construct the app.
15
	 * @public
16
	 * @class Ocr.App
17
	 */
18
	var App = (function () {
19
		/** 
20
		 * The Ocr wide config parameters.
21
		 * @private
22
		 * @static
23
		 */
24
		var config = {
25
			STATUS_ENDPOINT: OC.generateUrl('/apps/ocr/status'),
26
			PROCESSING_ENDPOINT: OC.generateUrl('/apps/ocr'),
27
			ALLOWED_MIMETYPES: ['application/pdf', 'image/png', 'image/jpeg', 'image/tiff', 'image/jp2', 'image/jpm', 'image/jpx', 'image/webp', 'image/gif'],
28
		};
29
30
		/**
31
		 * Inner class
32
		 * @private
33
		 * @returns class
34
		 */
35
		var App = function () {
36
			/** Constructor */
37
38
			/** Instantiation of the OCA.Ocr.View. */
39
			this.$view = new OCA.Ocr.View();
40
41
			/** Instantiation of the OCA.Ocr.HttpService with OCR config as input parameter. */
42
			this.$httpService = new OCA.Ocr.HttpService(config);
43
44
			/** Instantiation of the OCA.Ocr.Util with OCR config as input parameter. */
45
			this.$util = new OCA.Ocr.Util(config);
46
47
			/** Instantiation of the OCA.Ocr.Controller with OCR config as input parameter. */
48
			this.$controller = new OCA.Ocr.Controller(this.$view, this.$util, this.$httpService);
49
			
50
			this.init = function () {
51
				this.$controller.init();
52
			}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
53
54
		}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
55
56
		return App;
57
	})();
58
	/**
59
	 * Register the App in the namespace
60
	 */
61
	/** We have to be in the Files App! */
62
	if (!OCA.Files) {
63
		return;
64
	}
65
	/** Escape when the requested file is public.php */
66
	if (/(public)\.php/i.exec(window.location.href) !== null) {
67
		return;
68
	}
69
	/** Create namespace Ocr */
70
	if (!OCA.Ocr) {
71
		OCA.Ocr = {};
72
	}
73
	OCA.Ocr.App = App;
74
	/** global: OC, OCA */
75
})(OC, OCA, window, jQuery);
76